:root {
    /* Light Mode (Default) */
    --bg-dark: #f5f0e6;
    --bg-gradient: radial-gradient(circle at center, #fbf8f2 0%, #f5f0e6 100%);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(74, 92, 142, 0.2);
    --gold: #a91d22;
    --gold-glow: 0 0 15px rgba(169, 29, 34, 0.3);
    --text-light: #4a5c8e;
    --text-muted: #7886b0;
    --font-heading: 'Google Sans', sans-serif;
    --font-body: 'Google Sans', sans-serif;
    
    --input-bg: rgba(255, 255, 255, 0.4);
    --input-bg-focus: rgba(255, 255, 255, 0.8);
    --option-bg: #ffffff;
    --overlay-bg: rgba(255, 255, 255, 0.7);
    --loading-bg: rgba(245, 240, 230, 0.9);
    --spinner-bg: rgba(74, 92, 142, 0.2);
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-dark: #050814;
    --bg-gradient: radial-gradient(circle at center, #131726 0%, #050814 100%);
    --glass-bg: rgba(20, 25, 45, 0.7);
    --glass-border: rgba(245, 240, 230, 0.1);
    --gold: #d92b34;
    --gold-glow: 0 0 20px rgba(217, 43, 52, 0.3);
    --text-light: #f5f0e6;
    --text-muted: #a1abc2;
    
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-bg-focus: rgba(255, 255, 255, 0.05);
    --option-bg: #131726;
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --loading-bg: rgba(5, 8, 20, 0.8);
    --spinner-bg: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: var(--bg-gradient);
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Top Controls */
.top-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none;
    align-items: center;
}
@media (max-width: 768px) {
    .top-controls {
        padding: 0.8rem 1rem;
    }
}

.top-tabs, .top-actions {
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    white-space: nowrap;
}
.icon-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: var(--gold-glow);
}
.icon-btn:hover {
    border-color: var(--gold);
    box-shadow: var(--gold-glow);
}
.icon-btn.circle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.2rem;
}

/* Screens */
.app-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 6.5rem 1rem 2rem 1rem;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 1200px; /* Full width support */
    transition: all 0.5s ease;
}

@media (max-width: 768px) {
    .glass-panel {
        padding: 1.5rem;
    }
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-out forwards;
}
.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo */
.app-logo {
    max-width: 160px;
    width: 100%;
    margin: 0 auto 1.5rem auto;
    display: none;
}
.app-logo.light-logo { display: block; }
[data-theme="dark"] .app-logo.light-logo { display: none; }
[data-theme="dark"] .app-logo.dark-logo { display: block; }

.title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-align: center;
    text-shadow: var(--gold-glow);
}

.subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
}

/* Custom Multi-Select */
.custom-multiselect {
    position: relative;
    width: 100%;
}
.multiselect-header {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.3s ease;
}
#multiselect-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}
.multiselect-header:hover {
    border-color: var(--gold);
}
.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    padding: 0.8rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
[data-theme="dark"] .multiselect-dropdown {
    background: #252836;
    border-color: #3b3e51;
}
.multiselect-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    color: var(--text-light);
    margin-bottom: 0;
}
.multiselect-dropdown label:hover {
    background: rgba(169, 29, 34, 0.1);
}

/* Forms & Buttons */
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

.input-field {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: all 0.3s;
}
.input-field:focus {
    border-color: var(--gold);
    background: var(--input-bg-focus);
    box-shadow: 0 0 10px rgba(169, 29, 34, 0.1);
}
textarea.input-field { resize: vertical; min-height: 80px; }
select.input-field option { background-color: var(--option-bg); color: var(--text-light); }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.checkbox-group input { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }
.checkbox-group label { margin-bottom: 0; cursor: pointer; }

.file-upload-wrapper {
    position: relative; width: 100%; height: 120px; border: 2px dashed var(--glass-border);
    border-radius: 12px; display: flex; justify-content: center; align-items: center;
    flex-direction: column; cursor: pointer; transition: all 0.3s; background: var(--input-bg);
    overflow: hidden;
}
.file-upload-wrapper:hover { border-color: var(--gold); background: var(--input-bg-focus); }
.file-upload-wrapper input[type="file"] { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.file-upload-text { color: var(--text-muted); font-size: 0.9rem; pointer-events: none; z-index: 1; }
#preview-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; display: none; background: var(--overlay-bg); }

.primary-btn {
    background: var(--gold);
    color: #ffffff;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 30px;
    border: none;
    width: 100%;
    cursor: pointer;
    box-shadow: var(--gold-glow);
    transition: all 0.3s ease;
    margin-top: 1rem;
}
.primary-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.primary-btn:disabled { background: #ccc; color: #888; box-shadow: none; cursor: not-allowed; transform: none; }

.secondary-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: inline-block;
    text-align: center;
}
.secondary-btn:hover {
    background: rgba(169, 29, 34, 0.1);
    box-shadow: var(--gold-glow);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--loading-bg);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex;
    justify-content: center; align-items: center; z-index: 9999; flex-direction: column; display: none;
}
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--spinner-bg); border-top: 4px solid var(--gold);
    border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#loading-text { color: var(--gold); font-weight: bold; }
