/* 
 * InpaintLab Premium Dark Theme Style System
 */

 :root {
    --bg-dark: #090d16;
    --bg-card: rgba(17, 24, 39, 0.65);
    --bg-panel: #111827;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(139, 92, 246, 0.4);
    
    --primary: #8b5cf6;
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-inverse: #090d16;
    
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);
    --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.loader-overlay {
    display: none !important;
}

.loader-content {
    text-align: center;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.logo-animation {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.magic-icon-glow {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.6));
    animation: pulseGlow 2s infinite ease-in-out;
}

.loader-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 30%;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    animation: loaderProgress 2.5s infinite linear;
}

.loader-tip {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   App Structure
   ========================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.app-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.75rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.logo-accent {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Workspace */
.app-workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
}

/* ==========================================
   Upload Screen State
   ========================================== */
.upload-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.upload-card {
    width: 100%;
    max-width: 600px;
    min-height: 300px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.upload-card:hover, .upload-card.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.03);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.upload-icon-wrapper {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: var(--transition-fast);
}

.upload-card:hover .upload-icon-wrapper {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.4));
}

.upload-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.upload-meta {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.25);
}

/* Sample Images Section */
.samples-container {
    margin-top: 3.5rem;
    text-align: center;
    width: 100%;
    max-width: 680px;
}

.samples-container h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.samples-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.sample-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition-smooth);
}

.sample-image-preview {
    height: 110px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
    background-size: cover;
    background-position: center;
}

.sample-card:hover {
    transform: translateY(-4px);
}

.sample-card:hover .sample-image-preview {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.sample-card span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-fast);
}

.sample-card:hover span {
    color: #ffffff;
}

.sample-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(9, 13, 22, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #a78bfa;
}

/* Sample Previews (Use actual generated preview images) */
.watermark-preview {
    background-image: url('samples/watermark.png');
}

.text-preview {
    background-image: url('samples/text.png');
}

.blemish-preview {
    background-image: url('samples/blemish.png');
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.btn-success:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.btn-large {
    padding: 0.95rem 2.25rem;
    font-size: 1.05rem;
    border-radius: 16px;
}

/* ==========================================
   Editor Screen State
   ========================================== */
.editor-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    height: 100%;
}

.hidden {
    display: none !important;
}

/* Left Sidebar */
.editor-sidebar {
    width: 320px;
    background-color: rgba(17, 24, 39, 0.4);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 2rem;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tool Buttons Toggle */
.tool-toggle-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.tool-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    padding: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tool-btn:hover {
    color: #ffffff;
}

.tool-btn.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.25);
}

/* Form Settings Input */
.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.setting-help {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.2);
    line-height: 1.3;
}

.select-input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.7rem;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Custom Sliders */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    outline: none;
    margin: 10px 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
    cursor: pointer;
    transition: transform 0.1s ease;
    border: 3px solid var(--primary);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.action-grid #btn-clear-mask {
    grid-column: span 2;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.sidebar-footer button {
    width: 100%;
}

/* Central Interactive Workspace */
.canvas-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #0d121f;
}

.canvas-container-outer {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 2rem;
    cursor: crosshair;
}

.canvas-container-inner {
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    background-image: 
        linear-gradient(45deg, #111827 25%, transparent 25%), 
        linear-gradient(-45deg, #111827 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #111827 75%), 
        linear-gradient(-45deg, transparent 75%, #111827 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #0c0f17;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    cursor: none; /* Hide default cursor to show only custom brush cursor */
}

/* Display Canvas style */
#display-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Floating custom brush outline cursor */
.brush-cursor {
    position: absolute;
    width: 25px;
    height: 25px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 1px #000000, 0 0 4px rgba(0, 0, 0, 0.5); /* Outer black outline, shadow */
    display: none;
    z-index: 50;
}

/* Bottom Controls */
.editor-bottom-bar {
    height: 80px;
    background: rgba(17, 24, 39, 0.6);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    gap: 1.5rem;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 240px;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.zoom-level {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 48px;
    text-align: center;
}

/* Process Control */
.process-action {
    flex: 1;
    display: flex;
    justify-content: center;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Output Controls */
.output-controls {
    display: flex;
    gap: 1rem;
    width: 240px;
    justify-content: flex-end;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.6));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(139, 92, 246, 0.9));
    }
}

@keyframes loaderProgress {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(300%);
    }
}

/* ==========================================
   Responsive Adaptations
   ========================================== */
@media (max-width: 992px) {
    .editor-screen {
        flex-direction: column;
    }
    .editor-sidebar {
        width: 100%;
        height: auto;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        gap: 1rem;
    }
    .sidebar-footer {
        display: none; /* Accessible via header/other buttons */
    }
    .action-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .action-grid #btn-clear-mask {
        grid-column: span 1;
    }
    .editor-bottom-bar {
        padding: 0 1rem;
    }
    .zoom-controls, .output-controls {
        width: auto;
    }
    .zoom-level {
        display: none; /* Save space */
    }
}

@media (max-width: 600px) {
    .samples-grid {
        grid-template-columns: 1fr;
    }
    .editor-bottom-bar {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    .zoom-controls {
        display: none; /* Hide zoom on small screens to fit buttons */
    }
    .process-action {
        width: 100%;
    }
    .process-action button {
        width: 100%;
    }
    .output-controls {
        width: 100%;
        justify-content: space-between;
    }
    .output-controls button {
        flex: 1;
    }
}
