/* ========================================================================
   Sullaser Hub — Core Design System (style.css)
   ========================================================================
   Design tokens, reset, typography, and layout primitives.
   Inspired by Linear, Vercel, Stripe & Supabase dashboards.
   ======================================================================== */

/* ==========================================================================
   Font Loading
   ==========================================================================
   TODO: Load Inter locally via @font-face when self-hosted font files are
   available (e.g. assets/fonts/inter/). Until then the stack falls back to
   Arial → system sans-serif.
   ========================================================================== */

/* ==========================================================================
   CSS Reset
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

ul,
ol {
    list-style: none;
}

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */
:root {
    /* ── Colors ─────────────────────────────────────────────────────────── */
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --primary-light: #EEF2FF;
    --primary-dark: #4338CA;
    --primary-soft: #C7D2FE;

    --success: #10B981;
    --success-light: #D1FAE5;
    --success-dark: #059669;

    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --warning-dark: #D97706;

    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --danger-dark: #DC2626;

    --info: #3B82F6;
    --info-light: #DBEAFE;
    --info-dark: #2563EB;

    /* ── Backgrounds ────────────────────────────────────────────────────── */
    --bg-body: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-sidebar: #0F172A;
    --bg-sidebar-hover: #1E293B;
    --bg-sidebar-active: rgba(99, 102, 241, 0.12);
    --bg-header: rgba(255, 255, 255, 0.85);

    /* ── Text ───────────────────────────────────────────────────────────── */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-sidebar: #94A3B8;
    --text-sidebar-active: #FFFFFF;

    /* ── Borders ────────────────────────────────────────────────────────── */
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;

    /* ── Shadows ────────────────────────────────────────────────────────── */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    /* ── Layout ─────────────────────────────────────────────────────────── */
    --sidebar-width: 260px;
    --header-height: 64px;
    --content-padding: 32px;
    --card-padding: 24px;

    /* ── Radius ──────────────────────────────────────────────────────────── */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* ── Typography ─────────────────────────────────────────────────────── */
    --font-family: 'Inter', Arial, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 15px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 22px;
    --font-size-3xl: 28px;

    /* ── Transitions ────────────────────────────────────────────────────── */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ==========================================================================
   Dark Mode Placeholder
   ==========================================================================
   TODO: Implement dark mode by overriding custom properties under
   [data-theme='dark']. Example:
   [data-theme='dark'] {
       --bg-body: #0F172A;
       --bg-card: #1E293B;
       --text-primary: #F1F5F9;
       ...
   }
   ========================================================================== */

/* ==========================================================================
   Base Typography
   ========================================================================== */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    color: var(--text-primary);
    font-weight: 600;
}

h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    letter-spacing: -0.01em;
}

h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

h5 {
    font-size: var(--font-size-md);
    font-weight: 600;
}

h6 {
    font-size: var(--font-size-base);
    font-weight: 600;
}

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

a:hover {
    color: var(--primary-hover);
}

p {
    margin-bottom: 16px;
}

p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Selection Styles
   ========================================================================== */
::selection {
    background-color: var(--primary);
    color: #FFFFFF;
}

::-moz-selection {
    background-color: var(--primary);
    color: #FFFFFF;
}

/* ==========================================================================
   Scrollbar Styles
   ========================================================================== */

/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* ==========================================================================
   Layout — App Shell
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   Layout — Sidebar
   ========================================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width var(--transition-slow);
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .sidebar-nav-text,
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-nav-section-title,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .coming-soon {
    display: none;
}

.sidebar-header {
    padding: 20px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-brand {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* ── Sidebar Navigation ─────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Sidebar-specific thin scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav-section {
    margin-bottom: 24px;
}

.sidebar-nav-section-title {
    text-transform: uppercase;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 8px 12px;
    margin-bottom: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-nav-item.active {
    background: var(--bg-sidebar-active);
    color: #EEF2FF;
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-nav-text {
    white-space: nowrap;
    overflow: hidden;
}

/* ── Sidebar Footer ─────────────────────────────────────────────────────── */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    display: block;
    color: white;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}

/* ==========================================================================
   Layout — Main Content Wrapper
   ========================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

/* ==========================================================================
   Layout — Header
   ========================================================================== */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-secondary);
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 12px;
}

/* ── Header Search ──────────────────────────────────────────────────────── */
.header-search {
    position: relative;
    width: 220px;
}

.header-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
}

.header-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    color: var(--text-primary);
}

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

.header-search-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ── Header Notification ────────────────────────────────────────────────── */
.header-notification {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.header-notification:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.notification-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 4px;
}

/* ── Header User ────────────────────────────────────────────────────────── */
.header-user {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.header-user:hover {
    background: var(--bg-secondary);
}

.header-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.header-user-info {
    display: flex;
    flex-direction: column;
}

.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-user-role {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ── User Dropdown ──────────────────────────────────────────────────────── */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px;
    z-index: 1000;
}

.user-dropdown.active {
    display: block;
}

/* ==========================================================================
   Layout — Page Content
   ========================================================================== */
.page-content {
    padding: var(--content-padding);
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-content {
    /* Container for title + subtitle */
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-top: 6px;
}

.page-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
