:root {
    --bg-dark: #111115;
    --card-bg: rgba(30, 30, 35, 0.7);
    --accent: #4a9eff;
    --accent-hover: #3b82f6;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --border: rgba(255, 255, 255, 0.1);
    --radius: 16px;
}

.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.sidebar {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    height: 100vh;
    z-index: 10;
}

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    background: #0a0a0c;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tool-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.privacy-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    display: block;
    padding: 10px 14px;
    border-radius: 12px;
    margin-top: 12px;
    line-height: 1.4;
    text-align: left;
}

.tool-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphic Card */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding: 20px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.main-action {
    width: 100%;
    padding: 16px !important;
    font-size: 1.1rem !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    background: #ff4a4a;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.content-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.main-preview {
    flex: 2;
    min-width: 400px;
}

.mask-preview {
    flex: 1;
    min-width: 300px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* File Input Styling */
input[type="file"] {
    display: none;
}

.custom-file-upload {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
}

.custom-file-upload:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.input-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
}

.drop-hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.image-counter {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: 5px;
}

/* Slider Styling */
.setting-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-group > label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    opacity: 0.8;
}

.control-sub-group {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-group:hover {
    background: rgba(255, 255, 255, 0.06);
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-group input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkbox-group input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.checkbox-group label {
    cursor: pointer;
    user-select: none;
}

.ratio-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ratio-inputs input {
    flex: 1;
    min-width: 0;
    text-align: center;
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    font-weight: 700;
    color: var(--accent);
}

.ratio-inputs span {
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.5;
}

.ratio-inputs input:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

input[type="text"], 
input[type="number"],
select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
    outline: none;
}

input[type="text"]:hover, 
input[type="number"]:hover,
select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

input[type="text"]:focus, 
input[type="number"]:focus,
select:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

.ratio-inputs input {
    width: 70px;
    text-align: center;
}

.ratio-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 50px;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.3);
}

.preset-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}

/* Mode Toggle Styling */
.mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.mode-btn span {
    font-weight: 600;
}

.mode-btn svg {
    flex-shrink: 0;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select option {
    background: #1a1a1a;
    color: var(--text-main);
}

.sub-setting-row {
    display: flex;
    gap: 10px;
}

.sub-setting-row input {
    flex: 1;
    min-width: 0;
}

.filename-preview-box {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#filenamePreview {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent);
    word-break: break-all;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.mode-btn svg {
    opacity: 0.7;
}

.mode-btn.active svg {
    opacity: 1;
}

/* Censor Options Styling */
.control-sub-group {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.censor-type-toggle {
    display: flex;
    gap: 8px;
}

.type-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.type-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.censor-shape-toggle {
    display: flex;
    gap: 8px;
}

.shape-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.shape-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.shape-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.feature-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.premium-checkbox {
    margin: 0;
    padding: 12px;
}

.feature-ar-row {
    display: flex;
    gap: 12px;
}

.ar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ar-group label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.ratio-inputs.mini {
    margin-top: 0;
    padding: 6px;
}

.ratio-inputs.mini input {
    width: 30px;
}

.frame-shape-toggle {
    display: flex;
    gap: 8px;
}

.frame-shape-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.frame-shape-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.frame-shape-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.sub-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reset-slider {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: all 0.2s;
    vertical-align: middle;
    margin-left: 5px;
    opacity: 0.5;
}

.reset-slider:hover {
    color: var(--accent);
    opacity: 1;
    transform: rotate(-45deg);
}

.sub-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: -5px;
}

.flex-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.btn-tiny {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.btn-tiny:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-action {
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent);
    border-color: rgba(74, 158, 255, 0.2);
}

.btn-action:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

#censorColor {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}

#censorColor::-webkit-color-swatch-wrapper {
    padding: 0;
}

#censorColor::-webkit-color-swatch {
    border: 2px solid white;
    border-radius: 50%;
}

#colorHex {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent);
}

.emoji-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#censorEmoji {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px;
    border-radius: 8px;
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#censorEmoji:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.compact-checkbox {
    margin-top: 5px;
    padding: 5px 0;
    background: none;
    font-size: 0.85rem;
}

.compact-checkbox:hover {
    background: none;
}

/* Button Styling */
.btn-primary {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.btn-primary:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
}

.status-text {
    text-align: center;
    margin-bottom: 5px;
    color: var(--accent);
    font-family: monospace;
    min-height: 24px;
}

.gallery-status {
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    min-height: 20px;
}

/* Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.image-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: var(--gallery-ar, 1);
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-card:hover img {
    transform: scale(1.05);
}

.edit-overlay-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
    padding: 0;
}

.image-card:hover .edit-overlay-btn {
    opacity: 1;
}

.edit-overlay-btn:hover {
    background: var(--accent);
}

.error-card {
    border: 10px solid #7a0000; /* Start with dark red */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff4a4a;
    font-size: 0.8rem;
    text-align: center;
    padding: 10px;
    animation: flashError 1.5s infinite;
}

.error-border {
    border: 10px solid #7a0000;
    animation: flashError 1.5s infinite;
}

@keyframes flashError {
    0% { border-color: #7a0000; box-shadow: 0 0 5px rgba(122, 0, 0, 0.5); }
    50% { border-color: #ffffff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
    100% { border-color: #7a0000; box-shadow: 0 0 5px rgba(122, 0, 0, 0.5); }
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 90vw;
    height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: 0.3s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--accent);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 30px;
    padding: 16px;
    cursor: pointer;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    user-select: none;
    z-index: 1001;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 20px;
    z-index: 1002;
    color: white;
}

.icon-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.icon-btn:hover {
    background: white;
    color: black;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Preview Card Styles */
.preview-container {
    text-align: center;
}

.preview-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.preview-box {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    min-height: 200px;
    position: relative;
    /* For absolute loader */
}

.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: white;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#previewCanvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.preview-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}

/* Edit Modal Extras */
.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.edit-modal {
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.edit-modal-header {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    z-index: 1001; /* Above backgrop */
}

.edit-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

.edit-actions {
    display: flex;
    gap: 10px;
}

.edit-modal-content {
    width: 100%;
    max-width: 900px;
    height: calc(100vh - 120px);
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#editCropImage {
    max-width: 100%;
    max-height: 100%;
    display: block; /* Required by Cropper.js */
}

.ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-loader-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: slideUp 0.5s ease-out;
}

.ai-spinner-box {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 25px;
}

.ai-loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(74, 158, 255, 0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.ai-loader-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulseGlow 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px var(--accent);
}

.progress-container.premium {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.progress-bar.glow {
    background: linear-gradient(90deg, var(--accent), #70b8ff, var(--accent));
    background-size: 200% 100%;
    animation: gradientShift 2s linear infinite;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.4);
}

/* Mask Preview Specifics */
.ai-mask-container {
    border: 1px dashed var(--accent) !important;
    background: rgba(74, 158, 255, 0.02) !important;
}

.ai-mask-container h3 {
    color: var(--accent) !important;
    opacity: 0.8;
}

.mask-overlay-label {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: var(--accent);
    font-size: 0.65rem;
    padding: 4px;
    text-align: center;
    backdrop-filter: blur(4px);
    font-family: monospace;
    pointer-events: none;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.8); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.console-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9998;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.console-toggle-btn:hover {
    background: rgba(74, 158, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.console-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* Debug Console */
#debugConsole {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 200px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    pointer-events: none;
}

#debugConsole.visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

.debug-header {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.debug-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-only {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.icon-only:hover {
    color: var(--accent);
}

#clearLogs {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.replace-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: rgba(74, 158, 255, 0.03);
    border: 1px dashed var(--accent);
    border-radius: 16px;
}

.replacement-preview-container {
    position: relative;
    width: 100px;
    height: 100px;
}

#replacementFaceCanvas {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background: #000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.edit-btn-small {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.edit-btn-small:hover {
    transform: scale(1.1);
    background: #64b5f6;
}

.section-label-tiny {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 10px;
}

.color-grading-group {
    background: rgba(255,255,255,0.02);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.status-text-tiny {
    font-size: 0.65rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.btn-secondary.small {
    padding: 8px 16px;
    font-size: 0.8rem;
    gap: 6px;
    display: inline-flex;
    align-items: center;
}

.btn-stop {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn-stop:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

#debugLogs {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    padding: 2px 4px;
    border-radius: 2px;
}

.log-info { color: #88c0d0; }
.log-success { color: #a3be8c; }
.log-error { color: #bf616a; background: rgba(191, 97, 106, 0.1); }
.log-magic { color: var(--accent); font-weight: bold; }

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-scroll-area {
        height: auto;
        overflow: visible;
    }

    .sidebar-actions {
        position: static;
        padding: 20px;
    }

    .main-content {
        height: auto;
        overflow: visible;
        padding: 20px;
    }

    .main-preview {
        min-width: 0;
    }
}

/* Responsive Debug */
@media (max-width: 768px) {
    #debugConsole {
        width: calc(100% - 40px);
        bottom: 10px;
        right: 20px;
        height: 120px;
    }
}