@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

* {
    box-sizing: border-box;
}

:root {
    --bg-dark: #313233;
    --bg-light: #f2f2f2;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.125);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-dark: #f2f2f2;
    --text-light: #313233;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    
    /* Light Theme Overrides */
    --glass-bg-light: rgba(255, 255, 255, 0.5);
    --glass-border-light: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif !important;
}

body {
    background: var(--bg-dark);
    color: var(--text-dark);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.light-mode {
    background: var(--bg-light);
    color: var(--text-light);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

body.light-mode .glass-card {
    background: var(--glass-bg-light);
    border-color: var(--glass-border-light);
    box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.07);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
}

body.light-mode .btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-light);
}

.nav-btn, .nav-btn * {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: inherit !important;
    text-decoration: none !important;
}

.nav-btn {
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif !important;
}

.nav-btn:hover {
    transform: scale(1.3) !important;
    background: transparent !important;
}

.nav-btn .material-symbols-outlined {
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-block;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24;
  font-size: 20px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.tag {
    background: var(--accent);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 4px;
}

.input-field {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    outline: none;
    font-size: 1rem;
}

/* Sidebar Input Refinement */
.drawer #panels-content .panel-section .panel-input {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    flex: 1 !important;
    line-height: 38px !important;
    box-sizing: border-box !important;
}

/* Sidebar Button Refinement */
.drawer #panels-content .panel-section .btn-add-panel-item {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border-radius: 8px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.btn-add-panel-item .material-symbols-outlined {
    font-size: 20px !important;
}

/* Panel Color Coding - Final Harden */
.panel-section.panel-characters h4 { color: #FDD835 !important; opacity: 1 !important; }
.panel-section.panel-characters .tags-container .tag,
.panel-section.panel-characters .tags-container .panel-pill { background: #FDD835 !important; color: #333 !important; }
.panel-section.panel-characters .tags-container .panel-pill span { color: #333 !important; }
.panel-section.panel-characters .btn-add-panel-item { background: #FDD835 !important; color: #333 !important; }

.panel-section.panel-locations h4 { color: #43A047 !important; opacity: 1 !important; }
.panel-section.panel-locations .tags-container .tag,
.panel-section.panel-locations .tags-container .panel-pill { background: #43A047 !important; color: white !important; }
.panel-section.panel-locations .btn-add-panel-item { background: #43A047 !important; color: white !important; }

.panel-section.panel-camera h4 { color: #2196F3 !important; opacity: 1 !important; }
.panel-section.panel-camera .tags-container .tag,
.panel-section.panel-camera .tags-container .panel-pill { background: #2196F3 !important; color: white !important; }
.panel-section.panel-camera .btn-add-panel-item { background: #2196F3 !important; color: white !important; }

.panel-section.panel-sound h4 { color: #009688 !important; opacity: 1 !important; }
.panel-section.panel-sound .tags-container .tag,
.panel-section.panel-sound .tags-container .panel-pill { background: #009688 !important; color: white !important; }
.panel-section.panel-sound .btn-add-panel-item { background: #009688 !important; color: white !important; }

.panel-section.panel-structure h4 { color: #3F51B5 !important; opacity: 1 !important; }
.panel-section.panel-structure .tags-container .tag,
.panel-section.panel-structure .tags-container .panel-pill { background: #3F51B5 !important; color: white !important; }
.panel-section.panel-structure .btn-add-panel-item { background: #3F51B5 !important; color: white !important; }

.panel-section.panel-vfx h4 { color: #00BCD4 !important; opacity: 1 !important; }
.panel-section.panel-vfx .tags-container .tag,
.panel-section.panel-vfx .tags-container .panel-pill { background: #00BCD4 !important; color: white !important; }
.panel-section.panel-vfx .btn-add-panel-item { background: #00BCD4 !important; color: white !important; }

.panel-section.panel-research h4 { color: #FFC107 !important; opacity: 1 !important; }
.panel-section.panel-research .tags-container .tag,
.panel-section.panel-research .tags-container .panel-pill { background: #FFC107 !important; color: #333 !important; }
.panel-section.panel-research .tags-container .tag span,
.panel-section.panel-research .tags-container .panel-pill span { color: #333 !important; }
.panel-section.panel-research .btn-add-panel-item { background: #FFC107 !important; color: #333 !important; }

.panel-section.panel-set h4 { color: #4CAF50 !important; opacity: 1 !important; }
.panel-section.panel-set .tags-container .tag,
.panel-section.panel-set .tags-container .panel-pill { background: #4CAF50 !important; color: white !important; }
.panel-section.panel-set .btn-add-panel-item { background: #4CAF50 !important; color: white !important; }

.panel-section.panel-wardrobe h4 { color: #607D8B !important; opacity: 1 !important; }
.panel-section.panel-wardrobe .tags-container .tag,
.panel-section.panel-wardrobe .tags-container .panel-pill { background: #607D8B !important; color: white !important; }
.panel-section.panel-wardrobe .btn-add-panel-item { background: #607D8B !important; color: white !important; }

.panel-section.panel-props h4 { color: #795548 !important; opacity: 1 !important; }
.panel-section.panel-props .tags-container .tag,
.panel-section.panel-props .tags-container .panel-pill { background: #795548 !important; color: white !important; }
.panel-section.panel-props .btn-add-panel-item { background: #795548 !important; color: white !important; }

.panel-section.panel-optics h4 { color: #673AB7 !important; opacity: 1 !important; }
.panel-section.panel-optics .tags-container .tag,
.panel-section.panel-optics .tags-container .panel-pill { background: #673AB7 !important; color: white !important; }
.panel-section.panel-optics .btn-add-panel-item { background: #673AB7 !important; color: white !important; }

/* Hierarchical Panels */
.panel-group {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-mode .panel-group {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

.sub-panels-list {
    margin-left: 30px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid var(--accent);
}

.sub-panel-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.sub-panel-row .input-field {
    padding: 8px 12px !important;
    font-size: 0.9rem !important;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-add-sub {
    margin-left: 30px;
    margin-top: 5px;
    opacity: 0.7;
    font-size: 0.85rem;
    background: transparent !important;
    color: var(--accent) !important;
    padding: 5px 0 !important;
}

.btn-add-sub:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Custom Select Styling */
.custom-select {
    position: relative;
    width: 100%;
    margin: 8px 0;
}

.select-trigger {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1rem;
}

body.light-mode .select-trigger {
    background: white;
    border-color: #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.select-trigger::after {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

body.light-mode .select-trigger::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23313233'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

.custom-select.active .select-trigger::after {
    transform: rotate(180deg);
}

.select-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 1001;
    background: rgba(49, 50, 51, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    max-height: 250px;
    overflow-y: auto;
    display: none;
    padding: 8px;
}

body.light-mode .select-options {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.custom-select.active .select-options {
    display: block;
    animation: fadeInScale 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.select-option {
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    font-size: 1rem;
}

.select-option:last-child {
    margin-bottom: 0;
}

.select-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.light-mode .select-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.select-option.selected {
    background: var(--accent) !important;
    color: white !important;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(-5px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Custom Scrollbar */
.select-options::-webkit-scrollbar {
    width: 6px;
}
.select-options::-webkit-scrollbar-track {
    background: transparent;
}
.select-options::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
body.light-mode .select-options::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

body.light-mode .input-field {
    background: white;
    color: #0f172a;
    border-color: #ddd;
}

#add-panel {
    color: #6366f1 !important;
    background: transparent !important;
    font-weight: 500;
}

.remove-panel {
    width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: #ff4757 !important;
    color: white !important;
}
