/* ============================================================
   CyFrame – Premium Slideshow PWA
   Dark theme with glassmorphism and smooth transitions
   ============================================================ */

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

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --bg-primary: #0a0a0a;
    --bg-surface: rgba(255, 255, 255, 0.04);
    --bg-glass: rgba(18, 18, 22, 0.85);
    --bg-glass-hover: rgba(30, 30, 36, 0.9);
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-input-focus: rgba(255, 255, 255, 0.1);

    --accent: #c9a96e;
    --accent-hover: #dbb978;
    --accent-glow: rgba(201, 169, 110, 0.3);
    --accent-dim: rgba(201, 169, 110, 0.15);

    --text-primary: #e8e8e8;
    --text-secondary: #888;
    --text-muted: #555;

    --success: #4caf50;
    --error: #ef5350;
    --warning: #ff9800;

    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(201, 169, 110, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --panel-width: 440px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* ============================================================
   Login Screen
   ============================================================ */
#login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
    opacity: 1;
    transition: opacity var(--transition-slow);
}

#login-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(201, 169, 110, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 169, 110, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(100, 80, 50, 0.05) 0%, transparent 50%);
    animation: loginBgPulse 8s ease-in-out infinite alternate;
}

@keyframes loginBgPulse {
    0%   { opacity: 0.7; }
    100% { opacity: 1; }
}

.login-card {
    position: relative;
    width: 380px;
    max-width: 90vw;
    padding: 48px 36px 40px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(201, 169, 110, 0.05);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #a08040);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.login-logo-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.input-group input:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--accent), #a08040);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.02em;
}

.login-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    display: none;
    padding: 10px 14px;
    background: rgba(239, 83, 80, 0.1);
    border: 1px solid rgba(239, 83, 80, 0.25);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 13px;
    text-align: center;
}

.login-error.visible {
    display: block;
}

/* ============================================================
   Slideshow Container
   ============================================================ */
#slideshow-container {
    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
    cursor: none;
}

#slideshow-container.show-cursor {
    cursor: default;
}

.slide-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    will-change: transform, opacity;
}

.slide-layer.active {
    z-index: 2;
}

.slide-layer.next {
    z-index: 1;
}

.slide-layer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Transition: Fade */
.slide-layer.tr-fade {
    transition: opacity var(--tr-duration, 1.2s) ease-in-out;
}
.slide-layer.tr-fade.visible {
    opacity: 1;
}

/* Transition: Slide */
.slide-layer.tr-slide {
    transition: transform var(--tr-duration, 1.2s) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--tr-duration, 1.2s) ease;
}
.slide-layer.tr-slide.enter-from {
    transform: translateX(100%);
    opacity: 0;
}
.slide-layer.tr-slide.visible {
    transform: translateX(0);
    opacity: 1;
}
.slide-layer.tr-slide.exit-to {
    transform: translateX(-100%);
    opacity: 0;
}

/* Transition: Zoom */
.slide-layer.tr-zoom {
    transition: transform var(--tr-duration, 1.2s) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--tr-duration, 1.2s) ease;
}
.slide-layer.tr-zoom.enter-from {
    transform: scale(1.3);
    opacity: 0;
}
.slide-layer.tr-zoom.visible {
    transform: scale(1);
    opacity: 1;
}
.slide-layer.tr-zoom.exit-to {
    transform: scale(0.7);
    opacity: 0;
}

/* Transition: Flip */
.slide-layer.tr-flip {
    transition: transform var(--tr-duration, 1.2s) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--tr-duration, 1.2s) ease;
    backface-visibility: hidden;
}
.slide-layer.tr-flip.enter-from {
    transform: perspective(1200px) rotateY(90deg);
    opacity: 0;
}
.slide-layer.tr-flip.visible {
    transform: perspective(1200px) rotateY(0deg);
    opacity: 1;
}
.slide-layer.tr-flip.exit-to {
    transform: perspective(1200px) rotateY(-90deg);
    opacity: 0;
}

/* Transition: Dissolve */
.slide-layer.tr-dissolve {
    transition: opacity var(--tr-duration, 1.2s) steps(20);
}
.slide-layer.tr-dissolve.visible {
    opacity: 1;
}

/* Transition: Ken Burns */
.slide-layer.tr-kenburns {
    transition: opacity var(--tr-duration, 1.2s) ease-in-out;
}
.slide-layer.tr-kenburns.visible {
    opacity: 1;
}
.slide-layer.tr-kenburns img {
    animation: kenburns var(--display-duration, 8s) ease-in-out forwards;
}

@keyframes kenburns {
    0%   { transform: scale(1.0) translate(0%, 0%); }
    100% { transform: scale(1.15) translate(var(--kb-x, -2%), var(--kb-y, -1%)); }
}

/* ============================================================
   Controls Overlay
   ============================================================ */
#controls-overlay {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 20px;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

#controls-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: 8px;
}

.control-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-light);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.control-btn.admin-only {
    display: none;
}

.control-btn.admin-only.show {
    display: inline-flex;
}

/* ============================================================
   Image Counter
   ============================================================ */
#image-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: 6px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

#image-counter.visible {
    opacity: 1;
}

/* ============================================================
   Clock Display
   ============================================================ */
#clock-display {
    position: fixed;
    z-index: 10;
    padding: 8px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 18px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
    min-width: 148px;
    text-align: center;
    display: none;
}

#clock-display.visible {
    opacity: 1;
}

#clock-display.enabled {
    display: block;
}

/* Clock position variants */
#clock-display.pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

#clock-display.pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

#clock-display.pos-top-left {
    top: 20px;
    left: 20px;
}

/* ============================================================
   Pause Indicator
   ============================================================ */
#pause-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 40px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#pause-indicator.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

#pause-indicator svg {
    color: var(--accent);
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

#pause-indicator span {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ============================================================
   Settings Panel
   ============================================================ */
#settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

#settings-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--panel-width);
    max-width: 100vw;
    background: var(--bg-glass);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 101;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

#settings-panel.open {
    transform: translateX(0);
}

#settings-panel::-webkit-scrollbar {
    width: 4px;
}

#settings-panel::-webkit-scrollbar-track {
    background: transparent;
}

#settings-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 5;
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.settings-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-close:hover {
    background: var(--bg-input-focus);
    color: var(--text-primary);
}

.settings-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.settings-body {
    padding: 0 24px 24px;
}

/* Settings Section */
.settings-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

/* Select / Dropdown */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

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

.setting-value {
    font-size: 12px;
    color: var(--text-secondary);
}

.setting-select {
    padding: 8px 32px 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    transition: all var(--transition-fast);
}

.setting-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.setting-select option {
    background: #1a1a1e;
    color: var(--text-primary);
}

/* Range Slider */
.range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: all var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--accent-glow);
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
}

.range-value {
    min-width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* Color Picker */
.color-picker {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    transition: border-color var(--transition-fast);
}

.color-picker:hover {
    border-color: var(--border-light);
}

.color-picker:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    outline: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.toggle-option {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    font-family: var(--font-family);
}

.toggle-option.active {
    background: var(--accent);
    color: #fff;
}

.toggle-option:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-input-focus);
}

/* Folder Cards */
.folder-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.folder-card {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.folder-card:hover {
    border-color: var(--border-light);
    background: var(--bg-input);
}

.folder-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 6px;
    margin-right: 12px;
    flex-shrink: 0;
}

.folder-icon svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.folder-badges {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.folder-badge {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
}

.folder-badge:hover {
    border-color: var(--border-light);
    color: var(--text-secondary);
}

.folder-badge.active {
    background: var(--accent-dim);
    border-color: var(--border-accent);
    color: var(--accent);
}

.folder-badge.landscape-badge.active {
    background: rgba(66, 165, 245, 0.15);
    border-color: rgba(66, 165, 245, 0.3);
    color: #42a5f5;
}

.folder-badge.portrait-badge.active {
    background: rgba(171, 71, 188, 0.15);
    border-color: rgba(171, 71, 188, 0.3);
    color: #ab47bc;
}

/* ============================================================
   User Management Section
   ============================================================ */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 10px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-avatar.admin {
    background: var(--accent-dim);
    color: var(--accent);
}

.user-avatar.user {
    background: rgba(66, 165, 245, 0.15);
    color: #42a5f5;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.user-actions {
    display: flex;
    gap: 4px;
}

.user-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.user-action-btn:hover {
    border-color: var(--border-light);
    color: var(--text-secondary);
    background: var(--bg-input);
}

.user-action-btn.danger:hover {
    border-color: rgba(239, 83, 80, 0.3);
    color: var(--error);
    background: rgba(239, 83, 80, 0.1);
}

.user-action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Add User Form */
.add-user-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.add-user-form input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
}

.add-user-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.add-user-form input::placeholder {
    color: var(--text-muted);
}

.add-user-btn {
    padding: 9px;
    background: linear-gradient(135deg, var(--accent), #a08040);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-user-btn:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.add-user-btn:active {
    transform: translateY(0);
}

/* ============================================================
   Offline Cache Section
   ============================================================ */
.cache-status-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}

.cache-status-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cache-status-info svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
    flex-shrink: 0;
}

.cache-status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.cache-progress-track {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.cache-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #dbb978);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.cache-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cache-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
}

.cache-action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.cache-action-btn.download {
    background: var(--accent-dim);
    border-color: var(--border-accent);
    color: var(--accent);
}

.cache-action-btn.download:hover {
    background: rgba(201, 169, 110, 0.25);
    box-shadow: 0 0 12px var(--accent-glow);
}

.cache-action-btn.clear {
    background: transparent;
    color: var(--text-secondary);
}

.cache-action-btn.clear:hover {
    border-color: rgba(239, 83, 80, 0.3);
    color: var(--error);
    background: rgba(239, 83, 80, 0.05);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease forwards;
    pointer-events: auto;
    max-width: 320px;
}

.toast.success {
    border-color: rgba(76, 175, 80, 0.3);
}

.toast.error {
    border-color: rgba(239, 83, 80, 0.3);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* ============================================================
   Modal / Dialog
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    padding: 28px;
    max-width: 360px;
    width: 90vw;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.modal-body input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.modal-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 9px 18px;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
}

.modal-btn.cancel {
    background: transparent;
    color: var(--text-secondary);
}

.modal-btn.cancel:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-btn.confirm {
    background: linear-gradient(135deg, var(--accent), #a08040);
    border-color: transparent;
    color: #fff;
}

.modal-btn.confirm:hover {
    box-shadow: var(--shadow-glow);
}

.modal-btn.danger {
    background: var(--error);
    border-color: transparent;
    color: #fff;
}

.modal-btn.danger:hover {
    background: #e53935;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 50;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
    :root {
        --panel-width: 100vw;
    }

    .login-card {
        padding: 36px 24px 32px;
    }

    .settings-body {
        padding: 0 16px 16px;
    }

    .settings-header {
        padding: 16px;
    }

    .folder-badges {
        flex-direction: column;
        gap: 3px;
    }

    .range-slider {
        width: 100px;
    }
}

/* ============================================================
   Accessibility: Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Logout Section
   ============================================================ */
.settings-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logout-btn:hover {
    border-color: rgba(239, 83, 80, 0.3);
    color: var(--error);
    background: rgba(239, 83, 80, 0.05);
}

.logout-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}
