/* =====================================================
   Headspace — Premium UI Styles
   Color Palette:
     Primary:     #1d4ed8 (blue-700)
     Primary-dk:  #1e40af (blue-800)
     Primary-lt:  #dbeafe (blue-100)
     Accent:      #b91c1c (red-700 / dark red)
     Accent-lt:   #fee2e2 (red-100)
     Body bg:     #f0f4ff (light blue-ish wash)
     Sidebar:     #0f172a (slate-900 navy)
===================================================== */

/* ── Base ──────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
}

/* ── Cards (box) ───────────────────────────────────── */
.box {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 4px 0 rgba(29,78,216,0.06), 0 1px 2px -1px rgba(0,0,0,0.05);
    border: 1px solid rgba(226,232,240,0.9);
}
.box-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.box-body { padding: 1.25rem; }
.box-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    background: rgba(248,250,252,0.7);
    border-radius: 0 0 0.75rem 0.75rem;
}

/* ── Buttons ───────────────────────────────────────── */
.ti-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.ti-btn:focus { outline: 2px solid #93c5fd; outline-offset: 2px; }
.ti-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ti-btn-primary { background: #1d4ed8; color: #ffffff; }
.ti-btn-primary:hover { background: #2563eb; }

.ti-btn-accent { background: #b91c1c; color: #ffffff; }
.ti-btn-accent:hover { background: #7f1d1d; }

.ti-btn-light { background: #f1f5f9; color: #334155; }
.ti-btn-light:hover { background: #e2e8f0; }

.ti-btn-danger { background: #dc2626; color: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.ti-btn-danger:hover { background: #b91c1c; }

.ti-btn-success { background: #059669; color: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.ti-btn-success:hover { background: #047857; }

.ti-btn-outline-primary { background: transparent; border-color: #1d4ed8; color: #1d4ed8; }
.ti-btn-outline-primary:hover { background: #1d4ed8; color: #ffffff; }

.ti-btn-ghost { background: transparent; color: #475569; border-color: transparent; }
.ti-btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

.ti-btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; border-radius: 0.375rem; }
.ti-btn-xs { padding: 0.25rem 0.5rem; font-size: 0.7rem; border-radius: 0.25rem; }
.ti-btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; border-radius: 0.75rem; }

/* ── Forms ─────────────────────────────────────────── */
.form-control {
    display: block;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #ffffff;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.04);
    transition: border-color 150ms ease, box-shadow 150ms ease;
    font-family: inherit;
    line-height: 1.5;
}
.form-control::placeholder { color: #94a3b8; }
.form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(191,219,254,0.5);
    outline: none;
}
.form-control:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}
.form-hint { font-size: 0.75rem; color: #64748b; margin-top: 0.25rem; }

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
}
.badge-primary  { background: #dbeafe; color: #1e40af; }
.badge-accent   { background: #fee2e2; color: #7f1d1d; }
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-neutral  { background: #f1f5f9; color: #475569; }

/* ── Page header ───────────────────────────────────── */
.page-title    { font-size: 1.25rem; font-weight: 700; color: #0f172a; line-height: 1.75rem; }
.page-subtitle { font-size: 0.875rem; color: #64748b; margin-top: 0.125rem; }

/* Non-layout transitions only (avoid layout thrash) */
a, button, .stat-card, .project-card {
    transition: box-shadow 200ms ease, transform 200ms ease, background-color 150ms ease, color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

/* ── Scrollbars ────────────────────────────────────── */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Sidebar active ────────────────────────────────── */
.sidebar-active {
    background: linear-gradient(90deg, rgba(29,78,216,0.35) 0%, rgba(29,78,216,0.12) 100%) !important;
    color: #93c5fd !important;
    border-left: 3px solid #3b82f6 !important;
    margin-left: -1px;
}

.sidebar-active i {
    color: #60a5fa !important;
}

/* ── Gradient stat cards ───────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.07;
    background: currentColor;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0,0,0,0.12), 0 4px 10px -3px rgba(0,0,0,0.08) !important;
}

/* ── Project cards ─────────────────────────────────── */
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -6px rgba(29,78,216,0.15), 0 4px 10px -3px rgba(0,0,0,0.08) !important;
    border-color: #bfdbfe !important;
}

/* ── Progress bars ─────────────────────────────────── */
.progress-bar {
    height: 5px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar-fill.accent { background: linear-gradient(90deg, #b91c1c, #f87171); }
.progress-bar-fill.success { background: linear-gradient(90deg, #059669, #34d399); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #d97706, #fbbf24); }

/* ── Pulsing notification badge ────────────────────── */
@keyframes ping {
    75%, 100% { transform: scale(2); opacity: 0; }
}
.animate-ping { animation: ping 1.2s cubic-bezier(0,0,0.2,1) infinite; }

/* ── Gradient glow buttons ─────────────────────────── */
.btn-glow {
    box-shadow: 0 4px 14px 0 rgba(29,78,216,0.35);
}
.btn-glow:hover {
    box-shadow: 0 6px 20px 0 rgba(29,78,216,0.5);
    transform: translateY(-1px);
}
.btn-accent-glow {
    box-shadow: 0 4px 14px 0 rgba(185,28,28,0.3);
}
.btn-accent-glow:hover {
    box-shadow: 0 6px 20px 0 rgba(185,28,28,0.45);
    transform: translateY(-1px);
}

/* ── Auth cover panel ──────────────────────────────── */
.auth-cover-panel {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 40%, #2563eb 70%, #1e3a8a 100%);
    position: relative;
    overflow: hidden;
}
.auth-cover-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-cover-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.25;
}
.auth-cover-orb-1 { width: 300px; height: 300px; top: -80px; right: -80px; background: #60a5fa; }
.auth-cover-orb-2 { width: 200px; height: 200px; bottom: 40px; left: -60px; background: #3b82f6; }
.auth-cover-orb-3 { width: 150px; height: 150px; top: 40%; right: 20%; background: #93c5fd; }

/* ── Timeline dots ─────────────────────────────────── */
.timeline-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}
.timeline-line {
    width: 1px; background: #e2e8f0;
    flex-shrink: 0; margin: 0 3.5px;
}

/* ── Page header gradient ──────────────────────────── */
.page-header-gradient {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    color: white;
    margin-bottom: 1.5rem;
}

/* ── Kanban column styles ──────────────────────────── */
.kanban-col {
    background: #f8faff;
    border: 1px solid #e0eaff;
    border-radius: 0.75rem;
    min-height: 400px;
}
.kanban-col-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0eaff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0.75rem 0.75rem 0 0;
}
.kanban-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: grab;
}
.kanban-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 12px rgba(29,78,216,0.1);
    transform: translateY(-1px);
}

/* ── Loading spinner ───────────────────────────────── */
.bx-spin { animation: spin 1s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ── Skeleton loading shimmer ──────────────────────── */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

/* ── HTMX indicator ────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ── Form focus ────────────────────────────────────── */
input:focus, select:focus, textarea:focus { outline: none; }

/* ── Toast notifications ───────────────────────────── */
.toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    min-width: 320px;
    max-width: 400px;
    padding: 0.875rem 1.125rem;
    border-radius: 0.625rem;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.15), 0 4px 10px -3px rgba(0,0,0,0.08);
    transform: translateX(calc(100% + 2rem));
    transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(8px);
    border-left: 4px solid transparent;
}
.toast.show { transform: translateX(0); }

.toast-success {
    background: rgba(240,253,244,0.95);
    border-color: #16a34a;
    color: #14532d;
}
.toast-success .toast-icon { color: #16a34a; font-size: 1.25rem; }

.toast-error {
    background: rgba(254,242,242,0.95);
    border-color: #b91c1c;
    color: #7f1d1d;
}
.toast-error .toast-icon { color: #b91c1c; font-size: 1.25rem; }

.toast-info {
    background: rgba(239,246,255,0.95);
    border-color: #1d4ed8;
    color: #1e3a8a;
}
.toast-info .toast-icon { color: #1d4ed8; font-size: 1.25rem; }

/* ── Dropdown menus ────────────────────────────────── */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 150ms ease, transform 150ms ease;
    pointer-events: none;
}
.dropdown-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Backdrop blur modal ───────────────────────────── */
.modal-backdrop {
    backdrop-filter: blur(4px);
    background: rgba(15, 23, 42, 0.5);
}

/* ── Header notification ping ──────────────────────── */
@keyframes headerPing {
    0% { transform: scale(1); opacity: 1; }
    75%, 100% { transform: scale(2.5); opacity: 0; }
}
.notification-ping {
    animation: headerPing 1.5s ease-out infinite;
}

/* ── Input group addon ─────────────────────────────── */
.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group-btn {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: none;
    border-radius: 0 0.375rem 0.375rem 0;
    cursor: pointer;
    color: #64748b;
}
.input-group-btn:hover { background: #f1f5f9; color: #1d4ed8; }

/* ── Trend indicators ──────────────────────────────── */
.trend-up { color: #16a34a; }
.trend-down { color: #b91c1c; }
.trend-badge-up { background: #dcfce7; color: #14532d; padding: 2px 6px; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; }
.trend-badge-down { background: #fee2e2; color: #7f1d1d; padding: 2px 6px; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; }

/* ── Avatar stack ──────────────────────────────────── */
.avatar-stack { display: flex; }
.avatar-stack .avatar-item {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -8px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar-stack .avatar-item:first-child { margin-left: 0; }

/* ── Color band on project cards ───────────────────── */
.color-band {
    height: 4px;
    border-radius: 9999px 9999px 0 0;
    background: linear-gradient(90deg, #1d4ed8, #60a5fa);
    margin: -1px -1px 0 -1px;
    border-radius: 0.75rem 0.75rem 0 0;
}
.color-band.red { background: linear-gradient(90deg, #b91c1c, #f87171); }
.color-band.green { background: linear-gradient(90deg, #059669, #34d399); }
.color-band.purple { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.color-band.orange { background: linear-gradient(90deg, #d97706, #fbbf24); }
.color-band.teal { background: linear-gradient(90deg, #0f766e, #2dd4bf); }

/* ── Section labels ────────────────────────────────── */
.section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
    padding: 0.5rem 0.75rem 0.25rem;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 640px) {
    .toast { min-width: calc(100vw - 2rem); right: 1rem; }
}
