:root {
    /* Light Mode Variables */
    --bg-color: #f4f6f9;
    --surface-color: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --danger-color: #ef476f;
    --success-color: #06d6a0;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body.dark-theme {
    /* Dark Mode Variables - 70% opacity colors with white text */
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --primary-color: rgba(67, 97, 238, 0.7);
    --primary-hover: rgba(67, 97, 238, 0.9);
    --danger-color: rgba(239, 71, 111, 0.7);
    --success-color: rgba(6, 214, 160, 0.7);
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-theme .logo-light { display: none !important; }
body.dark-theme .logo-dark { display: inline-block !important; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition), color var(--transition);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* App-like Margins and Layout */
.app-container {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 250px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 0 20px 20px;
    font-size: 1.5rem;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Modern Sidebar Styles */
.sidebar-menu-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link i {
    font-size: 1.2rem;
}

.nav-link:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.nav-link.active {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
}

/* Submenu Styles */
.sidebar-item {
    display: flex;
    flex-direction: column;
}

.sidebar-item.has-submenu .toggle-icon {
    transition: transform 0.3s;
    font-size: 0.9rem;
}

.sidebar-item.has-submenu.open .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    margin-left: 22px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    margin-top: 4px;
    margin-bottom: 4px;
}

.sidebar-submenu .submenu-link {
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.sidebar-submenu .submenu-link:hover {
    color: var(--text-color);
    background-color: rgba(0,0,0,0.02);
}

.sidebar-submenu .submenu-link.active {
    color: var(--text-color);
    background-color: var(--bg-color);
    font-weight: 600;
}

body.dark-theme .sidebar-submenu .submenu-link:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Badges */
.sidebar-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-green {
    background-color: #d1fae5;
    color: #059669;
}

.badge-orange {
    background-color: #ffedd5;
    color: #ea580c;
}

body.dark-theme .badge-green {
    background-color: rgba(5, 150, 105, 0.2);
    color: #34d399;
}

body.dark-theme .badge-orange {
    background-color: rgba(234, 88, 12, 0.2);
    color: #fb923c;
}

/* Upload Box inside Sidebar */
.sidebar-upload-box {
    margin-top: 20px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    background-color: var(--surface-color);
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-upload-box:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
}

.upload-icon-wrapper {
    margin-bottom: 12px;
}

.btn-upload-plus {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
    cursor: pointer;
}

.sidebar-upload-box h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
}

.sidebar-upload-box p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Theme Toggle Pill (Sidebar Bottom) */
.sidebar-theme-switch {
    display: flex;
    background-color: var(--bg-color);
    border-radius: 50px;
    padding: 4px;
    margin-top: 24px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    border: none;
    background: transparent;
    border-radius: 50px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn.active {
    background-color: var(--surface-color);
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

body.dark-theme .sidebar-theme-switch {
    background-color: #121212;
}

body.dark-theme .theme-btn.active {
    background-color: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: 60px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--primary-color);
}

.mobile-logo {
    font-weight: bold;
    font-size: 1.2rem;
    display: none;
}

.mobile-only {
    display: none;
}

/* Theme Switcher */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

body.dark-theme .slider {
    background-color: #333;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    z-index: 2;
}

body.dark-theme .slider:before {
    transform: translateX(30px);
    background-color: #1a1a1a;
}

.slider.round {
    border-radius: 30px;
}

.slider.round:before {
    border-radius: 50%;
}

.sun-icon {
    color: #f39c12;
    font-size: 1.1rem;
    z-index: 1;
}

.moon-icon {
    color: #f1c40f;
    font-size: 1.1rem;
    z-index: 1;
}

/* Profile Menu */
.profile-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 35px;
    height: 35px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.logout-btn {
    color: var(--danger-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    opacity: 0.8;
}

.content-wrapper {
    flex: 1;
    padding: 20px 20px 100px 20px;
    overflow-y: auto;
}

/* App Box / Cards */
.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    animation: fadeUp 0.4s ease forwards;
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 15px;
}

/* Forms & Inputs Modern App Style */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-control, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.95rem;
    transition: var(--transition);
    appearance: none; /* Modern select look */
}

.form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--surface-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
}

/* Checkboxes and Switches */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-switch .form-check-input {
    width: 40px;
    height: 20px;
    appearance: none;
    background-color: var(--border-color);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.form-switch .form-check-input:checked {
    background-color: var(--primary-color);
}

.form-switch .form-check-input::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.form-switch .form-check-input:checked::before {
    transform: translateX(20px);
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

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

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface-color, #fff);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    border: none;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 32px 32px 16px 32px;
    background-color: transparent;
    margin: 0;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: none;
}

.modal-header h3, .modal-header h2, .modal-header h4 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
}

.modal-header .close-modal {
    background: transparent !important;
    border: none !important;
    font-size: 1.5rem !important;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-top: -4px;
}

.modal-header .close-modal:hover { color: var(--text-color); }

.modal-body {
    padding: 16px 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 24px 32px 32px 32px;
    border-top: none;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: transparent;
}

/* Responsive Tables to Cards */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #64748b;
}

body.dark-theme th {
    background-color: #262626;
    color: #9ca3af;
}

.table-btn-danger {
    background-color: #f43f5e;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.table-badge-dark {
    background-color: #111827;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

body.dark-theme .table-badge-dark {
    background-color: #374151;
}

@media (max-width: 768px) {
    .table-responsive table, 
    .table-responsive thead, 
    .table-responsive tbody, 
    .table-responsive th, 
    .table-responsive td, 
    .table-responsive tr { 
        display: block; 
    }
    
    .table-responsive thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive tr { 
        background-color: var(--surface-color);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: var(--shadow);
    }
    
    .table-responsive td { 
        border: none;
        border-bottom: 1px solid var(--border-color); 
        position: relative;
        padding-left: 50%; 
        min-height: 40px;
        display: flex;
        align-items: center;
    }
    
    .table-responsive td:before { 
        position: absolute;
        top: 50%;
        left: 15px;
        transform: translateY(-50%);
        width: 45%; 
        padding-right: 10px; 
        white-space: nowrap;
        content: attr(data-label);
        font-weight: bold;
        color: var(--text-muted);
    }
    
    .table-responsive td:last-child {
        border-bottom: 0;
    }

    .sidebar {
        position: absolute;
        left: -250px;
        z-index: 100;
        height: 100%;
        box-shadow: var(--shadow);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-header {
        display: block;
    }

    .mobile-only {
        display: flex;
    }
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utilities */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 24px; }
.pb-2 { padding-bottom: 10px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.border-bottom { border-bottom: 1px solid var(--border-color); }

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.row.g-2 {
    margin-left: -5px;
    margin-right: -5px;
}

.row > [class^="col-"] {
    padding-left: 10px;
    padding-right: 10px;
    width: 100%;
}

.row.g-2 > [class^="col-"] {
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 10px;
}

/* col-6 is always 50% width */
.col-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}

@media (min-width: 768px) {
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
}

/* Tabs System */
.nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.nav-tabs .nav-link {
    margin-bottom: -1px;
    background: 0 0;
    border: 1px solid transparent;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 12px 20px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-color: transparent transparent var(--border-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: var(--bg-color);
    border-color: var(--primary-color);
    border-bottom-width: 2px;
}

.tab-content > .tab-pane {
    display: none;
}

.tab-content > .active {
    display: block;
    animation: fadeUp 0.3s ease;
}

/* Module Header Card */
.page-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-header-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.page-header-info h2 {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.page-header-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-header-actions {
    display: flex;
    gap: 12px;
}

/* Toast Notifications (App-like) */
#toast-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Positions */
.toast-pos-top-right { top: 24px; right: 24px; }
.toast-pos-top-left { top: 24px; left: 24px; }
.toast-pos-bottom-right { bottom: 24px; right: 24px; }
.toast-pos-bottom-left { bottom: 24px; left: 24px; }
.toast-pos-top-center { top: 24px; left: 50%; transform: translateX(-50%); }
.toast-pos-bottom-center { bottom: 24px; left: 50%; transform: translateX(-50%); }

/* Base Toast Animation depending on position */
.app-toast {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-pos-top-right .app-toast, .toast-pos-bottom-right .app-toast { transform: translateX(120%); }
.toast-pos-top-left .app-toast, .toast-pos-bottom-left .app-toast { transform: translateX(-120%); }
.toast-pos-top-center .app-toast { transform: translateY(-120%); }
.toast-pos-bottom-center .app-toast { transform: translateY(120%); }

.app-toast.show {
    opacity: 1;
    transform: translate(0) !important;
}

/* ============================ */
/* STYLES (7 Options)           */
/* ============================ */

/* 1. Card (Default) */
.toast-style-card {
    background: var(--surface-color, #fff);
    color: var(--text-color, #333);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}
.toast-style-card.toast-success { border-left: 4px solid var(--success-color, #06d6a0); }
.toast-style-card.toast-error { border-left: 4px solid var(--danger-color, #ef476f); }

/* 2. Minimalist */
.toast-style-minimal {
    background: transparent;
    color: var(--text-color, #333);
    border: none;
    border-bottom: 3px solid var(--border-color);
    border-radius: 0;
    padding-left: 0;
}
.toast-style-minimal.toast-success { border-bottom-color: var(--success-color, #06d6a0); }
.toast-style-minimal.toast-error { border-bottom-color: var(--danger-color, #ef476f); }

/* 3. Dark Shadow */
.toast-style-dark {
    background: #1e1e1e;
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid #333;
}
.toast-style-dark .toast-close { color: #aaa; }
.toast-style-dark .toast-close:hover { color: #fff; }

/* 4. Pastel */
.toast-style-pastel.toast-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; border-radius: 10px; }
.toast-style-pastel.toast-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; border-radius: 10px; }
.toast-style-pastel .toast-icon { color: inherit !important; }

/* 5. Full Border */
.toast-style-border {
    background: var(--surface-color, #fff);
    color: var(--text-color, #333);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.toast-style-border.toast-success { border: 2px solid var(--success-color, #06d6a0); }
.toast-style-border.toast-error { border: 2px solid var(--danger-color, #ef476f); }

/* 6. Neon */
.toast-style-neon {
    background: #000;
    color: #fff;
    border-radius: 12px;
}
.toast-style-neon.toast-success { border: 1px solid var(--success-color, #06d6a0); box-shadow: 0 0 15px var(--success-color, #06d6a0); }
.toast-style-neon.toast-error { border: 1px solid var(--danger-color, #ef476f); box-shadow: 0 0 15px var(--danger-color, #ef476f); }

/* 7. Flat */
.toast-style-flat {
    background: var(--text-color, #333);
    color: var(--bg-color, #fff);
    border-radius: 0;
    border: none;
    box-shadow: none;
}
.toast-style-flat .toast-close { color: #aaa; }

/* Base Elements Styling */
.app-toast .toast-icon {
    font-size: 1.5rem;
    margin-right: 12px;
    display: flex;
}
.toast-success:not(.toast-style-pastel):not(.toast-style-neon) .toast-icon { color: var(--success-color, #06d6a0); }
.toast-error:not(.toast-style-pastel):not(.toast-style-neon) .toast-icon { color: var(--danger-color, #ef476f); }
.toast-style-neon.toast-success .toast-icon { color: var(--success-color, #06d6a0); text-shadow: 0 0 8px var(--success-color, #06d6a0); }
.toast-style-neon.toast-error .toast-icon { color: var(--danger-color, #ef476f); text-shadow: 0 0 8px var(--danger-color, #ef476f); }

.app-toast .toast-message {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.app-toast .toast-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 12px;
}
.toast-style-card .toast-close,
.toast-style-border .toast-close,
.toast-style-minimal .toast-close { color: var(--text-muted); }
.toast-style-card .toast-close:hover,
.toast-style-border .toast-close:hover,
.toast-style-minimal .toast-close:hover { color: var(--text-color); }

/* ========================================= */
/* MODERN FORM CONTROLS & UI COMPONENTS      */
/* ========================================= */

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-label:has(+ input[required])::after,
.form-label:has(+ select[required])::after,
.form-label:has(+ .file-drop-area input[required])::after {
    content: " *";
    color: var(--danger-color, #ef476f);
}

.form-control, .form-select {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s;
    color: var(--text-color);
    box-shadow: none;
}

.form-control:focus, .form-select:focus {
    background-color: var(--surface-color, #fff);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

input[type="color"] {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2px;
    height: 40px;
    cursor: pointer;
    background-color: transparent;
}
body.dark-theme input[type="color"] {
    border-color: #404040;
}

body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #2a2a2a;
    border: 1px solid #404040;
    color: #ffffff;
}

body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background-color: #333333;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
}

/* Modern Buttons */
.btn {
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #111827; /* Solid dark */
    color: #fff;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background-color: #000;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    color: var(--text-color);
}

body.dark-theme .btn-primary {
    background-color: var(--primary-color);
}
body.dark-theme .btn-primary:hover {
    filter: brightness(1.1);
}

body.dark-theme .btn-secondary {
    border-color: #404040;
    color: #e2e8f0;
}
body.dark-theme .btn-secondary:hover {
    background-color: #2a2a2a;
}

/* Tag Pills */
.tag-pill {
    display: inline-flex;
    align-items: center;
    background-color: var(--surface-color, #fff);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    margin-right: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tag-pill i {
    margin-left: 8px;
    cursor: pointer;
    color: var(--text-muted);
}

.tag-pill i:hover {
    color: var(--danger-color, #ef476f);
}

body.dark-theme .tag-pill {
    background-color: #2a2a2a;
    border-color: #404040;
}

/* File Drop Area */
.file-drop-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    overflow: hidden;
}

.file-drop-area:hover, .file-drop-area.is-active {
    background-color: #f1f5f9;
    border-color: var(--primary-color);
}

.file-drop-area.has-image {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--surface-color);
}
.file-drop-area .file-drop-content {
    transition: opacity 0.3s;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-delete-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s;
}
.btn-delete-image:hover {
    transform: scale(1.1);
}

.file-drop-area i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.file-drop-area .file-msg {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.file-drop-area .file-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.file-drop-area input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

body.dark-theme .file-drop-area {
    background-color: #2a2a2a;
    border-color: #404040;
}
body.dark-theme .file-drop-area:hover, body.dark-theme .file-drop-area.is-active {
    background-color: #333333;
    border-color: var(--primary-color);
}

/* ========================================= */
/* RESPONSIVE OPTIMIZATIONS                  */
/* ========================================= */

@media (max-width: 768px) {
    /* Fix page header layout */
    .page-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .page-header-actions {
        width: 100%;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    
    /* Fix internal headers wrapping */
    .settings-section .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }
    
    /* Global Mobile FAB (Floating Action Button) for primary actions */
    .page-header-actions .btn-primary {
        position: fixed !important;
        bottom: 24px;
        right: 24px;
        z-index: 90;
        border-radius: 50px !important;
        padding: 16px 24px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
        font-size: 1.1rem !important;
        display: flex;
        align-items: center;
        gap: 8px;
        width: auto;
    }
    
    /* Prevent FAB from overlapping content (removido por feedback) */
    .app-container {
        padding-bottom: 0px;
    }
}
