/* assets/css/style.css */
:root { 
    --bg-dark: #1e1e1e; 
    --panel-bg: #252526; 
    --border: #333333; 
    --accent: #007acc; 
    --status-bar-bg: #007acc; 
    --text-main: #cccccc; 
    --text-light: #ffffff; 
    --item-hover: #2a2d2e; 
    --item-active: #37373d; 
    --gold: #fbbf24; 
    --purple: #8b5cf6; 
}

body { 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    font-family: 'Inter', sans-serif; 
    height: 100vh; 
    overflow: hidden; 
    display: flex; 
}

/* --- 1. SIDEBAR --- */
.sidebar-slim { 
    width: 50px; 
    background: #333333; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding-top: 15px; 
    border-right: 1px solid var(--border); 
    flex-shrink: 0; 
    z-index: 50; /* Highest priority */
    position: relative; 
}

.nav-icon { 
    width: 36px; 
    height: 36px; 
    border-radius: 5px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #858585; 
    margin-bottom: 10px; 
    cursor: pointer; 
    transition: all 0.2s; 
    text-decoration: none; 
}

.nav-icon:hover, .nav-icon.active { color: white; background: var(--panel-bg); }

/* --- 2. SETTINGS PANEL (Responsive Logic) --- */
.settings-drawer { 
    position: fixed; 
    top: 0; 
    left: 50px; /* Sidebar width */
    width: 300px; 
    height: 100vh; 
    background: #1a1a1a; 
    border-right: 1px solid var(--border); 
    z-index: 40; 
    display: flex; 
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- 3. MAIN STAGE (Responsive Logic) --- */
.main-stage { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-dark); 
    overflow: hidden; 
    position: relative; 
    transition: margin-left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- DESKTOP VIEW (Default) --- */
@media (min-width: 769px) {
    /* Desktop এ প্যানেল সবসময় ফিক্সড */
    .settings-drawer { transform: translateX(0); }
    
    /* Desktop এ মেইন কন্টেন্ট ডানে সরে থাকবে */
    .main-stage { 
        margin-left: 300px; /* Settings width */
        width: calc(100% - 350px); /* Total - (Sidebar + Settings) */
    }
    
    /* Desktop এ গিয়ার আইকন এবং ক্লোজ বাটন লুকানো থাকবে */
    .mobile-settings-trigger { display: none !important; }
    .btn-close-panel { display: none !important; }
}

/* --- MOBILE VIEW (Tablets & Phones) --- */
@media (max-width: 768px) {
    /* Mobile এ প্যানেল শুরুতে লুকানো থাকবে */
    .settings-drawer { 
        transform: translateX(-100%); 
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    
    /* Mobile এ ক্লাস যোগ হলে প্যানেল বের হবে */
    .settings-drawer.mobile-open { transform: translateX(0); }
    
    /* Mobile এ মেইন কন্টেন্ট ফুল উইডথ নিবে */
    .main-stage { 
        margin-left: 0; 
        width: calc(100% - 50px); 
    }
    
    /* Mobile এ ক্লোজ বাটন দেখাবে */
    .btn-close-panel { display: flex !important; }
}

/* UI Elements Styles */
.sd-header { height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font-weight: 700; color: white; letter-spacing: 0.5px; }
.sd-body { padding: 20px; overflow-y: auto; flex-grow: 1; }
.sd-section-title { font-size: 0.75rem; text-transform: uppercase; color: #666; font-weight: 700; margin-bottom: 15px; margin-top: 20px; display: block; border-bottom: 1px solid #333; padding-bottom: 5px; }

.mode-toggle-box { background: #000; padding: 4px; border-radius: 6px; display: flex; border: 1px solid #333; margin-bottom: 10px; }
.mode-btn-panel { flex: 1; background: transparent; border: none; color: #888; padding: 8px; font-size: 0.85rem; font-weight: 600; border-radius: 4px; transition: all 0.2s; }
.mode-btn-panel:hover { color: white; }
.mode-btn-panel.active { background: #333; color: white; box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.mode-btn-panel.active.prompt { background: var(--purple); }
.mode-btn-panel.active.meta { background: var(--accent); }

.sd-label { font-size: 0.85rem; color: #aaa; margin-bottom: 5px; display: block; }
.form-select-custom { background-color: #2b2b2b; border: 1px solid #444; color: white; font-size: 0.9rem; border-radius: 4px; padding: 8px 12px; width: 100%; cursor: pointer; }
.form-select-custom:focus { border-color: var(--accent); outline: none; }

.btn-icon-head { background: transparent; border: 1px solid transparent; color: #888; width: 30px; height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-icon-head:hover { background: #333; color: white; }

input[type=range] { width: 100%; height: 4px; background: #444; border-radius: 2px; outline: none; -webkit-appearance: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: var(--accent); border-radius: 50%; cursor: pointer; border: 2px solid #1a1a1a; }

.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ratio-chip { background: #2b2b2b; border: 1px solid #444; color: #aaa; padding: 6px; font-size: 0.8rem; text-align: center; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.ratio-chip:hover { border-color: #666; color: white; }
.ratio-chip.active { background: var(--purple); border-color: var(--purple); color: white; font-weight: 600; }

.toolbar { height: 60px; background: var(--panel-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 15px; flex-shrink: 0; }
.app-title { font-weight: 700; color: var(--text-light); font-size: 0.9rem; letter-spacing: 0.5px; }
.credit-badge { background: #3a3d41; padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; color: #4fc1ff; cursor: pointer; border: 1px solid transparent; }

/* --- UPDATED GALLERY LAYOUT (Small Thumbnails / Masonry Style) --- */
.gallery-container { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 15px; 
    position: relative; 
    scroll-behavior: smooth; 
}

.gallery-grid { 
    /* CSS Columns for Pinterest-like Layout */
    column-width: 110px; /* Small responsive width */
    column-gap: 10px;    
    padding-bottom: 60px; 
}

.g-item { 
    background: var(--panel-bg); 
    border: 2px solid transparent; 
    border-radius: 6px; 
    overflow: hidden; 
    cursor: pointer; 
    transition: all 0.2s; 
    position: relative; 
    
    /* Prevent breaking across columns */
    break-inside: avoid; 
    
    /* Vertical spacing */
    margin-bottom: 10px; 
    
    /* Allow height to be defined by content */
    height: auto; 
    display: block; 
}

.g-item:hover { 
    background: var(--item-hover); 
    transform: translateY(-2px); 
    border-color: #444;
}

.g-item.selected { 
    border-color: var(--accent); 
    background: var(--item-active); 
    box-shadow: 0 0 10px rgba(0, 122, 204, 0.4); 
    z-index: 2; 
}

.g-item.processing-active { 
    border-color: var(--gold); 
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3); 
    transform: scale(1.02); 
    z-index: 5; 
}

.g-item img { 
    width: 100%; 
    height: auto; /* Maintain Aspect Ratio */
    display: block; 
    object-fit: contain; 
}

.g-status { 
    position: absolute; 
    top: 4px; 
    right: 4px; 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    z-index: 2; 
    border: 1px solid rgba(0,0,0,0.3); 
}

.st-pending { background: #d4d4d4; }
.st-processing { background: #007acc; box-shadow: 0 0 5px #007acc; }
.st-done { background: #4ec9b0; box-shadow: 0 0 5px #4ec9b0; }
.st-failed { background: #f14c4c; box-shadow: 0 0 5px #f14c4c; }

.empty-state { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #555; pointer-events: none; }

.inspector { width: 320px; background: var(--panel-bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.insp-header { height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 15px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: #858585; }
.insp-body { padding: 15px; overflow-y: auto; flex-grow: 1; }
.f-group { margin-bottom: 15px; }
.f-label { display: block; font-size: 0.75rem; color: #858585; margin-bottom: 5px; text-transform: uppercase; }
.f-input { width: 100%; background: #3c3c3c; border: 1px solid #3c3c3c; color: white; padding: 8px; font-size: 0.9rem; border-radius: 2px; }
textarea.f-input { resize: vertical; min-height: 80px; }
.form-select-dark { background-color: #3c3c3c; border: 1px solid #555; color: white; }

.btn-process { background: var(--accent); color: white; border: none; padding: 6px 16px; font-size: 0.85rem; font-weight: 600; border-radius: 2px; }
.btn-process:disabled { background: #333; color: #666; cursor: not-allowed; }
.btn-control { border: 1px solid #444; color: white; padding: 5px 12px; font-size: 0.85rem; border-radius: 2px; font-weight: 600; }
.btn-control.pause { background: #f59e0b; border-color: #f59e0b; color: black; }
.btn-control.resume { background: #10b981; border-color: #10b981; }
.btn-control.stop { background: #ef4444; border-color: #ef4444; }
.btn-icon { background: transparent; border: 1px solid #444; color: #ccc; padding: 4px 8px; border-radius: 2px; font-size: 0.8rem; }

.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.status-bar { height: 32px; background: #007acc; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; font-size: 0.75rem; flex-shrink: 0; }
.stat-group { display: flex; gap: 15px; align-items: center; }
.btn-status { background: rgba(255,255,255,0.1); border: none; color: white; padding: 3px 10px; border-radius: 3px; font-size: 0.7rem; cursor: pointer; }

/* Responsive adjustments */
@media (max-width: 1200px) { .inspector { display: none; } }