/**
 * Image Editor Tool Styles
 * cristianodeluca.it
 */

.ie-tool-section {
    padding: 2.5rem 0 4rem 0;
}

/* ---------- Header ---------- */

.ie-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.ie-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #55ddff 50%, #c084fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ie-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.75);
    max-width: 640px;
    margin: 0 auto;
}

/* ---------- Card / Dropzone ---------- */

.ie-card {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
}

.ie-dropzone {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    background: rgba(13, 17, 23, 0.6);
    padding: 3.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.ie-dropzone:hover,
.ie-dropzone:focus-visible,
.ie-dropzone.is-dragover {
    border-color: #55ddff;
    background: rgba(85, 221, 255, 0.07);
    outline: none;
    transform: translateY(-2px);
}

.ie-dropzone-icon {
    font-size: 2.75rem;
    background: linear-gradient(135deg, #55ddff, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    display: block;
}

.ie-dropzone-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.4rem;
}

.ie-dropzone-text {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.ie-dropzone-text kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 5px;
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
    color: #ffffff;
}

.ie-dropzone-formats {
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0;
}

.ie-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ie-dropzone-error {
    display: none;
    margin: 1rem 0 0 0;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    font-size: 0.9rem;
}

.ie-dropzone-error.is-visible {
    display: block;
}

/* ---------- Editor shell ---------- */

.ie-editor {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
    overflow: hidden;
}

.ie-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 17, 23, 0.5);
}

.ie-file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.ie-file-meta i {
    color: #55ddff;
}

.ie-file-name {
    font-weight: 600;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ie-file-dims {
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
}

.ie-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ie-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
}

/* ---------- Stage ---------- */

.ie-stage-wrapper {
    padding: 1.25rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
}

.ie-stage {
    position: relative;
    height: 60vh;
    min-height: 360px;
    max-height: 640px;
    border-radius: 14px;
    overflow: hidden;
    background-color: #0d1117;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
}

.ie-stage > img {
    display: block;
    max-width: 100%;
}

/* Anteprima live dei filtri: applicata alle immagini generate da Cropper.js */
.ie-stage .cropper-canvas > img,
.ie-stage .cropper-view-box > img {
    filter: var(--ie-filter, none);
}

.ie-stage .cropper-view-box {
    outline: 1px solid #55ddff;
    outline-color: rgba(85, 221, 255, 0.9);
}

.ie-stage .cropper-line,
.ie-stage .cropper-point {
    background-color: #55ddff;
}

.ie-stage .cropper-dashed {
    border-color: rgba(255, 255, 255, 0.5);
}

.ie-stage-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
}

.ie-toolbar-sep {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 0.35rem;
}

/* ---------- Buttons ---------- */

.btn-ie,
.btn-ie-icon,
.btn-ie-chip {
    background: linear-gradient(135deg, rgba(85, 221, 255, 0.12), rgba(168, 85, 247, 0.12));
    border: 1px solid rgba(85, 221, 255, 0.25);
    color: #55ddff;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.btn-ie {
    font-size: 0.85rem;
    padding: 0.5rem 0.9rem;
}

.btn-ie-icon {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
    padding: 0;
}

.btn-ie:hover:not(:disabled),
.btn-ie-icon:hover:not(:disabled),
.btn-ie-chip:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(85, 221, 255, 0.28), rgba(168, 85, 247, 0.28));
    color: #ffffff;
    border-color: #55ddff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(85, 221, 255, 0.18);
}

.btn-ie:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-ie-icon.active {
    background: linear-gradient(135deg, rgba(85, 221, 255, 0.35), rgba(168, 85, 247, 0.35));
    border-color: #55ddff;
    color: #ffffff;
}

.btn-ie-primary {
    background: linear-gradient(135deg, #55ddff, #c084fc);
    border-color: transparent;
    color: #0d1117;
    font-weight: 700;
}

.btn-ie-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7ae6ff, #d4a4ff);
    color: #0d1117;
    box-shadow: 0 6px 20px rgba(85, 221, 255, 0.3);
}

/* ---------- Sidebar ---------- */

.ie-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ie-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ie-tab {
    flex: 1 1 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.85rem 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.ie-tab i {
    font-size: 1rem;
}

.ie-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.ie-tab.active {
    color: #55ddff;
    border-bottom-color: #55ddff;
    background: rgba(85, 221, 255, 0.06);
}

.ie-panel {
    display: none;
    padding: 1.25rem;
    overflow-y: auto;
}

.ie-panel.active {
    display: block;
}

.ie-field {
    margin-bottom: 1.1rem;
}

.ie-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
}

.ie-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #55ddff;
    text-transform: none;
    letter-spacing: 0;
}

/* Chips proporzioni */

.ie-ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
}

.btn-ie-chip {
    font-size: 0.78rem;
    padding: 0.45rem 0.2rem;
}

.btn-ie-chip.active {
    background: linear-gradient(135deg, rgba(85, 221, 255, 0.35), rgba(168, 85, 247, 0.35));
    border-color: #55ddff;
    color: #ffffff;
}

/* Scaglioni rotazione / specchiatura */

.ie-step-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.btn-ie-step {
    font-size: 0.78rem;
    padding: 0.5rem 0.55rem;
    justify-content: flex-start;
    gap: 0.4rem;
    text-align: left;
    line-height: 1.2;
}

.btn-ie-step i {
    font-size: 0.85rem;
    flex: 0 0 auto;
    width: 1em;
    text-align: center;
}

/* Input */

.ie-input-pair {
    display: flex;
    gap: 0.5rem;
}

.ie-input-group {
    display: flex;
    align-items: stretch;
    flex: 1 1 0;
    min-width: 0;
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ie-input-group:focus-within {
    border-color: #55ddff;
    box-shadow: 0 0 14px rgba(85, 221, 255, 0.2);
}

.ie-input-addon {
    display: flex;
    align-items: center;
    padding: 0 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.04);
}

.ie-input {
    width: 100%;
    min-width: 0;
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
}

.ie-input-group .ie-input {
    border: none;
    border-radius: 0;
    background: transparent;
}

.ie-input:focus {
    outline: none;
    border-color: #55ddff;
    box-shadow: 0 0 14px rgba(85, 221, 255, 0.2);
}

.ie-input-group .ie-input:focus {
    box-shadow: none;
}

.ie-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2355ddff'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 14px;
    padding-right: 2rem;
}

.ie-select option {
    background: #161b22;
    color: #ffffff;
}

.ie-color {
    height: 42px;
    padding: 0.25rem;
    cursor: pointer;
}

.ie-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
}

.ie-check input {
    width: 16px;
    height: 16px;
    accent-color: #55ddff;
    cursor: pointer;
}

/* Range */

.ie-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.ie-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #55ddff, #c084fc);
    border: 2px solid #0d1117;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(85, 221, 255, 0.5);
}

.ie-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #55ddff, #c084fc);
    border: 2px solid #0d1117;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(85, 221, 255, 0.5);
}

/* Azioni pannello */

.ie-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ie-actions .btn-ie {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
}

.ie-export-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: rgba(85, 221, 255, 0.07);
    border: 1px solid rgba(85, 221, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    font-family: 'Courier New', Courier, monospace;
}

.ie-export-preview i {
    color: #55ddff;
}

/* ---------- Info box ---------- */

.ie-info-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    line-height: 1.6;
}

.ie-info-box h6 {
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ie-info-box .fs-sm {
    font-size: 0.82rem;
}

/* ---------- Toast ---------- */

.ie-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 1.5rem);
    z-index: 1080;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    background: rgba(22, 27, 34, 0.96);
    border: 1px solid rgba(85, 221, 255, 0.35);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ie-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.ie-toast.is-error {
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .ie-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .ie-stage-wrapper {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .ie-stage {
        height: 50vh;
        min-height: 300px;
    }
}

@media (max-width: 575.98px) {
    .ie-title {
        font-size: 1.9rem;
    }

    .ie-card {
        padding: 1.25rem;
    }

    .ie-dropzone {
        padding: 2.5rem 1rem;
    }

    .ie-topbar-actions .btn-ie span {
        display: none;
    }

    .ie-topbar-actions .btn-ie {
        width: 40px;
        height: 38px;
        padding: 0;
    }

    .ie-file-name {
        max-width: 160px;
    }

    .ie-ratio-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
