:root {
    --bg-color: #0a0e17;
    --text-color: #ffffff;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-color: #6366f1;
    /* Soft Indigo */
    --secondary-color: #38bdf8;
    /* Sky Blue */
    --danger-color: #f43f5e;
    /* Soft Rose */
    --gradient-1: #4338ca;
    --gradient-2: #6366f1;
    --card-glow: 0 0 15px rgba(99, 102, 241, 0.2);
    --active-glow: 0 0 20px rgba(56, 189, 248, 0.2);
}

[data-theme="light"] {
    /* Premium Light Theme Variables - Very Light Orange Test */
    --bg-color: #fff7ed;
    /* Cream/Light Orange */
    --text-color: #431407;
    /* Dark Brown */

    /* Glass Effect overrides */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(251, 146, 60, 0.3);

    /* Accents - Warm Orange Palette */
    --primary-color: #ea580c;
    /* Burnt Orange */
    --secondary-color: #f97316;
    /* Bright Orange */
    --danger-color: #ef4444;

    /* Gradients & Glows */
    --gradient-1: #c2410c;
    --gradient-2: #ea580c;
    --card-glow: 0 4px 15px rgba(234, 88, 12, 0.1);
    /* very subtle orange shadow */
    --active-glow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

/* Background Override */


/* Sidebar Specifics */
[data-theme="light"] .sidebar {
    background: rgba(255, 251, 235, 0.9);
    /* Whiter, stronger sidebar */
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar h2 a {
    color: #2c3e50;
    font-weight: 700;
}

[data-theme="light"] .folder-item {
    color: #555;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.08);
    /* Added visible border */
}

[data-theme="light"] .folder-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .folder-item.active {
    background: color-mix(in srgb, var(--folder-color), transparent 85%);
    color: var(--folder-color);
    border-color: var(--folder-color);
    box-shadow: none;
    text-shadow: none;
}

/* Note List */
[data-theme="light"] .note-list-panel {
    background: rgba(239, 235, 222, 0.8);
    /* Light Orange Tint for subtle grading */
}

[data-theme="light"] .search-input {
    background: #ffffff;
    border: 1px solid #e1e4e8;
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.1);
}

[data-theme="light"] .note-card {
    background: #ffffff;
    /* Removed !important to allow inline style for colored borders */
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    color: var(--text-color);
}

[data-theme="light"] .note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06);
    /* Removed border color override to keep the colored border */
}

[data-theme="light"] .note-card.active {
    background: #ffffff;
    box-shadow: 0 0 15px var(--note-color);
    /* Dynamic glow using folder color */
    transform: scale(1.02);
    z-index: 10;
}

[data-theme="light"] .note-title {
    color: #2c3e50;
    font-weight: 600;
}

[data-theme="light"] .note-preview {
    color: #7f8c8d;
}

[data-theme="light"] .note-date {
    color: #95a5a6;
}

/* Editor */
[data-theme="light"] .editor-panel {
    background: rgba(239, 235, 222, 0.9);
}

[data-theme="light"] .editor-toolbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #eee;
}

[data-theme="light"] .editor-title-input {
    color: #2c3e50;
}

[data-theme="light"] .editor-textarea {
    color: #2c3e50;
    line-height: 1.8;
}

/* Buttons & Inputs */
[data-theme="light"] .btn {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #555;
    box-shadow: none;
}

[data-theme="light"] .btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 2px 5px rgba(142, 68, 173, 0.3);
}

[data-theme="light"] .btn-primary:hover {
    filter: brightness(1.1);
}

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    background-image:
        linear-gradient(135deg, rgba(25, 25, 112, 0.2) 0%, rgba(10, 14, 23, 1) 50%),
        radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(56, 189, 248, 0.1) 0%, transparent 40%);
    min-height: 100vh;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}


/* FINAL OVERRIDES - Ensure Specificity */
body[data-theme="light"] {
    background-color: #f3f4f6 !important;
    /* Light grey to contrast with beige wrapper */
    background-image: none !important;
}


/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Specific overrides */
#settingsModal {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
}

[data-theme="light"] #settingsModal {
    background: rgba(255, 255, 255, 0.98);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--glass-border);
}

.sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.folder-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.folder-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.folder-item.active {
    background: color-mix(in srgb, var(--folder-color), transparent 85%);
    /* Subtle tint of the folder color */
    color: var(--text-color);
    border-color: var(--folder-color);
    box-shadow: none;
    /* No glow as requested */
    text-shadow: none;
}

.folder-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.folder-actions>* {
    flex: 1;
}

.btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #1a233a;
    filter: brightness(1.1);
}

/* Note List */
.note-list-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.search-bar {
    padding: 20px;
    border-bottom: none;
}

.search-input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.note-list {
    overflow-y: auto;
    flex-grow: 1;
    padding: 20px 15px;
    /* Increased padding to prevent shadow clipping */
}

.note-card {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.note-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border-color: var(--secondary-color);
}

.note-card.active {
    /* Border color is handled by inline style now */
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px var(--note-color);
    /* Dynamic glow matches border */
}

.note-title {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview {
    font-size: 0.85rem;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-date {
    font-size: 0.75rem;
    color: #666;
    margin-top: 8px;
    text-align: right;
}

/* Editor */
.editor-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
}

.editor-toolbar {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-title-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: bold;
    width: 60%;
    outline: none;
}

.editor-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    outline: none;
    font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Login/Auth Pages Overrides */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.auth-box {
    width: 400px;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
}

.auth-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
}

/* User Management / Legacy Support & Fixes */

/* Links */
a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout Wrappers */
.main-interface-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
}

.content-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

/* Navigation Tiers */
.menu-tier-1,
.menu-tier-2 {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    text-decoration: none;
}

.tab-button.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

/* Headings */
.section-heading h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: var(--text-color);
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--secondary-color);
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #b05565;
}

/* Light Theme Admin Overrides */
[data-theme="light"] .content-wrapper {
    background: rgba(239, 235, 222, 0.8);
    /* Exact match to note-list-panel */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-color: rgba(251, 146, 60, 0.2);
}

[data-theme="light"] .tab-button {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #4b5563;
}

[data-theme="light"] .tab-button:hover {
    background: #fdf2f8;
    /* Very light orange/pink tint */
    border-color: var(--primary-color);
    color: var(--primary-color);
}

[data-theme="light"] .tab-button.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

[data-theme="light"] table {
    color: #374151;
}

[data-theme="light"] th {
    background-color: rgba(234, 88, 12, 0.1);
    color: var(--primary-color);
    border-bottom-color: rgba(234, 88, 12, 0.2);
}

[data-theme="light"] td {
    border-bottom-color: #e5e7eb;
}

[data-theme="light"] tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .modal-content {
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .close {
    color: #9ca3af;
}

[data-theme="light"] .close:hover {
    color: #374151;
}

[data-theme="light"] .form-group label {
    color: #4b5563;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #111827;
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

.container {
    max-width: 100%;
    padding: 0;
}

.page-content {
    padding: 10px 0;
}

/* Modal for User Managment */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1e1e1e;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid var(--glass-border);
    width: 50%;
    min-width: 400px;
    border-radius: 16px;
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

/* Form Styles inside Admin */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
}

input,
select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    background: #1a1f2e;
    border: 1px solid var(--glass-border);
    color: white;
    outline: none;
    font-family: inherit;
}

select option {
    background: #1a1f2e;
    color: white;
}

/* Profile Page Styles */
.profile-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

.settings-option-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.9rem;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

[data-theme="light"] .profile-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-option-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-option-btn:hover {
    border-color: var(--primary-color);
    background: #fdf2f8;
}

small {
    color: #777;
}

/* Return to Notes Link */
.nav-return {
    margin-bottom: 20px;
    display: inline-block;
}

/* Icon Picker */
.icon-option {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

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

.icon-option.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

/* Color Picker */
.color-option {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s, box-shadow 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    box-shadow: 0 0 0 2px var(--text-color);
    border-color: transparent;
}

/* Mobile Utilities */
.mobile-visible {
    display: none !important;
}

.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-visible {
        display: inline-block !important;
    }

    /* Layout Reset for Mobile */
    .app-container {
        position: relative;
        width: 100vw;
    }

    /* Mobile Header */
    .mobile-header {
        display: flex !important;
        /* Fixed positioning is inline in HTML but we can reinforce or just rely on flex display here */
    }

    .desktop-header {
        display: none !important;
    }

    .sidebar,
    .note-list-panel,
    .editor-panel {
        position: absolute;
        top: 60px !important;
        left: 0;
        width: 100%;
        height: calc(100% - 60px);
        z-index: 10;
        display: none;
        /* Hidden by default, controlled by body class */
        border-right: none;
        /* Full width, no borders needed */
        background-color: var(--bg-color);
        /* Ensure opacity to cover other layers */
    }

    /* Sidebar View */
    body.view-sidebar .sidebar {
        display: flex;
        z-index: 20;
        width: 100% !important;
        /* Ensure it overrides desktop width */
    }

    /* Note List View */
    body.view-notelist .note-list-panel {
        display: flex;
        z-index: 20;
        width: 100% !important;
        /* Force full width override */
    }

    /* Editor View */
    body.view-editor .editor-panel {
        display: flex;
        z-index: 20;
        width: 100% !important;
    }

    /* Adjust Modal Position for Mobile */
    #settingsModal {
        right: 10px !important;
        /* Keep it on screen */
        top: 60px !important;
        width: auto !important;
        max-width: 90vw;
    }

    /* Admin Mobile Tweaks */
    .main-interface-wrapper {
        padding: 10px;
    }

    .content-wrapper {
        padding: 15px;
    }

    .menu-tier-1,
    .menu-tier-2 {
        gap: 10px;
    }

    .tab-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Utilities */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}