/*
 * Djini Dashboard — Light Enterprise Design System
 * White surfaces, hairline gray borders, one restrained blue accent.
 * Red/orange/amber are reserved for severity and destructive states.
 */

:root {
    color-scheme: light;
    --background: #ffffff;
    --foreground: #111827;
    --card: #ffffff;
    --card-foreground: #111827;
    --border: #e5e7eb;
    --border-subtle: #f3f4f6;
    --input: #d1d5db;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-foreground: #ffffff;
    --secondary: #f3f4f6;
    --secondary-foreground: #374151;
    --muted: #f9fafb;
    --muted-foreground: #6b7280;
    --accent: #eff6ff;
    --accent-foreground: #1d4ed8;
    --sidebar: #f9fafb;
    --severity-critical: #dc2626;
    --severity-high: #ea580c;
    --severity-medium: #d97706;
    --severity-low: #2563eb;
    --severity-info: #6b7280;
    --success: #16a34a;
}

* {
    border-color: var(--border);
}

/* Mask password text without using type="password" (avoids pw-manager save prompts) */
.password-mask {
    -webkit-text-security: disc;
}

body {
    background: var(--background);
    color: var(--foreground);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------------------------------------ */
/* Surfaces                                                            */
/* ------------------------------------------------------------------ */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.main-content {
    background: var(--background);
}

.metric-card {
    border-radius: 8px;
}

.chart-container {
    border-radius: 8px;
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    background: #1e40af;
}

.btn-secondary {
    background: #ffffff;
    color: var(--secondary-foreground);
    border: 1px solid var(--input);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
    background: var(--muted);
    border-color: #9ca3af;
}

/* ------------------------------------------------------------------ */
/* Sidebar                                                             */
/* ------------------------------------------------------------------ */

.sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--border);
}

.nav-item {
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 1px 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
    background: #f3f4f6;
    color: var(--foreground);
}

.nav-item.active {
    background: var(--accent);
    color: var(--accent-foreground);
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-header {
    background: var(--muted);
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}

.table-row {
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.15s ease;
}

.table-row:hover {
    background: var(--muted);
}

/* Table sorting */
.sortable-header {
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sortable-header:hover {
    background-color: var(--muted);
    color: var(--foreground);
}

.sortable-header.sorted {
    color: var(--primary);
}

.sort-icon {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.sortable-header:hover .sort-icon,
.sortable-header.sorted .sort-icon {
    opacity: 1;
}

.sortable-header.sorted .sort-icon {
    color: var(--primary);
}

/* ------------------------------------------------------------------ */
/* Severity & status (the only place strong color is allowed)          */
/* ------------------------------------------------------------------ */

.vulnerability-critical {
    color: var(--severity-critical) !important;
}

.vulnerability-high {
    color: var(--severity-high) !important;
}

.vulnerability-medium {
    color: var(--severity-medium) !important;
}

.vulnerability-low {
    color: var(--severity-low) !important;
}

.vuln-bg-critical {
    background: #fef2f2 !important;
}

.vuln-bg-high {
    background: #fff7ed !important;
}

.vuln-bg-medium {
    background: #fffbeb !important;
}

.vuln-bg-low {
    background: #eff6ff !important;
}

.status-completed {
    color: var(--success);
}

.status-in-progress {
    color: var(--primary);
}

.status-failed {
    color: var(--severity-critical);
}

/* ------------------------------------------------------------------ */
/* Header icons                                                        */
/* ------------------------------------------------------------------ */

.lucide-bell {
    color: #6b7280 !important;
}

/* ------------------------------------------------------------------ */
/* Forms (legacy pages still on dark surfaces keep their own styles)   */
/* ------------------------------------------------------------------ */

/* Search input styling for Scans and Users pages */
input[placeholder*="Search"] {
    color: #111827 !important;
}

.input-field input[type="text"] {
    background-color: #ffffff !important;
    color: #111827 !important;
    border-bottom: 1px solid var(--input) !important;
}

.input-field input[type="text"]:focus {
    background-color: #ffffff !important;
    border-bottom: 2px solid var(--primary) !important;
    box-shadow: 0 1px 0 0 var(--primary) !important;
}

.input-field label {
    color: var(--muted-foreground) !important;
}

.input-field label.active {
    color: var(--primary) !important;
}

.search-wrapper .input-field {
    margin-bottom: 0;
}

.search-wrapper .material-icons.prefix,
.search-wrapper .material-icons.suffix {
    color: #9ca3af !important;
}

.search-wrapper .material-icons.prefix:hover,
.search-wrapper .material-icons.suffix:hover {
    color: var(--primary) !important;
}

/* Ensure markdown lists render bullets/numbers inside prose containers */
.prose ul { list-style: disc; padding-left: 1.25rem; }
.prose ol { list-style: decimal; padding-left: 1.25rem; }
.prose li { margin: 0.25rem 0; }
.prose img {
    max-width: 30%;
    height: auto;
    display: block;
    margin-top: 0.5rem;
}

/* ------------------------------------------------------------------ */
/* Scrollbars                                                          */
/* ------------------------------------------------------------------ */

#chatMessages::-webkit-scrollbar {
    width: 8px;
}

#chatMessages::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Firefox scrollbar styling */
#chatMessages {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db var(--muted);
}

/* ------------------------------------------------------------------ */
/* Motion (kept minimal — enterprise UI should feel instant)           */
/* ------------------------------------------------------------------ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.25s ease-out;
}

/* ------------------------------------------------------------------ */
/* Pagination (override leftover Materialize styles)                   */
/* ------------------------------------------------------------------ */

.pagination-wrapper ul.pagination li.active,
ul.pagination li.active,
.pagination li.active {
    background-color: var(--primary) !important;
}

.pagination-wrapper ul.pagination li.active a,
ul.pagination li.active a,
.pagination li.active a {
    color: #ffffff !important;
    background-color: var(--primary) !important;
}

.pagination-wrapper ul.pagination li.waves-effect a,
ul.pagination li.waves-effect a,
.pagination li.waves-effect a {
    color: var(--primary) !important;
}

.pagination-wrapper ul.pagination li.waves-effect:hover,
ul.pagination li.waves-effect:hover,
.pagination li.waves-effect:hover {
    background-color: var(--accent) !important;
}

.pagination-wrapper ul.pagination li.waves-effect:hover a,
ul.pagination li.waves-effect:hover a,
.pagination li.waves-effect:hover a {
    color: var(--accent-foreground) !important;
}

.pagination-wrapper ul.pagination li a,
ul.pagination li a,
.pagination li a {
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

.pagination li[style*="background"] {
    background-color: var(--primary) !important;
}

.pagination li.active[style*="background"] {
    background-color: var(--primary) !important;
}

/* ------------------------------------------------------------------ */
/* Sidebar collapsed state                                             */
/* ------------------------------------------------------------------ */

html.sidebar-collapsed #sidebar {
    width: 5rem !important; /* w-20 */
    padding: 1rem 0.5rem !important;
}

html.sidebar-collapsed .sidebar-text {
    opacity: 0 !important;
    width: 0 !important;
    margin-left: 0 !important;
    pointer-events: none;
}

html.sidebar-collapsed .nav-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

html.sidebar-collapsed #sidebar-footer {
    justify-content: center !important;
}

/* Workspace container adjustment */
@media (min-width: 768px) {
    html.sidebar-collapsed #workspace-container {
        left: 5rem !important; /* left-20 */
    }
}
