/* CSS Variables - Dark Mode System */
:root {
    /* Colors - Deep Slate OLED Theme */
    --bg-body: #020617;
    --bg-surface: #0f172a;
    --bg-surface-2: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #f97316;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;

    /* Spacing */
    --space-s: 0.5rem;
    --space-m: 1rem;
    --space-l: 1.5rem;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --glow: 0 0 15px rgba(59, 130, 246, 0.3);

    /* Typography */
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout - App Shell */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    padding: var(--space-m);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-m);
    padding-bottom: 5rem;
}

/* Navigation */
nav.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: var(--space-s);
    padding-bottom: max(var(--space-s), env(safe-area-inset-bottom));
}

nav.bottom-nav a {
    color: var(--text-muted);
    padding: var(--space-s);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

nav.bottom-nav a.active {
    color: var(--primary);
    text-shadow: var(--glow);
}

nav.bottom-nav svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

/* ============ DASHBOARD - RESPONSIVE COLUMNS ============ */
.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-m);
}

@media (min-width: 600px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
}

.dashboard-column {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-m);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface-2);
}

.column-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.column-header svg {
    width: 18px;
    height: 18px;
}

.column-content {
    padding: var(--space-s);
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: var(--space-l);
    opacity: 0.5;
}

/* Mini Cards for Dashboard */
.mini-card {
    background: var(--bg-surface-2);
    border-radius: 8px;
    padding: var(--space-s) var(--space-m);
    margin-bottom: var(--space-s);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.mini-card:hover {
    background: var(--border);
    transform: translateX(4px);
}

.mini-card-title {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Priority Badge */
.priority-badge {
    background: var(--accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Pin Button */
.pin-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-btn:hover {
    background: var(--bg-surface);
    color: var(--primary);
}

/* Active Pin (red when pinned) */
.pin-btn.pin-active {
    color: var(--accent);
}

.pin-btn.pin-active:hover {
    color: #ef4444;
}

/* Reorder Buttons (Up/Down) */
.reorder-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.reorder-btn:hover {
    background: var(--bg-surface);
    color: var(--primary);
    opacity: 1;
}

.mini-card:hover .reorder-btn {
    opacity: 1;
}

/* Pinned Card */
.mini-card.pinned {
    background: linear-gradient(135deg, var(--bg-surface-2), rgba(59, 130, 246, 0.1));
    border-top: 2px solid var(--primary);
}

/* Drag & Drop */
.mini-card.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.mini-card {
    cursor: grab;
}

.mini-card:active {
    cursor: grabbing;
}

/* Small Button */
.btn-sm {
    background: var(--primary);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

/* Color Swatches */
.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid var(--border);
}

.color-swatch:hover {
    transform: scale(1.2);
}

/* Components: Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: var(--space-m);
    margin-bottom: var(--space-m);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
    transform: scale(0.98);
}

/* Components: Inputs */
input,
textarea {
    width: 100%;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: var(--space-m);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Components: Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: var(--bg-surface-2);
    color: var(--text-main);
}

.btn:hover {
    background: var(--border);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* Icon Buttons */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-surface-2);
    color: var(--accent);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-accent {
    color: var(--accent);
}

.text-sm {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spin animation for loading icons */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ============ TOGGLE SWITCH ============ */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ef4444;
    /* Default Red (Inactive) */
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #22c55e;
    /* Green (Active) */
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ============ SMALL TEXT BUTTON ============ */
.btn-xs {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    background: var(--bg-surface-2);
    color: var(--text-main);
    border: 1px solid var(--border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-xs:hover {
    background: var(--border);
}

/* ============ ADMIN NOTIFICATION BAR ============ */
#admin-notification-bar {
    background: var(--accent);
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    z-index: 1001;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
}

#admin-notification-bar.visible {
    display: block;
}

/* Mobile Scrolling (Marquee) */
@media (max-width: 768px) {
    #admin-notification-bar.scrolling {
        white-space: nowrap;
        overflow: hidden;
        display: block;
        padding: 0.5rem 0;
    }

    #admin-notification-bar.scrolling span {
        display: inline-block;
        padding-left: 100%;
        /* Start from right */
        animation: marquee 15s linear infinite;
        /* Make sure it's visible */
        min-width: 100%;
    }

    /* Pause on touch/click to read */
    #admin-notification-bar.scrolling span:active,
    #admin-notification-bar.scrolling span:hover {
        animation-play-state: paused;
    }
}

@keyframes marquee {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-100%, 0);
    }
}