/* ── Z-Slice Tool styles ─────────────────────────────────────────────────── */

/* Panel wrapper inside sidebar */
#zslice_panel {
    padding: 0;
}

/* ── Enable toggle ───────────────────────────────────────────────────────── */
.zslice-enable-row {
    padding: 9px 20px 8px 20px;
    border-bottom: 1px solid var(--bg-light-color);
    margin-bottom: 2px;
}

.zslice-enable-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 88%;
    color: #333;
    user-select: none;
}

/* Hide native checkbox visually */
.zslice-enable-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Toggle switch track */
.zslice-enable-switch {
    display: inline-block;
    width: 34px;
    height: 18px;
    background: #555;
    border-radius: 9px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}

/* Toggle switch thumb */
.zslice-enable-switch::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    background: #aaa;
    border-radius: 50%;
    transition: left 0.18s, background 0.18s;
}

/* Checked (ON) state */
.zslice-enable-label input:checked + .zslice-enable-switch {
    background: #00bcd4;
}

.zslice-enable-label input:checked + .zslice-enable-switch::after {
    left: 18px;
    background: #fff;
}

.zslice-enable-label input:checked ~ .zslice-enable-text {
    color: #00bcd4;
    font-weight: bold;
}

/* Section labels */
.zslice-section-label {
    display: block;
    font-size: 80%;
    letter-spacing: 1px;
    font-weight: bold;
    color: var(--font-color);
    margin: 8px 20px 4px 20px;
    text-transform: uppercase;
}

/* Area row: button + clear icon side by side */
.zslice-area-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 20px;
}

.zslice-area-row button {
    flex: 1;
    background-color: var(--bg-light-color);
    border: 1px solid black;
    color: var(--font-color-2);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 85%;
    border-radius: 2px;
}

.zslice-area-row button:hover {
    filter: brightness(140%);
}

.zslice-area-row button.active {
    border-color: #00bcd4;
    color: #00bcd4;
}

#zslice_area_clear {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    flex: none;
    display: none;   /* shown only when area is set */
}

#zslice_area_clear:hover {
    color: #fff;
}

/* Info line below area row */
.zslice-area-info {
    font-size: 78%;
    color: #8aa1c4;
    margin: 2px 20px 6px 20px;
}

/* Slider + numeric input row */
.zslice-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 20px 0 20px;
}

.zslice-input-row label {
    font-size: 82%;
    color: var(--font-color);
    min-width: 28px;
}

.zslice-num-input {
    width: 64px;
    background-color: var(--bg-dark-color);
    border: 1px solid black;
    color: var(--font-color-2);
    padding: 2px 4px;
    font-size: 85%;
    text-align: right;
    border-radius: 2px;
}

.zslice-unit {
    font-size: 80%;
    color: var(--font-color);
}

/* jQueryUI slider overrides for cyan accent */
#zslice_z_slider .ui-slider-handle,
#zslice_thick_slider .ui-slider-handle {
    border-color: #00bcd4 !important;
    background-color: #00bcd4 !important;
}

/* Action buttons row */
.zslice-actions {
    display: flex;
    gap: 8px;
    margin: 10px 20px 6px 20px;
}

.zslice-btn-apply {
    flex: 1;
    background-color: #00bcd4;
    border: 1px solid #007a8a;
    color: #000;
    font-weight: bold;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 85%;
    border-radius: 2px;
}

.zslice-btn-apply:hover {
    filter: brightness(115%);
}

.zslice-btn-apply:disabled,
.zslice-btn-clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
}

.zslice-btn-clear {
    flex: 1;
    background-color: var(--bg-light-color);
    border: 1px solid black;
    color: var(--font-color-2);
    padding: 5px 8px;
    cursor: pointer;
    font-size: 85%;
    border-radius: 2px;
}

.zslice-btn-clear:hover {
    filter: brightness(140%);
}

.zslice-num-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#zslice_controls.is-adjusting .ui-slider {
    opacity: 0.55;
}

/* Export button */
#zslice_export_btn {
    display: block;
    width: calc(100% - 40px);
    margin: 4px 20px 10px 20px;
    background-color: var(--bg-light-color);
    border: 1px solid black;
    color: var(--font-color);
    padding: 5px 8px;
    cursor: pointer;
    font-size: 85%;
    border-radius: 2px;
    opacity: 0.4;
    pointer-events: none;
}

#zslice_export_btn.enabled {
    opacity: 1;
    pointer-events: auto;
    border-color: #00bcd4;
    color: #00bcd4;
}

#zslice_export_btn:hover {
    filter: brightness(140%);
}

/* Export modal overlay */
#zslice_export_modal {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
}

#zslice_export_modal.visible {
    display: flex;
}

.zslice-modal-box {
    background: var(--bg-color);
    border: 1px solid #00bcd4;
    border-radius: 4px;
    padding: 18px 22px;
    min-width: 260px;
    color: var(--font-color-2);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 90%;
}

.zslice-modal-box h3 {
    margin: 0 0 12px 0;
    font-size: 1em;
    color: #00bcd4;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.zslice-modal-box p {
    font-size: 82%;
    color: var(--font-color);
    margin: 0 0 12px 0;
}

/* Area info line shown in export modal */
.zslice-export-area-info {
    font-size: 81%;
    color: #aad4f5;
    background: rgba(0, 188, 212, 0.08);
    border-left: 3px solid #00bcd4;
    padding: 5px 8px;
    margin: -4px 0 12px 0;
    border-radius: 0 2px 2px 0;
    line-height: 1.4;
}

.zslice-export-area-info.zslice-area-warn {
    color: #ffe082;
    background: rgba(255, 204, 0, 0.08);
    border-left-color: #ffcc00;
}

.zslice-modal-formats {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.zslice-modal-formats button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: var(--bg-light-color);
    border: 2px solid transparent;
    color: var(--font-color-2);
    padding: 10px 4px 8px 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 85%;
    transition: filter 0.15s, border-color 0.15s;
}

.zslice-modal-formats button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zslice-fmt-icon {
    font-size: 1.5em;
    line-height: 1;
}

.zslice-fmt-name {
    font-weight: bold;
    font-size: 1.05em;
    letter-spacing: 1px;
}

.zslice-fmt-note {
    font-size: 72%;
    color: var(--font-color);
    text-align: center;
    line-height: 1.2;
}

/* LAS — azul/teal (punto cloud nativo) */
.zslice-fmt-las {
    border-color: #1976d2;
}
.zslice-fmt-las .zslice-fmt-icon,
.zslice-fmt-las .zslice-fmt-name {
    color: #42a5f5;
}
.zslice-fmt-las:hover:not(:disabled) {
    background: rgba(25, 118, 210, 0.15);
    filter: brightness(115%);
}

/* CSV — verde lima (texto/tabla) */
.zslice-fmt-csv {
    border-color: #388e3c;
}
.zslice-fmt-csv .zslice-fmt-icon,
.zslice-fmt-csv .zslice-fmt-name {
    color: #66bb6a;
}
.zslice-fmt-csv:hover:not(:disabled) {
    background: rgba(56, 142, 60, 0.15);
    filter: brightness(115%);
}

/* DXF — naranja/ámbar (CAD) */
.zslice-fmt-dxf {
    border-color: #f57c00;
}
.zslice-fmt-dxf .zslice-fmt-icon,
.zslice-fmt-dxf .zslice-fmt-name {
    color: #ffa726;
}
.zslice-fmt-dxf:hover:not(:disabled) {
    background: rgba(245, 124, 0, 0.15);
    filter: brightness(115%);
}

/* Status / error messages inside modal */
.zslice-export-status {
    font-size: 82%;
    color: var(--font-color);
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    padding: 7px 10px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.zslice-export-error {
    border-left: 3px solid #e53935;
    color: #ef9a9a;
}

.zslice-login-link {
    color: #00bcd4;
    text-decoration: underline;
    font-weight: bold;
    margin-left: 4px;
}

.zslice-export-status small {
    display: block;
    color: #777;
    margin-top: 3px;
}

.zslice-modal-close {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid #555;
    color: #888;
    padding: 4px;
    cursor: pointer;
    border-radius: 2px;
    font-size: 82%;
}

.zslice-modal-close:hover {
    color: #fff;
}

/* DXF projection options panel */
.zslice-dxf-options {
    margin: 10px 0 4px 0;
    padding: 11px 14px 13px 14px;
    background: #1a2a3a;
    border: 1px solid #2a4a6a;
    border-radius: 6px;
}

.zslice-dxf-opts-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #7aaccc;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.zslice-dxf-options label {
    display: block;
    font-size: 13px;
    color: #ccc;
    margin: 5px 0;
    cursor: pointer;
}

.zslice-dxf-options input[type="radio"] {
    margin-right: 7px;
    accent-color: #00bcd4;
    cursor: pointer;
}

.zslice-dxf-confirm {
    margin-top: 12px;
    width: 100%;
    padding: 9px 0;
    background: #00bcd4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.zslice-dxf-confirm:hover:not(:disabled) {
    background: #00a5b8;
}

.zslice-dxf-confirm:disabled {
    background: #357;
    cursor: not-allowed;
}

/* ── Loading state in export modal ──────────────────────────────────────────── */

/* Hide normal content while the export is processing */
#zslice_export_modal.is-loading .zslice-modal-formats,
#zslice_export_modal.is-loading #zslice_dxf_options,
#zslice_export_modal.is-loading .zslice-modal-desc,
#zslice_export_modal.is-loading #zslice_export_area_info {
    display: none !important;
}

/* Loading container */
#zslice_loading_state {
    text-align: center;
    padding: 14px 6px 12px;
    background: rgba(0, 188, 212, 0.04);
    border: 1px solid rgba(0, 188, 212, 0.13);
    border-radius: 8px;
    margin: 0 0 10px;
}

/* Double counter-rotating rings */
.zslice-loading-ring {
    position: relative;
    width: 54px;
    height: 54px;
    margin: 0 auto 15px;
}

.zslice-loading-ring::before,
.zslice-loading-ring::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

/* Outer ring — clockwise */
.zslice-loading-ring::before {
    inset: 0;
    border-top-color: #00bcd4;
    border-right-color: rgba(0, 188, 212, 0.22);
    animation: zslice-ring-cw 0.9s linear infinite;
}

/* Inner ring — counter-clockwise */
.zslice-loading-ring::after {
    inset: 9px;
    border-top-color: #00e5ff;
    border-left-color: rgba(0, 229, 255, 0.22);
    animation: zslice-ring-ccw 1.3s linear infinite;
}

@keyframes zslice-ring-cw  { to { transform: rotate(360deg);  } }
@keyframes zslice-ring-ccw { to { transform: rotate(-360deg); } }

/* Cycling message */
.zslice-loading-msg {
    font-size: 87%;
    font-weight: 600;
    color: #b2ebf2;
    margin: 0 0 11px;
    min-height: 1.3em;
    transition: opacity 0.25s ease;
}

/* Shimmer progress bar */
.zslice-loading-bar-wrap {
    height: 4px;
    background: rgba(0, 188, 212, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin: 0 4px 14px;
}

@keyframes zslice-shimmer {
    0%   { left: -60%; }
    100% { left: 110%; }
}

.zslice-loading-bar {
    position: absolute;
    top: 0;
    height: 100%;
    width: 55%;
    background: linear-gradient(
        90deg,
        transparent             0%,
        rgba(0, 188, 212, 0.25) 20%,
        #00bcd4                 45%,
        #00e5ff                 50%,
        #00bcd4                 55%,
        rgba(0, 188, 212, 0.25) 80%,
        transparent             100%
    );
    border-radius: 4px;
    animation: zslice-shimmer 1.6s ease-in-out infinite;
}

/* "Do not close" notice */
.zslice-loading-hint {
    font-size: 79%;
    color: #5a8a9a;
    margin: 0;
    line-height: 1.55;
}

.zslice-loading-hint strong {
    color: #80cbc4;
}

