/* ==========================================================================
   Tavla — app.css
   Dark-first design system per PDR. Bootstrap 5 overrides + custom components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONTS
   -------------------------------------------------------------------------- */

/* Clash Display — variable font for headlines */
@font-face {
    font-family: 'Clash Display';
    src: url('/assets/fonts/ClashDisplay-Variable.woff2') format('woff2');
    font-weight: 200 700;
    font-display: swap;
}

/* Inter — Google Fonts embed for body */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   2. CSS CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */

:root {
    /* Backgrounds */
    --bg-primary: #0A0A0A;
    --bg-secondary: #121212;
    --bg-card-dark: #1A1A1A;
    --bg-card-dark-hover: #222222;
    --bg-surface-light: #F5F0EB;
    --bg-white: #FFFFFF;

    /* Accent Colors */
    --accent-coral: #E85D3A;
    --accent-coral-hover: #D14E2E;
    --accent-coral-light: rgba(232, 93, 58, 0.1);
    --accent-neon: #C8FF00;
    --accent-lavender: #9B8FFF;

    /* Text */
    --text-white: #FFFFFF;
    --text-muted-light: #B3B3B3;
    --text-muted: #888888;
    --text-dark: #0A0A0A;
    --text-muted-dark: #666666;

    /* Semantic */
    --color-success: #34C759;
    --color-warning: #FFB800;
    --color-error: #FF3B30;
    --color-info: #5AC8FA;

    /* Borders */
    --border-dark: #333333;
    --border-dark-hover: #555555;
    --border-light: #E5E5E5;

    /* Typography */
    --font-display: 'Clash Display', 'Space Grotesk', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --section-gap-lg: 140px;
    --section-gap-md: 100px;
    --section-gap-sm: 64px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
}

/* --------------------------------------------------------------------------
   3. RESET / BASE
   -------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-white);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent-coral);
    color: white;
}

a {
    color: var(--accent-coral);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */

h1, h2, h3, .h1, .h2, .h3 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-white);
}

h1, .h1 { font-size: 64px; font-weight: 600; }
h2, .h2 { font-size: 40px; font-weight: 500; }
h3, .h3 { font-size: 24px; font-weight: 500; }
h4, .h4 { font-size: 20px; font-family: var(--font-body); font-weight: 600; }
h5, .h5 { font-size: 17px; font-family: var(--font-body); font-weight: 600; }

.display-xl {
    font-family: var(--font-display);
    font-size: 80px;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.lead {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-muted-light);
    line-height: 1.6;
}

.overline {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted-light);
}

.text-muted { color: var(--text-muted-light) !important; }
.text-coral { color: var(--accent-coral) !important; }
.text-neon { color: var(--accent-neon) !important; }

/* Number display — for "01, 02, 03" sections */
.number-display {
    font-family: var(--font-display);
    font-size: 96px;
    font-weight: 500;
    line-height: 1;
    color: var(--border-dark);
}

/* --------------------------------------------------------------------------
   5. BUTTONS — Bootstrap overrides
   -------------------------------------------------------------------------- */

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    padding: 14px 32px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    border: none;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-coral);
    outline-offset: 2px;
    box-shadow: none;
}

/* Primary — Coral */
.btn-primary {
    background: var(--accent-coral);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-coral-hover);
    color: #fff;
    transform: scale(1.02);
}

.btn-primary:active {
    background: var(--accent-coral-hover);
    transform: scale(1);
}

/* Secondary — Outline */
.btn-outline {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* On light backgrounds */
.btn-outline-dark {
    background: transparent;
    border: 1px solid var(--text-dark);
    color: var(--text-dark);
}

.btn-outline-dark:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* Ghost — Text only */
.btn-ghost {
    background: transparent;
    color: var(--accent-coral);
    padding: 8px 16px;
}

.btn-ghost:hover {
    text-decoration: underline;
    color: var(--accent-coral);
}

/* Small button */
.btn-sm {
    padding: 8px 20px;
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   6. CARDS
   -------------------------------------------------------------------------- */

.card {
    border: none;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

/* Card on dark background */
.card-dark {
    background: var(--bg-card-dark);
    color: var(--text-white);
}

.card-dark:hover {
    background: var(--bg-card-dark-hover);
}

/* Card on light background */
.card-light {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

/* Cream card (on dark bg) */
.card-cream {
    background: var(--bg-surface-light);
    color: var(--text-dark);
}

.card-body {
    padding: 32px;
}

/* Bento card */
.card-bento {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

/* Project card on dashboard */
.card-project {
    background: var(--bg-card-dark);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-project:hover {
    border-color: var(--accent-coral);
}

.card-project .project-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 4px;
}

.card-project .project-client {
    font-size: 14px;
    color: var(--text-muted-light);
}

.card-project .project-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* --------------------------------------------------------------------------
   7. STATUS BADGES
   -------------------------------------------------------------------------- */

.badge-status {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: capitalize;
}

.badge-draft { background: rgba(255,255,255,0.08); color: var(--text-muted-light); }
.badge-active { background: var(--accent-coral-light); color: var(--accent-coral); }
.badge-completed { background: rgba(52,199,89,0.15); color: var(--color-success); }
.badge-archived { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* Question type badges */
.badge-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(200, 255, 0, 0.1);
    color: var(--accent-neon);
}

/* --------------------------------------------------------------------------
   8. FORMS — Bootstrap overrides
   -------------------------------------------------------------------------- */

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted-light);
    margin-bottom: 8px;
}

/* Inputs on dark */
.form-control {
    background: var(--bg-card-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-white);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    background: var(--bg-card-dark);
    border-color: var(--accent-coral);
    color: var(--text-white);
    box-shadow: none;
}

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

/* Inputs on light */
.form-control-light {
    background: var(--bg-white);
    border: 1px solid #D4D4D4;
    color: var(--text-dark);
}

.form-control-light:focus {
    background: var(--bg-white);
    border-color: var(--accent-coral);
    color: var(--text-dark);
    box-shadow: none;
}

.form-control-light::placeholder {
    color: #999;
}

/* Textarea */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Select */
.form-select {
    background-color: var(--bg-card-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-white);
    border-radius: 8px;
    padding: 12px 16px;
}

.form-select:focus {
    border-color: var(--accent-coral);
    box-shadow: none;
}

/* Checkbox / Toggle */
.form-check-input {
    background-color: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.form-check-input:checked {
    background-color: var(--accent-coral);
    border-color: var(--accent-coral);
}

.form-check-input:focus {
    box-shadow: none;
    border-color: var(--accent-coral);
}

/* Error state */
.form-control.is-invalid {
    border-color: var(--color-error);
}

.invalid-feedback {
    color: var(--color-error);
    font-size: 13px;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   9. NAVIGATION
   -------------------------------------------------------------------------- */

/* Top navbar (landing page) */
.navbar-tavla {
    background: var(--bg-primary);
    height: var(--topbar-height);
    padding: 0 48px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.navbar-tavla .nav-logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.navbar-tavla .nav-link {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted-light);
    padding: 8px 16px;
    transition: color 0.2s;
}

.navbar-tavla .nav-link:hover {
    color: var(--text-white);
}

/* --------------------------------------------------------------------------
   10. SIDEBAR (Dashboard)
   -------------------------------------------------------------------------- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 24px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
}

.sidebar-logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
    padding: 0 24px;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted-light);
    border-radius: 0;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: var(--text-white);
    background: rgba(255,255,255,0.04);
}

.sidebar-nav a.active {
    color: var(--text-white);
    background: rgba(255,255,255,0.06);
}

.sidebar-nav a i,
.sidebar-nav a [data-lucide] {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.sidebar-nav a.active i,
.sidebar-nav a.active [data-lucide] {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* --------------------------------------------------------------------------
   11. TOPBAR (Dashboard)
   -------------------------------------------------------------------------- */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 99;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --------------------------------------------------------------------------
   12. MAIN CONTENT (Dashboard)
   -------------------------------------------------------------------------- */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 32px;
    min-height: calc(100vh - var(--topbar-height));
    background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   13. ALERTS — Bootstrap overrides
   -------------------------------------------------------------------------- */

.alert {
    border-radius: var(--radius-md);
    font-size: 14px;
    padding: 12px 16px;
    border: 1px solid;
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.3);
    color: var(--color-success);
}

.alert-danger {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
    color: #FF6B6B;
}

.alert-warning {
    background: rgba(255, 184, 0, 0.1);
    border-color: rgba(255, 184, 0, 0.3);
    color: var(--color-warning);
}

.alert-info {
    background: rgba(90, 200, 250, 0.1);
    border-color: rgba(90, 200, 250, 0.3);
    color: var(--color-info);
}

/* --------------------------------------------------------------------------
   14. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-tavla {
    background: var(--bg-card-dark);
    color: var(--text-white);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 8px;
    font-size: 14px;
    border-left: 3px solid var(--accent-coral);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   15. MODAL — Bootstrap overrides
   -------------------------------------------------------------------------- */

.modal-content {
    background: var(--bg-card-dark);
    color: var(--text-white);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-dark);
    padding: 24px 32px;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 24px 32px;
}

.modal-footer {
    border-top: 1px solid var(--border-dark);
    padding: 16px 32px;
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 600;
}

.modal-backdrop.show {
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   16. DROPDOWN — Bootstrap overrides
   -------------------------------------------------------------------------- */

.dropdown-menu {
    background: var(--bg-card-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    color: var(--text-muted-light);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 14px;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-white);
}

.dropdown-divider {
    border-color: var(--border-dark);
}

/* --------------------------------------------------------------------------
   17. EMPTY STATES
   -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-state p {
    color: var(--text-muted-light);
    font-size: 16px;
    max-width: 400px;
    margin: 0 auto 24px;
}

/* --------------------------------------------------------------------------
   18. UTILITIES
   -------------------------------------------------------------------------- */

.bg-dark-primary { background: var(--bg-primary) !important; }
.bg-dark-secondary { background: var(--bg-secondary) !important; }
.bg-dark-card { background: var(--bg-card-dark) !important; }
.bg-surface-light { background: var(--bg-surface-light) !important; }

.border-dark-subtle { border-color: var(--border-dark) !important; }

.gap-24 { gap: 24px; }
.gap-16 { gap: 16px; }

.section-gap { padding: var(--section-gap-md) 0; }
.section-gap-sm { padding: var(--section-gap-sm) 0; }

/* Truncate */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-dark);
    margin: 24px 0;
}

/* --------------------------------------------------------------------------
   19. RESPONSIVE
   -------------------------------------------------------------------------- */

/* Mobile nav toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-white);
    padding: 8px;
    cursor: pointer;
}

/* Mobile overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
}

.mobile-overlay.show {
    display: block;
}

@media (max-width: 991.98px) {
    h1, .h1 { font-size: 36px; }
    h2, .h2 { font-size: 28px; }
    .display-xl { font-size: 44px; }
    .number-display { font-size: 48px; }

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

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
        padding: 0 16px;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }

    .navbar-tavla {
        padding: 0 20px;
    }
}

@media (max-width: 575.98px) {
    h1, .h1 { font-size: 32px; }
    .display-xl { font-size: 36px; }

    .card-body { padding: 20px; }
    .card-project { padding: 16px; }

    .btn { padding: 12px 24px; }
}

/* --------------------------------------------------------------------------
   20. ACCESSIBILITY
   -------------------------------------------------------------------------- */

/* Skip-to-content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--accent-coral);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: 10000;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-to-content:focus {
    top: 16px;
}

/* Visible focus states for all interactive elements */
*:focus-visible {
    outline: 2px solid var(--accent-coral);
    outline-offset: 2px;
}

/* Remove outline for mouse clicks */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure badges have text (not color-only) — already implemented in HTML */

/* Toast container for screen readers */
.toast-container {
    /* already positioned */
}

.toast-container[aria-live] {
    /* Screen reader will announce new toasts */
}

/* --------------------------------------------------------------------------
   21. MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */

/* Checkmark scale-in animation */
@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-scale-in {
    animation: scaleIn 0.3s ease forwards;
}

/* Button press feedback */
.btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* Card hover lift */
.card-project:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Link underline animation */
.link-animated {
    position: relative;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-coral);
    transition: width 0.2s ease;
}

.link-animated:hover::after {
    width: 100%;
}

/* --------------------------------------------------------------------------
   22. REDUCED MOTION
   -------------------------------------------------------------------------- */

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

    .card-project:hover {
        transform: none;
    }
}
