/* ============================================
   SITE.CSS - NAVPRO DESIGN SYSTEM
   ============================================
   
   TABLE OF CONTENTS:
   1. CSS Variables (Design Tokens)
   2. Reset & Base Styles
   3. Layout (Grid Structure)
   4. Top Header & Breadcrumbs
   5. Sidebar - Base (Collapsed State)
   6. Sidebar - Expanded State
   7. Sidebar - User Menu & Dropdown
   8. Buttons
   9. Utility Classes
   
   ============================================ */

/* ============================================
   1. CSS VARIABLES (Design Tokens)
   - Brand colors, backgrounds, text, spacing
   ============================================ */
:root {
    /* Brand Colors */
    --brand-primary: #2563eb;
    --brand-primary-hover: #1d4ed8;
    /* Background Colors */
    --bg-app: #f8fafc;
    --bg-panel: #ffffff;
    --bg-hover: #f1f5f9;
    /* Text Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-tertiary: #94a3b8;
    /* Status Colors */
    --success: #16a34a;
    --warning: #f59e0b;
    /* --danger: #dc2626;*/
    --danger: #ef4444;
    /* Borders */
    --border-color: #e2e8f0;
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    /* Typography */
    --font-sans: 'Inter', system-ui, sans-serif;
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    /* Sidebar Widths */
    --sidebar-collapsed: 72px;
    --sidebar-expanded: 240px;
    /* Additional tokens */
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --error: #dc2626;
    /*Dots*/
    --indigo: #4f46e5;
    --success: #16a34a;
    --lighter-indigo: #e0e7ff; /* Lighter Indigo */
    --darker-indigo: #4338ca; /* Darker Indigo */

    --color-total: #2563eb; /* Dynamic Blue */
    --color-open: #4f46e5; /* Active Indigo */
    --color-closed: #10b981; /* Relief Green */
    /* Elevation Tokens (The 3rd Dimension) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* The RGB Triplet (For transparency/RGBA) */
    --border-rgb: 226, 232, 240;
    /* Let's do the same for our Brand Primary (Blue) */
    --brand-primary-rgb: 37, 99, 235;
    /* 1. Neutral Slate (Professional & Clean) */
    --neutral-rgb: 100, 116, 139;
    /* 2. Light Border Slate (Very Subtle) */
    --border-rgb: 226, 232, 240;
}

.hidden {
    display: none !important;
}

/* ============================================
   2. RESET & BASE STYLES
   - Box-sizing, margin/padding reset, body defaults
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-app);
}


/* ============================================
   3. LAYOUT (Grid Structure)
   - .layout: Main grid container
   - .sidebar: Left navigation panel
   - .main-content: Right content area
   ============================================ */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-collapsed) 1fr;
    height: 100vh;
    transition: grid-template-columns 0.2s ease;
}

/* Expanded sidebar state - triggered by JS adding this class to .layout */
.layout.sidebar-expanded {
    grid-template-columns: var(--sidebar-expanded) 1fr;
}

.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    overflow: hidden;
}

.main-content {
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* ============================================
   4. TOP HEADER & BREADCRUMBS
   - .top-header: Fixed header bar
   - .breadcrumbs: Navigation path display
   - .page-content: Scrollable main content
   ============================================ */
.top-header {
    height: 60px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    flex-shrink: 0;
    overflow: visible;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-muted);
    font-size: 14px;
}

.page-content {
    /*GDI    flex: 1;
    overflow: hidden;*/
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* ============================================
   5. SIDEBAR - BASE (Collapsed State)
   - Default: 72px wide, icons centered, text hidden
   ============================================ */

/* --- 5.1 Sidebar Header (Logo + Toggle) --- */
.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.brand-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    width: 65px;
    height: 58px;
    object-fit: contain;
    /* Keeps aspect ratio */
}

.brand-logo i {
    font-size: 2rem;
    /* Icon slightly bigger */
    color: var(--brand-primary);
}

.brand-logo svg {
    width: 32px;
    height: 32px;
    color: var(--brand-primary);
    flex-shrink: 0;
}

/* Hidden in collapsed state */
.brand-name {
    display: none;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-main);
    white-space: nowrap;
}

/* --- 5.2 Toggle Button --- */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 14px;
    margin-bottom: 24px;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* --- 5.3 Navigation Menu --- */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item i {
    font-size: 20px;
    flex-shrink: 0;
}

/* Hidden in collapsed state */
.nav-text {
    display: none;
    font-size: 14px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active {
    background: #dbeafe;
    color: var(--brand-primary);
}

/* --- 5.4 Nav Separator --- */
.nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-md) 0;
}


/* ============================================
   6. SIDEBAR - EXPANDED STATE
   - Shows text labels, adjusts layout
   ============================================ */

/* Show text labels */
.sidebar-expanded .brand-name,
.sidebar-expanded .nav-text,
.sidebar-expanded .user-name {
    display: block;
}

/* Header: side by side layout */
.sidebar-expanded .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
}

/* Logo: text next to icon */
.sidebar-expanded .brand-logo {
    gap: var(--spacing-sm);
}

/* Nav items: full width with text */
.sidebar-expanded .nav-item {
    justify-content: flex-start;
    width: 100%;
    padding: 0 var(--spacing-sm);
    gap: var(--spacing-sm);
}


/* ============================================
   7. SIDEBAR - USER MENU & DROPDOWN
   - .sidebar-footer: Container at bottom
   - .user-menu-trigger: Clickable area
   - .user-dropdown: Popup menu
   ============================================ */

/* --- 7.1 Sidebar Footer (Container) --- */
.sidebar-footer {
    position: relative;
    padding: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* --- 7.2 User Menu Trigger --- */
.user-menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu-trigger:hover {
    background: var(--bg-hover);
}

/* Caret icon - hidden in collapsed */
.user-menu-trigger>i {
    display: none;
    color: var(--text-muted);
}

/* --- 7.3 User Avatar --- */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* --- 7.4 User Name --- */
.user-name {
    display: none;
    flex: 1;
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 7.5 User Dropdown (Collapsed State) --- */
.user-dropdown {
    display: none;
    position: absolute;
    left: calc(var(--sidebar-collapsed) - var(--spacing-md));
    bottom: 0;
    width: 200px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 100;
}

.user-dropdown.show {
    display: block;
}

/* --- 7.6 Dropdown Items --- */
.dropdown-header {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item i {
    font-size: 16px;
    color: var(--text-muted);
}

/* --- 7.7 User Menu - Expanded State --- */
.sidebar-expanded .user-menu-trigger {
    justify-content: flex-start;
}

.sidebar-expanded .user-menu-trigger>i {
    display: inline;
}

.sidebar-expanded .user-dropdown {
    left: var(--spacing-sm);
    right: var(--spacing-sm);
    bottom: 100%;
    width: auto;
    margin-bottom: var(--spacing-sm);
}


/* ============================================
   8. BUTTONS
   - .btn-primary: Main action button
   - .btn-secondary: Secondary action
   - .btn-danger: Destructive action
   - .btn-icon: Icon-only button
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 8px 16px;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--brand-primary);
}

.btn-icon.btn-icon-danger:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* Full width button modifier */
.btn-full {
    width: 100%;
}

/* ============================================
   9. FORMS
   - .input-field: Standard text/select input
   ============================================ */
.input-field {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    resize: vertical;
    min-height: 40px;
}

.input-field:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--bg-panel);
}

.input-field:disabled {
    background: var(--bg-app);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.input-field::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ============================================
   10. OFFCANVAS SYSTEM
   - .offcanvas-backdrop: Modal overlay
   - .offcanvas-panel: Side drawer
   ============================================ */
.offcanvas-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.offcanvas-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.offcanvas-panel {
    width: 600px;
    max-width: 95%;
    height: 100%;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}

.offcanvas-backdrop.active .offcanvas-panel {
    transform: translateX(0);
}

.offcanvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.offcanvas-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.offcanvas-body {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.offcanvas-footer {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-app);
}

/* ============================================
   11. OFFCANVAS TABS
   ============================================ */
.offcanvas-tabs {
    display: flex;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel);
}

.offcanvas-tab {
    padding: 14px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.offcanvas-tab:hover {
    color: var(--text-main);
}

.offcanvas-tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* ============================================
   12. GLOBAL STATUS BADGES
   - .status-badge: Base style
   - .status-[type]: Color variations
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Color Variations */
.status-success,
.status-passed,
.status-active {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.status-warning,
.status-pending,
.status-planned {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-danger,
.status-failed,
.status-onhold,
.status-inactive {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.status-info,
.status-open,
.status-inprogress {
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand-primary);
}

.status-neutral,
.status-closed,
.status-completed {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}


/* ============================================
   CONTEXT SWITCHER (Navalist Style)
   ============================================ */

.header-path {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    height: 100%;
    margin-left: auto;
    overflow: visible;
}

.crumb-separator {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 14px;
    margin: 0 2px;
}

.crumb-item {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.crumb-item.text-muted {
    font-weight: 500;
    color: var(--text-muted);
}

/* Interactive Context Trigger */
.ctx-trigger {
    position: relative;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 600;
    padding: 6px 10px;
    margin: 0 -6px;
    border-radius: 6px;
    transition: all 0.15s ease-out;
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
}

.ctx-trigger:hover {
    background: var(--bg-hover);
}

.ctx-trigger.active-menu {
    background: var(--bg-hover);
    color: var(--brand-primary);
}

.crumb-icon {
    font-size: 14px;
    color: var(--brand-primary);
}

.crumb-caret {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.ctx-trigger:hover .crumb-caret {
    color: var(--text-main);
}

/* Context Menu Dropdown */
.ctx-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 300px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 4px;
    z-index: 1000;
    margin-top: 8px;
    animation: scaleIn 0.15s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ctx-menu.hidden {
    display: none;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-main);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.ctx-item:hover {
    background: var(--bg-hover);
}

.ctx-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand-primary);
}

.ctx-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-muted);
}

.ctx-item.active .ctx-item-icon {
    background: var(--brand-primary);
    color: white;
}

.ctx-item-name{
    margin-left: auto;
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

#projectMenu {
    left: auto;
    right: 0;
}


.alert-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin: 0 16px 16px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.alert-error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

/* ============================================
   QUILL RICH TEXT EDITOR STYLING
   ============================================ */

/* 1. The main container boundary */
.ql-container.ql-snow {
    border: 1px solid var(--border-color) !important;
    border-top: none !important; /* The toolbar has the top border */
    border-bottom-left-radius: var(--radius-md) !important;
    border-bottom-right-radius: var(--radius-md) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    color: var(--text-main) !important;
    background-color: var(--bg-card) !important;
}

/* 2. The formatting toolbar */
.ql-toolbar.ql-snow {
    border: 1px solid var(--border-color) !important;
    border-top-left-radius: var(--radius-md) !important;
    border-top-right-radius: var(--radius-md) !important;
    background-color: var(--bg-app) !important;
    padding: 8px !important; /* Slightly more space */
}

/* 3. The actual typing area */
.ql-editor {
    min-height: 120px; /* Minimum comfortable height */
    padding: 12px 14px !important; /* Match our regular inputs */
}

    /* 4. Fix the placeholder text color */
    .ql-editor.ql-blank::before {
        color: var(--text-muted) !important;
        font-style: normal !important;
    }

/* 5. Highlight states when typing (Focus) */
.ql-container.ql-snow.ql-focused {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 2px rgba(10, 89, 137, 0.1) !important;
}

.ql-toolbar.ql-snow.ql-focused {
    border-color: var(--brand-primary) !important;
}
