/* Dark Mode Theme Styles */

/* Dark theme variables */
.theme-dark {
    --md-sys-color-primary: #90caf9;
    --md-sys-color-on-primary: #003258;
    --md-sys-color-primary-container: #004a77;
    --md-sys-color-secondary: #ffb74d;
    --md-sys-color-surface: #1c1b1f;
    --md-sys-color-surface-variant: #2d2d30;
    --md-sys-color-background: #121212;
    --md-sys-color-error: #f2b8b5;
    --md-sys-color-outline: #938f99;
    --md-sys-color-inverse-surface: #e6e1e5;
    --md-sys-color-inverse-on-surface: #1c1b1f;
    --md-sys-color-on-background: #e6e1e5;

    /* Elevation adjustments for dark mode */
    --md-sys-elevation-level1: 0 2px 4px rgba(0,0,0,0.3);
    --md-sys-elevation-level2: 0 4px 8px rgba(0,0,0,0.4);
    --md-sys-elevation-level3: 0 8px 16px rgba(0,0,0,0.5);
}

/* Dark mode specific styles */
.theme-dark body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
}

.theme-dark .navbar {
    background-color: #0d0d0d;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.theme-dark .md-card {
    background-color: var(--md-sys-color-surface);
    border-color: var(--md-sys-color-outline);
}

.theme-dark .md-list-item {
    border-bottom-color: var(--md-sys-color-surface-variant);
}

.theme-dark .md-list-item--interactive:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.theme-dark .folder-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .message-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-dark .md-chip {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-background);
}

.theme-dark .btn-outline-secondary {
    color: var(--md-sys-color-on-background);
    border-color: var(--md-sys-color-outline);
}

.theme-dark .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .table {
    color: var(--md-sys-color-on-background);
    border-color: var(--md-sys-color-outline);
}

.theme-dark .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-dark .modal-content {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-background);
}

.theme-dark .form-control,
.theme-dark .form-select {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-background);
    border-color: var(--md-sys-color-outline);
}

.theme-dark .form-control:focus,
.theme-dark .form-select:focus {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-background);
    border-color: var(--md-sys-color-primary);
}

/* Theme toggle button */
.theme-toggle-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    box-shadow: var(--md-sys-elevation-level3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Theme customization panel */
.theme-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background-color: var(--md-sys-color-surface);
    box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.theme-panel.open {
    right: 0;
}

.theme-panel-header {
    padding: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.close-panel {
    background: none;
    border: none;
    color: var(--md-sys-color-on-background);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.close-panel:hover {
    background-color: rgba(0,0,0,0.1);
}

.theme-panel-content {
    padding: 24px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: none;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--md-sys-color-primary);
    transform: translateY(-2px);
}

.preset-btn.active {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
}

.preset-preview {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.preset-light {
    background: linear-gradient(135deg, #ffffff 50%, #1976d2 50%);
}

.preset-dark {
    background: linear-gradient(135deg, #121212 50%, #90caf9 50%);
}

.preset-auto {
    background: linear-gradient(135deg, #ffffff 25%, #121212 25% 50%, #ffffff 50% 75%, #121212 75%);
}

.preset-high-contrast {
    background: linear-gradient(135deg, #ffffff 50%, #000000 50%);
}

.preset-sepia {
    background: linear-gradient(135deg, #faf0e6 50%, #8b4513 50%);
}

.preset-blue-light {
    background: linear-gradient(135deg, #000000 50%, #ff9800 50%);
}

.color-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-input-group label {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.color-input-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 8px;
    cursor: pointer;
}

.apply-custom-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.apply-custom-btn:hover {
    background-color: var(--md-sys-color-primary-container);
}

.theme-options {
    margin-top: 24px;
}

.option-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.option-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Accessibility options */
.reduce-motion * {
    animation: none !important;
    transition: none !important;
}

.high-contrast {
    filter: contrast(1.5);
}

.large-text {
    font-size: 120%;
}

.large-text .md-headline-small {
    font-size: 32px;
}

.large-text .md-title-medium {
    font-size: 20px;
}

.large-text .md-body-medium {
    font-size: 18px;
}

/* Theme notification */
.theme-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--md-sys-elevation-level3);
    transition: transform 0.3s ease;
    z-index: 10000;
}

.theme-notification.show {
    transform: translateX(-50%) translateY(0);
}

/* Mobile responsiveness for theme toggle */
@media (max-width: 768px) {
    .theme-panel {
        width: 100%;
        right: -100%;
    }

    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .color-inputs {
        grid-template-columns: 1fr;
    }
}
