/*
 * Codex Console - Apple Inspired Design System
 * Clean, Premium, Glassmorphism, SF Pro Typography
 * Support System Light/Dark Themes
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* System Colors - Light Mode (Apple Inspired) */
    --accent: #007AFF;
    --accent-hover: #0062CC;
    --accent-light: rgba(0, 122, 255, 0.1);
    
    --bg-system: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-solid: #FFFFFF;
    --glass: rgba(255, 255, 255, 0.7);
    
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --text-muted: #86868B;
    
    --border: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.05);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-full: 99px;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Myriad Set Pro", "SF Pro Icons", "Apple Legacy Chevron", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
    --font-mono: "SF Mono", "SFMono-Regular", ui-monospace, "Menlo", "Consolas", monospace;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-system: #000000;
    --bg-secondary: #1C1C1E;
    --surface: rgba(28, 28, 30, 0.7);
    --surface-solid: #1C1C1E;
    --glass: rgba(28, 28, 30, 0.7);
    
    --text-primary: #F5F5F7;
    --text-secondary: #86868B;
    --text-muted: #6E6E73;
    
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.4);
    --shadow: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-system);
    color: var(--text-primary);
    line-height: 1.47;
    letter-spacing: -0.022em;
    min-height: 100vh;
}

html,
body {
    width: 100%;
    max-width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

main,
.container,
.page-header,
.card,
.card-header,
.card-body,
.toolbar,
.toolbar-group,
.filter-group,
.header-actions,
.inline-actions,
.action-row,
.two-column-layout,
.left-panel,
.right-panel,
.settings-grid,
.settings-content,
.list-toolbar,
.cpa-header-actions,
.scan-trigger-bar,
.stats-grid,
.service-selection-grid,
.info-grid,
.form-row {
    min-width: 0;
}

/* Glassmorphism Header */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-nav {
    display: none;
    position: fixed;
    inset: 52px 0 auto 0;
    z-index: 999;
    padding: 12px 16px 20px;
    background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.mobile-nav.active {
    display: block;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-nav-link {
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-system);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
}

.mobile-nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
    border-color: rgba(0, 122, 255, 0.18);
}

.mobile-nav-link-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-brand h1 {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    font-size: 13px;
    color: var(--text-primary);
    opacity: 0.8;
    transition: var(--transition);
    font-weight: 400;
}

.nav-link:hover {
    opacity: 1;
}

.nav-link.active {
    font-weight: 600;
    opacity: 1;
}

/* Layout Parts */
.main-content {
    padding: 60px 0;
}

.site-footer {
    margin-top: 40px;
    padding: 24px 0 8px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

.page-header {
    margin-bottom: 40px;
}

.page-header h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 19px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Premium Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 24px 32px 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.card-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.card-body {
    padding: 12px 32px 32px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

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

input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-system);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--text-primary);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    accent-color: var(--accent);
}

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

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

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

.btn-secondary {
    background: var(--bg-system);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
}

.btn-ghost:hover {
    background: var(--accent-light);
}

.btn-danger {
    background: #FF3B30;
    color: #FFFFFF;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 17px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* Console Log */
.console-log {
    background: #1C1C1E;
    color: #FFFFFF;
    padding: 24px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
    height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.log-line { margin-bottom: 4px; border-radius: 4px; padding: 2px 8px; }
.log-line.info { color: #8E8E93; }
.log-line.success { color: #34C759; background: rgba(52, 199, 89, 0.1); }
.log-line.error { color: #FF3B30; background: rgba(255, 59, 48, 0.1); }
.log-line.warning { color: #FF9500; background: rgba(255, 149, 0, 0.1); }

/* Data Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

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

.data-table th {
    text-align: left;
    padding: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-system);
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover {
    background: var(--bg-system);
}

/* Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active, .status-badge.completed { background: #34C75922; color: #34C759; }
.status-badge.pending { background: #007AFF22; color: #007AFF; }
.status-badge.failed, .status-badge.error { background: #FF3B3022; color: #FF3B30; }

/* Grid Helpers */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-secondary);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: var(--transition);
}

.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Alert Modals (Confirmations) */
.modal-alert {
    max-width: 360px !important;
    text-align: center;
}

.modal-header {
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-alert .modal-header {
    justify-content: center;
    border-bottom: none;
    padding-bottom: 8px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close-btn {
    background: var(--bg-system);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Service Selection Grid (for Modals) */
.service-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.service-card {
    background: var(--bg-system);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.service-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--surface-hover);
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
}

.service-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.service-card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.service-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.service-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent);
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.service-card:hover .service-card-badge {
    opacity: 1;
    transform: scale(1);
}

/* Trigger styles for better UI instead of native select */
.select-trigger {
    background: var(--bg-system);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.select-trigger:hover {
    border-color: var(--border-hover);
    background: var(--bg-secondary);
}

.select-trigger-text {
    font-size: 14px;
    font-weight: 500;
}

.select-trigger-icon {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-alert .modal-body {
    padding: 8px 32px 32px;
}

.modal-alert p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

.modal-alert .modal-actions {
    justify-content: center;
    margin-top: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-item .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item .value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-box {
    background: var(--bg-system);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    position: relative;
    margin-top: 4px;
}

/* Custom Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    padding: 4px;
    background: var(--bg-system);
    border-radius: 9px;
    width: fit-content;
}

.tab-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 7px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    margin-left: 16px;
    opacity: 0.6;
}

.theme-toggle:hover { opacity: 1; }

/* Mobile */
@media (max-width: 768px) {
    :root {
        --radius-lg: 20px;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    html,
    body {
        overflow-x: hidden;
    }

    body {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .container {
        padding: 0 20px;
    }

    .container,
    .main-content,
    .page-header,
    .card,
    .card-body,
    .two-column-layout,
    .left-panel,
    .right-panel,
    .settings-grid,
    .settings-content {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    .navbar {
        height: 60px;
        padding: 0 16px;
        gap: 12px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    }

    .nav-brand {
        min-width: 0;
        flex: 1;
    }

    .nav-brand h1 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-links {
        display: none;
    }

    .nav-actions {
        gap: 6px;
    }

    .theme-toggle,
    .mobile-nav-toggle {
        width: 40px;
        height: 40px;
        margin-left: 0;
        border-radius: 12px;
        background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
        border: 1px solid var(--border-light);
        opacity: 1;
    }

    .mobile-nav-toggle[aria-expanded="true"] {
        background: var(--accent-light);
        color: var(--accent);
        border-color: rgba(0, 122, 255, 0.18);
    }

    .mobile-nav-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    .mobile-nav {
        inset: 68px 12px auto 12px;
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 12px;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
    }

    .mobile-nav-links {
        gap: 10px;
    }

    .mobile-nav-link {
        padding: 14px 16px;
        border-radius: 14px;
        font-size: 15px;
        box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
    }

    .main-content {
        padding: 30px 0 44px;
    }

    .site-footer {
        margin-top: 24px;
        padding: 20px 0 calc(8px + env(safe-area-inset-bottom, 0));
        font-size: 12px;
        line-height: 1.6;
    }

    .page-header {
        margin-top: 8px;
        margin-bottom: 24px;
    }

    .page-header h2 {
        font-size: 30px;
        line-height: 1.15;
        margin-bottom: 6px;
    }

    .subtitle {
        font-size: 15px;
        line-height: 1.5;
    }

    .card {
        border-radius: 16px;
        margin-bottom: 16px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
    }

    .card[style],
    .card-body[style],
    .page-header[style],
    .list-toolbar[style],
    .scan-trigger-bar[style],
    .action-bar[style] {
        max-width: 100% !important;
    }

    .card-header,
    .card-body,
    .modal-header,
    .modal-body {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .card-header {
        padding-top: 18px;
        padding-bottom: 12px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .card-header h3 {
        font-size: 18px;
    }

    .card-body {
        padding-top: 12px;
        padding-bottom: 16px;
    }

    input, select, textarea, .select-trigger, .msd-trigger {
        min-height: 44px;
        font-size: 16px;
    }

    textarea {
        min-height: 120px;
    }

    .btn,
    .tab-btn,
    .dropdown-item {
        min-height: 40px;
    }

    .btn-lg {
        min-height: 46px;
        padding: 12px 18px;
    }

    .form-row,
    .info-grid,
    .service-selection-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        padding: 4px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .stat-value {
        font-size: 24px;
        line-height: 1.1;
    }

    .stat-label {
        font-size: 12px;
        line-height: 1.4;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        border-radius: 16px;
    }

    .table-container::after {
        content: "左右滑动查看更多";
        position: sticky;
        left: 12px;
        display: inline-flex;
        margin: 10px 0 0 12px;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 11px;
        color: var(--text-secondary);
        background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
        border: 1px solid var(--border-light);
    }

    .data-table {
        min-width: 680px;
    }

    .data-table th,
    .data-table td {
        padding: 12px;
        white-space: nowrap;
    }

    .console-log {
        height: 360px;
        padding: 16px;
        font-size: 12px;
        border-radius: 0 0 16px 16px;
    }

    .modal {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        border-radius: 18px 18px 0 0;
        max-height: 88vh;
        overflow-y: auto;
    }

    .modal-actions,
    .form-actions {
        flex-direction: column;
    }

    .modal-actions .btn,
    .form-actions .btn {
        width: 100%;
    }

    .toast-container {
        top: 16px;
        left: 16px;
        right: 16px;
        transform: none;
    }

    .toast {
        min-width: 0;
        width: 100%;
        border-radius: 16px;
    }

    .toolbar,
    .toolbar-group,
    .filter-group,
    .header-actions,
    .split-header,
    .stack-on-mobile,
    .inline-actions,
    .batch-stats,
    .action-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .filter-group,
    .header-actions,
    .inline-actions,
    .action-row {
        gap: 10px !important;
    }

    .toolbar-group > *,
    .filter-group > *,
    .header-actions > *,
    .inline-actions > *,
    .action-row > * {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .selection-summary,
    .muted-meta {
        text-align: left !important;
    }

    .nav-brand,
    .page-header,
    .card-header h3,
    .stat-card,
    .task-status-item,
    .service-card,
    .info-item .value,
    .data-table td,
    .data-table th,
    .log-line,
    .subtitle,
    h1,
    h2,
    h3,
    p,
    span,
    strong,
    a,
    button,
    label,
    div {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .mobile-nav {
        inset: 66px 10px auto 10px;
    }
}

/* Dropdowns */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 180px;
    padding: 8px;
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu.active, .dropdown.active .dropdown-menu {
    display: block !important;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-system);
}

.dropdown-item.danger {
    color: #FF3B30;
}

.dropdown-item.danger:hover {
    background: #FF3B3011;
}

/* Multi-select Dropdown (used in Index) */
.msd-dropdown {
    position: relative;
    width: 100%;
}

.msd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-system);
    cursor: pointer;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 10px 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    min-width: 200px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.toast.success { border-left: 4px solid #34C759; }
.toast.error { border-left: 4px solid #FF3B30; }
.toast.warning { border-left: 4px solid #FF9500; }
.toast.info { border-left: 4px solid #007AFF; }

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    margin-left: auto;
    padding: 0 4px;
}

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

.msd-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 100;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

.msd-dropdown.open .msd-list {
    display: block;
}
/* Apple Style Switch */
.switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 44px;
}

.switch input {
    display: none;
}

.slider {
    background-color: #E9E9EA;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 2px;
    content: "";
    height: 20px;
    left: 2px;
    position: absolute;
    transition: .4s;
    width: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
    background-color: #34C759;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

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

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