/**
 * Asset Sentinel — Luminous Design System
 * Indigo-teal gradient palette · Glassmorphism · Plus Jakarta Sans
 * Sophisticated light + dark modes with high clarity
 */

:root {
    /* Surfaces */
    --bg-primary:   #0f1117;
    --bg-secondary: #161822;
    --bg-tertiary:  #1e2030;
    --bg-card:      rgba(30, 32, 48, 0.80);
    --bg-border:    rgba(255,255,255,0.06);
    --bg-glass:     rgba(30, 32, 48, 0.65);

    /* Text */
    --text-primary:   #f0f0f5;
    --text-secondary: #a1a1b5;
    --text-muted:     #6b6b80;
    --text-inverse:   #ffffff;

    /* Accent — Indigo / Teal Prism */
    --accent:        #6366f1;
    --accent-hover:  #4f46e5;
    --accent-light:  rgba(99,102,241,0.12);
    --accent-subtle: rgba(99,102,241,0.06);
    --primary:       #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99,102,241,0.12);
    --gradient:      linear-gradient(135deg, #6366f1, #14b8a6);
    --gradient-text: linear-gradient(135deg, #818cf8, #2dd4bf);

    /* Semantic */
    --success: #34d399;
    --warning: #fbbf24;
    --danger:  #f87171;
    --info:    #38bdf8;

    /* Shadows */
    --shadow-sm:  0 1px  2px rgba(0,0,0,0.30);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.30);
    --shadow-xl:  0 12px 40px rgba(0,0,0,0.35);
    --shadow-glow: 0 0 20px rgba(99,102,241,0.15);

    /* Radii */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

[data-theme="light"] {
    --bg-primary:   #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary:  #f1f3f9;
    --bg-card:      rgba(255, 255, 255, 0.80);
    --bg-border:    rgba(0,0,0,0.08);
    --bg-glass:     rgba(255, 255, 255, 0.70);

    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --text-inverse:   #ffffff;

    --accent:        #4f46e5;
    --accent-hover:  #4338ca;
    --accent-light:  rgba(79,70,229,0.08);
    --accent-subtle: rgba(79,70,229,0.04);
    --primary:       #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79,70,229,0.08);
    --gradient:      linear-gradient(135deg, #4f46e5, #0d9488);
    --gradient-text: linear-gradient(135deg, #4f46e5, #0d9488);

    --success: #059669;
    --warning: #d97706;
    --danger:  #dc2626;
    --info:    #0284c7;

    --shadow-sm:  0 1px  3px rgba(0,0,0,0.04), 0 1px  2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.05), 0 2px  4px rgba(0,0,0,0.04);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.08), 0 4px  8px rgba(0,0,0,0.04);
    --shadow-xl:  0 12px 40px rgba(0,0,0,0.10);
    --shadow-glow: 0 0 20px rgba(79,70,229,0.08);
}

/* Base */

* {
    transition: background-color 0.2s ease, color 0.2s ease,
                border-color 0.2s ease, box-shadow 0.2s ease;
}

html {
    scroll-behavior: smooth;
    color: var(--text-primary);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar */

.sidebar {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--bg-border);
    box-shadow: var(--shadow-md);
    width: var(--sidebar-width);
    transition: width 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="light"] .sidebar {
    background-color: rgba(255,255,255,0.85);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .user-info-text,
.sidebar.collapsed .admin-label,
.sidebar.collapsed .sidebar-plan-label {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .user-section {
    padding: 0.75rem;
    justify-content: center;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--bg-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    color: var(--accent);
    background-color: var(--accent-light);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Main Content */

.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

.top-bar {
    background-color: var(--bg-glass);
    border-bottom: 1px solid var(--bg-border);
    backdrop-filter: blur(20px) saturate(180%);
}

/* Card — Glassmorphism */

.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px) saturate(150%);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Stat Card */

.stat-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px) saturate(150%);
    transition: all 0.3s ease;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

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

/* Navigation */

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    margin: 2px 0.5rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    gap: 0.75rem;
    background: transparent;
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-link:hover {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--gradient);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99,102,241,0.30);
}

.nav-link.active svg { color: #ffffff; }

[data-theme="light"] .nav-link.active {
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

.nav-link svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-link:hover svg {
    color: var(--accent);
}

/* Form Elements */

.input-field {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-md);
    padding: 0.7rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: none;
}

[data-theme="light"] .input-field {
    background: #f8f9fc;
    border-color: #e2e8f0;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

select.input-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b6b78'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

label,
.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Buttons */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    background: var(--gradient);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

[data-theme="light"] .btn-primary {
    box-shadow: 0 2px 8px rgba(79,70,229,0.20);
}

.btn-primary:hover {
    opacity: 0.92;
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    backdrop-filter: blur(8px);
    font-family: inherit;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--danger);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    border: none;
    cursor: pointer;
}

.btn-danger:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: 1px solid var(--bg-border);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.btn-icon:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: rgba(99,102,241,0.2);
}

.btn-icon:active {
    transform: translateY(0);
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background-color: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-warning {
    background-color: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-danger {
    background-color: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.badge-info {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-critical {
    background-color: rgba(248, 113, 113, 0.20);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.badge-high {
    background-color: rgba(251, 146, 60, 0.20);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.35);
}

.badge-medium {
    background-color: rgba(251, 191, 36, 0.20);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.badge-low {
    background-color: rgba(52, 211, 153, 0.20);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.35);
}

/* Severity / Status */

.severity-critical { color: var(--danger); }
.severity-high     { color: #fb923c; }
.severity-medium   { color: var(--warning); }
.severity-low      { color: var(--success); }

.status-open        { color: var(--danger); }
.status-in_progress { color: var(--warning); }
.status-resolved    { color: var(--success); }

/* Tables */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    backdrop-filter: blur(16px);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table th {
    font-weight: 600;
    text-align: left;
    color: var(--text-muted);
    background-color: var(--bg-tertiary);
    padding: 0.875rem 1.125rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--bg-border);
}

[data-theme="light"] table th {
    background: #f1f5f9;
}

table td {
    padding: 0.875rem 1.125rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--bg-border);
    font-size: 0.875rem;
}

table tbody tr {
    transition: background-color 0.15s ease;
    background: transparent;
}

table tbody tr:hover {
    background: var(--accent-subtle);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Toast */

.toast {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    min-width: 320px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
}

.toast p { color: var(--text-primary); }

.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--info); }

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

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

/* Modal */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.50);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bg-border);
}

.modal-header h3 {
    color: var(--text-primary);
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bg-border);
}

/* Progress Bar */

.progress-bar {
    height: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
    background: var(--gradient);
}

/* Chart Container */

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

/* Dropdown */

.dropdown-item {
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Scrollbar */

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* User Avatar */

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8125rem;
}

/* Typography */

.page-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-title {
    color: var(--text-primary);
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

/* Gradient Text */

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Theme-aware utilities */

.text-primary-theme   { color: var(--text-primary); }
.text-secondary-theme { color: var(--text-secondary); }
.text-muted-theme     { color: var(--text-muted); }

.bg-primary-theme   { background-color: var(--bg-primary); }
.bg-secondary-theme { background-color: var(--bg-secondary); }
.bg-tertiary-theme  { background-color: var(--bg-tertiary); }
.bg-card-theme      { background-color: var(--bg-card); }
.bg-border-theme    { background-color: var(--bg-border); }

.border-theme { border-color: var(--bg-border); }
.divide-theme > * + * { border-color: var(--bg-border); }

/* Hover utilities */
.hover-bg-tertiary:hover  { background-color: var(--bg-tertiary); }
.hover-bg-secondary:hover { background-color: var(--bg-secondary); }
.hover-text-primary:hover { color: var(--text-primary); }

/* Modal theme-aware overrides (for inline <style> blocks in templates) */
.modal-dialog   { background: var(--bg-card); border-color: var(--bg-border); }
.modal-title    { color: var(--text-primary); }
.modal-close    { color: var(--text-muted); }
.modal-close:hover { color: var(--text-primary); }
.modal-header   { border-bottom-color: var(--bg-border); }
.modal-body     { color: var(--text-primary); }
.progress-bar-mini { background: var(--bg-tertiary); }
.dropdown-content  { background: var(--bg-card); border-color: var(--bg-border); }
.dropdown-item     { color: var(--text-secondary); }
.dropdown-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Links */

a {
    color: var(--accent);
    transition: color 0.25s ease;
}

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

/* Accessibility */

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Responsive */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content,
    .main-content.sidebar-collapsed { margin-left: 0; }
    .sidebar-toggle { display: none; }
}

@media (max-width: 768px) {
    .stat-card { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .btn-primary,
    .btn-secondary,
    .btn-danger { padding: 0.625rem 1rem; }
    .page-title { font-size: 1.5rem; }
    table th,
    table td { padding: 0.75rem; font-size: 0.8125rem; }
}

/* Print */

@media print {
    .sidebar, .top-bar, .btn-primary, .btn-secondary, .btn-danger {
        display: none !important;
    }
    .main-content { margin-left: 0 !important; }
    body { background: white !important; color: black !important; }
}
