/* === BASE STYLES === */

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent);
    opacity: 0.85;
}

/* === NAVIGATION === */
.navbar {
    padding: 0.5rem 0;
}

.navbar-brand {
    font-size: var(--text-base);
}

.nav-pills .nav-link {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.nav-pills .nav-link.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.nav-pills .nav-link i {
    margin-right: 0.35rem;
    font-size: 0.85em;
}

/* === DARK MODE TOGGLE === */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    background: var(--bg-hover);
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    background: var(--bg-active);
}

.toggle-icon {
    font-size: 14px;
    transition: all 0.3s ease;
}

/* Light mode: sun highlighted, moon muted */
.sun-icon { color: var(--accent); }
.moon-icon { color: var(--text-muted); }

.toggle-switch {
    width: 40px;
    height: 20px;
    background: var(--bg-active);
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider {
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Dark mode: moon highlighted, sun muted, slider slides right */
body.dark-mode .toggle-switch {
    background: var(--accent);
}

body.dark-mode .toggle-slider {
    left: 22px;
}

body.dark-mode .moon-icon { color: var(--accent); }
body.dark-mode .sun-icon { color: var(--text-muted); }

/* === BOOTSTRAP CLOSE BUTTON — auto dark/light === */
body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* === CARDS === */
.card-dark {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card-dark:hover {
    border-color: var(--border-default);
    box-shadow: 0 0 0 1px var(--accent-subtle);
}

.card-dark-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.card-dark-body {
    padding: var(--space-4);
}

/* === TABLES === */
.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-subtle);
    margin-bottom: 0;
}

.table-dark-custom thead th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-default);
    padding: 0.5rem 0.75rem;
}

.table-dark-custom tbody td {
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.table-dark-custom tbody tr:hover {
    background: var(--bg-hover);
}

.table-dark-custom tbody tr.row-active {
    background: var(--bg-elevated);
}

/* === FORMS === */
.form-control-dark {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.form-control-dark:focus {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.form-control-dark::placeholder {
    color: var(--text-muted);
}

.form-select-dark {
    background-color: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.form-select-dark:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* === BUTTONS === */
.btn-accent {
    background: var(--accent);
    color: #000;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-accent:hover {
    background: var(--accent);
    opacity: 0.9;
    color: #000;
    transform: translateY(-1px);
}

.btn-accent:active {
    transform: scale(0.97);
}

.btn-outline-dark {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
}

.btn-outline-dark:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* === BADGES === */
.badge {
    font-weight: 500;
    font-size: var(--text-xs);
    padding: 0.2em 0.6em;
    border-radius: var(--radius-sm);
}

.badge-accent {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 500;
    font-size: var(--text-xs);
    padding: 0.2em 0.6em;
    border-radius: var(--radius-sm);
}

/* === KEYBOARD SHORTCUTS MODAL === */
.shortcuts-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

body.dark-mode .shortcuts-modal {
    background: rgba(0,0,0,0.6);
}

.shortcuts-modal.active {
    display: flex;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.shortcut-item kbd {
    background: var(--bg-active);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    border: 1px solid var(--border-default);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-active);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* === ALERTS (Bootstrap override) === */
.alert {
    border-radius: var(--radius-md);
}

/* === DROPZONE === */
.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

/* === CALENDAR === */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-header {
    text-align: center;
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: 0.5rem;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 60px;
    padding: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    position: relative;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.calendar-day.has-posts {
    background: var(--bg-elevated);
}

.calendar-day .day-number {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.calendar-day.today .day-number {
    color: var(--accent);
    font-weight: 700;
}

.day-posts {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.post-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: var(--accent);
}

.more-posts {
    font-size: 0.6em;
    color: var(--text-muted);
}

/* === COMMAND PALETTE === */
.command-palette-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

body.dark-mode .command-palette-overlay {
    background: rgba(0,0,0,0.6);
}

.command-palette-overlay.active {
    display: flex;
}

.command-palette {
    width: 560px;
    max-width: 90vw;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), 0 25px 50px -12px rgba(0,0,0,0.25);
    overflow: hidden;
}

body.dark-mode .command-palette {
    box-shadow: var(--shadow-md), 0 25px 50px -12px rgba(0,0,0,0.5);
}

.command-palette-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: var(--space-4);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    outline: none;
    border-bottom: 1px solid var(--border-subtle);
}

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

.command-palette-results {
    max-height: 320px;
    overflow-y: auto;
    padding: var(--space-2);
}

.command-palette-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.command-palette-item:hover,
.command-palette-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.command-palette-item i {
    width: 20px;
    text-align: center;
    font-size: 0.85em;
}

.command-palette-item .item-label {
    flex: 1;
}

.command-palette-item .item-shortcut {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.command-palette-item .item-shortcut kbd {
    background: var(--bg-active);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid var(--border-subtle);
}

.command-palette-footer {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    color: var(--text-muted);
    display: flex;
    gap: var(--space-4);
}

.command-palette-footer kbd {
    background: var(--bg-active);
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
    border: 1px solid var(--border-subtle);
}

/* === SKELETON LOADING === */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-number {
    height: 32px;
    width: 80px;
    margin-bottom: 4px;
}

.skeleton-chart {
    height: 200px;
    width: 100%;
    border-radius: var(--radius-md);
}

.skeleton-row {
    height: 40px;
    width: 100%;
    margin-bottom: 4px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    max-width: 400px;
    margin: 0 auto var(--space-4);
}

/* === MICRO-INTERACTIONS === */
.btn:active {
    transform: scale(0.97);
}

.fade-in {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
