/**
 * IIQ Engineering - Main Application Stylesheet
 * Dark Mode Theme
 */

/* ============================================
   CSS VARIABLES - Color Palette & Theme
   ============================================ */
:root {
    /* Dark Mode Color Palette */
    --bg-darkest: #0f172a;
    --bg-dark: #1e293b;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    
    --border-color: #334155;
    --border-subtle: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --text-dark: var(--bg-dark);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.3);
    
    --secondary: #10b981;
    --secondary-hover: #059669;
    --secondary-glow: rgba(16, 185, 129, 0.3);
    
    --success: #22c55e;
    --success-light: #4ade80;
    --success-bg: rgba(34, 197, 94, 0.1);
    --success-bg-strong: rgba(34, 197, 94, 0.15);
    --success-bg-accent: rgba(34, 197, 94, 0.2);
    --success-border: rgba(34, 197, 94, 0.3);
    
    --warning: #eab308;
    --warning-light: #fde047;
    --warning-bg: rgba(234, 179, 8, 0.1);
    --warning-bg-strong: rgba(234, 179, 8, 0.15);
    --warning-bg-accent: rgba(234, 179, 8, 0.2);
    --warning-border: rgba(234, 179, 8, 0.3);
    
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-lighter: #fca5a5;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-bg-strong: rgba(239, 68, 68, 0.15);
    --danger-bg-accent: rgba(239, 68, 68, 0.2);
    --danger-border: rgba(239, 68, 68, 0.3);
    
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.1);
    --info-border: rgba(14, 165, 233, 0.3);
    
    /* Primary light variant for gradients and accents */
    --primary-light: #60a5fa;
    --primary-bg: rgba(59, 130, 246, 0.15);
    --primary-bg-subtle: rgba(59, 130, 246, 0.1);
    --primary-bg-faint: rgba(59, 130, 246, 0.05);
    --primary-border: rgba(59, 130, 246, 0.2);
    
    /* Purple accent (for special status like "independent") */
    --purple: #a855f7;
    --purple-light: #a78bfa;
    --purple-bg: rgba(168, 85, 247, 0.15);
    --purple-bg-subtle: rgba(139, 92, 246, 0.1);
    
    /* Inhabit Brand Orange */
    --orange: #f79420;
    --orange-light: #ffa64d;
    --orange-dark: #e67e00;
    --orange-bg: rgba(247, 148, 32, 0.15);
    --orange-bg-subtle: rgba(247, 148, 32, 0.1);
    --orange-bg-faint: rgba(247, 148, 32, 0.05);
    --orange-border: rgba(247, 148, 32, 0.3);
    --orange-glow: rgba(247, 148, 32, 0.3);
    
    /* GitHub Brand */
    --github: #5FED83;
    
    /* Jira Brand */
    --jira: #4e9af1;
    
    /* Cursor Brand */
    --cursor: #72716d;
    
    /* Snyk Brand */
    --snyk: #7856C8;
    
    /* Neutral/inactive states */
    --neutral-bg: rgba(148, 163, 184, 0.15);
    --neutral-bg-accent: rgba(148, 163, 184, 0.2);
    
    /* Overlay */
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --overlay-subtle: rgba(0, 0, 0, 0.2);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    background: var(--bg-darkest);
    color: var(--text-primary);
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Color utility classes */
.text-primary { color: var(--primary); }
.bg-primary { background-color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.bg-secondary { background-color: var(--secondary); }

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #60a5fa;
}

/* ============================================
   MATERIALIZE OVERRIDES
   ============================================ */

/* Buttons */
.btn, .btn-large {
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: none;
    transition: all 0.2s ease;
    text-transform: none;
}

.btn:hover, .btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn.secondary, .btn-large.secondary {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.btn.secondary:hover, .btn-large.secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-subtle);
    box-shadow: none;
}

.btn-flat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: transparent;
    line-height: 1;
}

.btn-flat:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card .card-content {
    color: var(--text-primary);
}

.card .card-title {
    color: var(--text-primary);
    font-weight: 600;
}

.card .card-action {
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   FORM FIELDS
   ============================================ */

/* Modern form field with label above */
.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-field input,
.form-field textarea,
.form-field select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 14px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--text-subtle);
}

.form-field input:disabled,
.form-field select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-field .helper-text {
    color: var(--text-subtle);
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-field.error input,
.form-field.error select {
    border-color: var(--danger);
}

.form-field.error .helper-text {
    color: var(--danger);
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-field,
.form-row .input-field {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Legacy .input-field support (label above style) */
.input-field {
    margin-bottom: 20px;
    position: relative;
}

.input-field > label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    position: static;
    transform: none;
    pointer-events: auto;
}

.input-field input[type=text],
.input-field input[type=password],
.input-field input[type=email],
.input-field input[type=number],
.input-field input[type=date],
.input-field textarea {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 14px;
    height: auto;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field input:focus,
.input-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

.input-field input::placeholder {
    color: var(--text-subtle);
}

.input-field .helper-text {
    color: var(--text-subtle);
    font-size: 0.8rem;
}

/* ============================================
   SELECT / DROPDOWN
   ============================================ */

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-card);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    height: 44px;
    padding: 0 40px 0 14px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

/* ============================================
   CUSTOM DROPDOWN COMPONENT
   ============================================ */

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    height: 44px;
    padding: 0 14px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: var(--text-muted);
}

.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

.custom-select-trigger .placeholder {
    color: var(--text-subtle);
}

.custom-select-trigger .arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.custom-select.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}

.custom-select.disabled .custom-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dropdown Menu - uses fixed positioning to escape overflow containers */
.custom-select-dropdown {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 280px;
    overflow-y: auto;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.custom-select.open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Search Input */
.custom-select-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.custom-select-search input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.9rem;
    font-family: inherit;
}

.custom-select-search input:focus {
    border-color: var(--primary);
    outline: none;
}

.custom-select-search input::placeholder {
    color: var(--text-subtle);
}

/* Options */
.custom-select-options {
    padding: 4px 0;
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
}

.custom-select-option:hover,
.custom-select-option.highlighted {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.custom-select-option.selected {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.custom-select-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Pro', 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.8rem;
}

.custom-select-option.disabled {
    color: var(--text-subtle);
    cursor: not-allowed;
}

.custom-select-option.disabled:hover {
    background: transparent;
}

/* Empty State */
.custom-select-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-subtle);
    font-size: 0.9rem;
}

/* Option Groups */
.custom-select-group-label {
    padding: 10px 14px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-subtle);
    letter-spacing: 0.05em;
}

/* Scrollbar styling for dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 8px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-subtle);
}

/* Tables */
table {
    background: transparent;
}

table thead {
    background: var(--bg-darkest);
    border-bottom: 1px solid var(--border-color);
}

table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 14px 16px;
}

table td {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 16px;
}

table.striped tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.5);
}

table.striped tbody tr:nth-child(even) {
    background: transparent;
}

table.highlight tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Chips and Badges */
.chip {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 20px;
}

.badge {
    background: var(--primary);
}

/* Collection */
.collection {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.collection .collection-item {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.collection .collection-item:hover {
    background: var(--bg-elevated);
}

.collection .collection-item.active {
    background: var(--primary);
}

/* Pagination */
.pagination li a {
    color: var(--text-primary);
}

.pagination li.active {
    background: var(--primary);
}

.pagination li.disabled a {
    color: var(--text-subtle);
}

/* Toast/Flash Messages */
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
}

/* Modal */
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.modal .modal-content {
    color: var(--text-primary);
}

.modal .modal-footer {
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Progress bar */
.progress {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.progress .determinate,
.progress .indeterminate {
    background: var(--primary);
}

/* Tabs */
.tabs {
    background: var(--bg-card);
}

.tabs .tab a {
    color: var(--text-muted);
}

.tabs .tab a:hover,
.tabs .tab a.active {
    color: var(--primary);
}

.tabs .indicator {
    background: var(--primary);
}

/* Preloader */
.preloader-wrapper .spinner-layer {
    border-color: var(--primary);
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid var(--primary-glow);
    outline-offset: 2px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .slider {
    background-color: rgba(59, 130, 246, 0.3);
    border-color: var(--primary);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
    background-color: var(--primary);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 999;
    transform: translateX(0);
    transition: transform 0.3s ease;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Mobile: hidden by default */
@media only screen and (max-width: 992px) {
    .sidenav {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidenav.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }
}

/* Sidenav overlay for mobile */
.sidenav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidenav-overlay.active {
    display: block;
}

.sidenav .user-view {
    padding: 20px 16px;
    background: linear-gradient(135deg, var(--bg-dark) 10%, var(--primary-bg-subtle) 100%);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.sidenav .user-view-branding {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.sidenav-mascot {
    width: 48px;
    height: auto;
    flex-shrink: 0;
}

.sidenav .user-view-content {
    flex: 1;
    min-width: 0;
}

.sidenav .user-view .name,
.sidenav .user-view .email {
    color: var(--text-primary);
}

.sidenav .user-view .name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.sidenav-logo {
    width: 60px;
    height: auto;
    max-width: 100%;
}

.sidenav .user-view .email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidenav .nav-section {
    padding: 16px 16px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-subtle);
    letter-spacing: 0.1em;
    line-height: 1;
}

.sidenav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 44px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 44px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidenav .nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.sidenav .nav-item.active {
    background: linear-gradient(90deg, var(--bg-dark) 0%, var(--primary-bg) 100%);
    color: var(--primary);
    border-left-color: var(--orange);
}

.sidenav .nav-item i,
.sidenav .nav-item svg {
    color: var(--text-muted);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: color 0.2s ease;
}

.sidenav .nav-item:hover i,
.sidenav .nav-item:hover svg {
    color: var(--text-primary);
}

.sidenav .nav-item.active i,
.sidenav .nav-item.active svg {
    color: var(--orange);
}

.sidenav .divider {
    height: 1px;
    margin: 8px 16px;
    background-color: var(--border-color);
}

/* Main content with sidenav */
main {
    padding-left: 0;
    background: var(--bg-darkest);
    min-height: 100vh;
}

@media only screen and (min-width: 993px) {
    main.has-sidenav {
        padding-left: 260px;
    }
}

/* Top nav for mobile */
.top-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    z-index: 997;
}

.top-nav-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    gap: 12px;
}

.top-nav-branding {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav-logo {
    width: 20px;
    height: auto;
    max-height: 28px;
    object-fit: contain;
}

.sidenav-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidenav-toggle:hover {
    color: var(--primary);
}

.top-nav .brand-logo {
    color: var(--orange);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
}

@media only screen and (max-width: 992px) {
    .top-nav {
        display: block;
    }
    
    main.has-sidenav {
        padding-top: 56px;
    }
    
    .sidenav-logo {
        width: 30px;
    }
}

/* ============================================
   PAGE LAYOUT COMPONENTS
   ============================================ */

/* Page Container */
.page-wrapper {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-wrapper.narrow {
    max-width: 800px;
}

.page-wrapper.wide {
    max-width: 1400px;
}

.page-container {
    padding: 32px;
}

.page-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 32px;
}

/* Content Card */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
}

.content-card.compact {
    padding: 24px;
    border-radius: 16px;
}

.content-card h4, .content-card h5 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 0 12px 0;
}

.content-card > p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Section Header with Icon */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.section-header i {
    font-size: 1.75rem;
    color: var(--text-primary);
}

/* Brand colors in section headers */
.section-header .text-github { color: var(--github); }
.section-header .text-jira { color: var(--jira); }
.section-header .text-cursor { color: var(--cursor); }
.section-header .text-snyk { color: var(--snyk); }

.section-header h5 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
}

/* ============================================
   FORM COMPONENTS
   ============================================ */

/* Custom Form Inputs */
.form-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
    color: var(--text-subtle);
}

.form-input::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.form-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-error {
    color: #f87171;
    font-size: 0.8rem;
    margin-top: 6px;
    display: block;
}

.input-error {
    color: #f87171;
    font-size: 0.8rem;
    margin-top: 6px;
    display: block;
}

/* ============================================
   BUTTON COMPONENTS
   ============================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
    color: var(--text-dark);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--orange-light) 0%, var(--orange-dark) 100%);
    color: var(--text-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary i,
.btn-primary svg {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-subtle);
    transform: translateY(-1px);
}

.btn-secondary i,
.btn-secondary svg {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

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

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    font-family: inherit;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    color: white;
}

/* ============================================
   ALERT & NOTIFICATION COMPONENTS
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert.success {
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert.warning {
    background: var(--warning-bg);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fde047;
}

.alert.error, .alert.danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert.info {
    background: var(--info-bg);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.success {
    background: var(--success-bg);
    color: #86efac;
}

.status-badge.warning {
    background: var(--warning-bg);
    color: #fde047;
}

.status-badge.error {
    background: var(--danger-bg);
    color: #fca5a5;
}

.status-badge.info {
    background: var(--info-bg);
    color: #7dd3fc;
}

/* Toast */
.toast-success {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 18px 28px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
    z-index: 1000;
    display: none;
    font-weight: 600;
}

.toast-success.visible {
    display: block;
}

/* ============================================
   INFO BOX & LIST COMPONENTS
   ============================================ */

.info-box {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.info-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.info-box-title i {
    font-size: 1.1rem;
}

.info-box-title.success i { color: #4ade80; }
.info-box-title.warning i { color: #facc15; }
.info-box-title.muted i { color: var(--text-subtle); }

.info-list {
    margin: 0 0 20px 0;
    padding-left: 0;
    list-style: none;
}

.info-list:last-child {
    margin-bottom: 0;
}

.info-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.info-list li i {
    margin-top: 3px;
    width: 16px;
    flex-shrink: 0;
}

.info-list.success li i { color: #4ade80; }
.info-list.warning li i { color: #facc15; }
.info-list.muted li { color: var(--text-muted); }
.info-list.muted li i { color: var(--text-subtle); }

/* ============================================
   SOURCE TABS (GitHub/Jira selectors)
   ============================================ */

.source-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.source-tab {
    flex: 1;
    padding: 24px 20px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
}

.source-tab:hover {
    border-color: var(--border-subtle);
    transform: translateY(-2px);
}

.source-tab.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.source-tab .tab-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.source-tab.active .tab-icon {
    color: var(--primary);
}

.source-tab .tab-label {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ============================================
   MATCH CARD COMPONENTS
   ============================================ */

.match-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--bg-dark);
}

.match-card:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.match-card.selected {
    border: 2px solid #4ade80;
    background: rgba(34, 197, 94, 0.1);
}

.match-card .match-info {
    flex: 1;
}

.match-card .match-name {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.match-card .match-details {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.match-card .match-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Source Label Badge */
.source-label {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 10px;
}

.source-label.enterprise {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.source-label.github {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.source-label.jira {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

/* Confidence Badges */
.confidence-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 10px;
}

.confidence-badge.high {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.confidence-badge.medium {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.confidence-badge.low {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* ============================================
   STATE COMPONENTS
   ============================================ */

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #60a5fa;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.loading-state p {
    margin-top: 16px;
}

/* Custom Spinner */
.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.spinner.small {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.spinner.large {
    width: 64px;
    height: 64px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #4ade80;
}

.empty-state h5 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Count Label */
.count-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ============================================
   DASHBOARD COMPONENTS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.security-item {
    text-align: center;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
}

.security-item.warning {
    border-color: var(--warning);
    background: var(--warning-bg);
}

.security-item.danger {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.pr-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-card);
    transition: border-color 0.2s ease;
}

.pr-item:hover {
    border-color: var(--border-subtle);
}

/* Log container */
.log-container {
    background: var(--bg-darkest);
    border-radius: 12px;
    padding: 16px;
    margin-top: 24px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.log-info { color: #60a5fa; }
.log-success { color: #4ade80; }
.log-warning { color: #facc15; }
.log-error { color: #f87171; }

/* Sync page animations */
.sync-fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Use higher specificity for collapsed state */
.info-box.sync-collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden;
    border-width: 0 !important;
}

/* Ensure the info-box has proper initial state for animation */
#sync-info-box {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out, margin 0.4s ease-out, opacity 0.3s ease, transform 0.3s ease, border-width 0.4s ease-out;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   AUTH PAGE STYLES
   ============================================ */

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-darkest) 0%, #1a1f35 100%);
    padding: 20px;
}

.auth-layout::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.auth-layout.danger::before {
    background: 
        radial-gradient(circle at 20% 20%, rgba(239, 68, 68, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

/* Auth Branding */
.auth-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
}

.auth-mascot {
    width: 120px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    /* Crop out extra whitespace by using clip-path or adjusting display */
    display: block;
    margin: 0 auto;
}

.auth-logo-img {
    width: 200px;
    height: auto;
    max-width: 100%;
}

.auth-engineering-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--orange);
    margin: 0;
    text-align: center;
    letter-spacing: 0.05em;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    text-align: center;
}

.auth-input-group {
    margin-bottom: 24px;
}

.auth-alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.auth-alert.error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.auth-alert.success {
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #60a5fa;
}

.auth-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    box-shadow: none;
    font-family: inherit;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* Microsoft SSO Button */
.microsoft-sso-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.microsoft-sso-button:hover {
    background: #f8f9fa;
    border-color: #c6c7c8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    color: #3c4043;
}

.microsoft-sso-button:active {
    transform: translateY(0);
}

.microsoft-sso-button .microsoft-logo {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    max-width: 20px;
    max-height: 20px;
    flex-shrink: 0;
}

.microsoft-sso-button span {
    line-height: 1;
}

/* SSO-only Auth Card */
.auth-card-sso {
    text-align: center;
}

.auth-card-sso .auth-subtitle {
    margin-bottom: 28px;
}

.auth-sso-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-sso-note i {
    color: var(--secondary);
}

/* SSO Info Box (for setup page) */
.auth-sso-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 10px;
    margin-bottom: 24px;
    color: var(--secondary);
    font-size: 0.9rem;
}

.auth-sso-info i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 16px;
    color: var(--text-subtle);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   PAGE INTRO COMPONENTS
   ============================================ */

/* Page intro paragraph after section header */
.page-intro {
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

.page-intro strong {
    color: var(--text-primary);
}

/* Section header spacing variant */
.section-header.mb-sm {
    margin-bottom: 12px;
}

/* Icon with primary color */
.icon-primary {
    color: var(--primary);
}

/* ============================================
   ERROR BOX COMPONENT
   ============================================ */

.error-box {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.error-box ul {
    margin: 0;
    padding-left: 20px;
    color: #fca5a5;
}

.error-box-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.error-box-content i {
    color: #f87171;
    margin-top: 2px;
}

.error-box-content strong {
    color: #fca5a5;
    display: block;
    margin-bottom: 4px;
}

.error-box-content span {
    color: var(--text-secondary);
}

/* ============================================
   FORM LABEL VARIANTS
   ============================================ */

.form-label-lg {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: block;
}

/* ============================================
   CARD VARIANTS
   ============================================ */

.card-section {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
}

.card-section.padded {
    padding: 24px;
}

.card-section.mt {
    margin-top: 24px;
}

.card-section h6 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.card-section h6 i {
    color: var(--primary);
    margin-right: 8px;
}

.card-section > p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ============================================
   RADIO/CHECKBOX OPTION GROUPS
   ============================================ */

.option-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.radio-option input[type="radio"],
.radio-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.radio-option strong {
    color: var(--text-primary);
}

.radio-option .option-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.overflow-x-auto {
    overflow-x: auto;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.w-full {
    width: 100%;
}

.relative {
    position: relative;
}

/* Margin utilities */
.mb-lg {
    margin-bottom: 32px;
}

/* Table column widths */
.col-45 { width: 45%; }
.col-55 { width: 55%; }
.col-140 { width: 140px; }

/* Icon inline with text */
.icon-inline {
    vertical-align: middle;
    margin-right: 8px;
}

.icon-inline-sm {
    vertical-align: middle;
    margin-right: 4px;
    font-size: 1.1rem;
}

/* Color utilities */
.text-success { color: #4ade80; }
.text-warning { color: #fbbf24; }
.text-info { color: #60a5fa; }
.text-jira { color: var(--jira); }
.text-github { color: var(--github); }
.text-cursor { color: var(--cursor); }
.text-snyk { color: var(--snyk); }

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

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

