/* ========================================
   SecRaptor - Main Stylesheet
   Design inspired by ReqForge - Modern B2B SaaS
   ======================================== */

/* ---- LIGHT THEME (default) ---- */
:root {
    /* Colors - Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Brand Colors */
    --brand-primary: #3b98c6;
    --brand-primary-hover: #2d7fa8;
    --brand-primary-light-end: #79c6f2;
    --brand-secondary: hsl(199, 60%, 48%);

    /* Status Colors */
    --status-success: #059669;
    --status-warning: #d97706;
    --status-danger: #dc2626;
    --status-info: #2563eb;

    /* Severity Colors */
    --severity-critical: #991b1b;
    --severity-high: #dc2626;
    --severity-medium: #d97706;
    --severity-low: #16a34a;

    /* Borders */
    --border-color: #cbd5e1;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.10);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --nav-height: 64px;
    --footer-height: 60px;
}

/* ---- DARK THEME ---- */
.dark {
    --bg-primary: #070a10;
    --bg-secondary: #0f1219;
    --bg-tertiary: #161b26;
    --bg-card: #161b26;
    --bg-hover: #1e2433;

    --text-primary: #e4e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --brand-primary: #2b8db0;
    --brand-primary-hover: #237a99;
    --brand-primary-light-end: #38bdf8;
    --brand-secondary: hsl(199, 50%, 55%);

    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #3b82f6;

    --severity-critical: #8b0000;
    --severity-high: #d32f2f;
    --severity-medium: #f57c00;
    --severity-low: #388e3c;

    --border-color: #1e2433;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Navigation
   ======================================== */

.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: var(--nav-height);
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary) !important;
    transition: opacity 0.2s;
}

.navbar-brand:hover {
    opacity: 0.8;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-text {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary) !important;
    background: var(--bg-hover);
}

.tenant-indicator {
    width: 8px;
    height: 8px;
    background: var(--status-success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

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

.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
    min-width: 220px;
    z-index: 1200;
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    transition: all 0.2s;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-header {
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    min-height: calc(100vh - var(--nav-height) - var(--footer-height));
    padding: 2rem 0;
}

.main-content-full {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: all 0.2s;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    font-weight: 500;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light-end, #79c6f2));
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary));
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-info {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light-end, #79c6f2));
    border: none;
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary));
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    background: transparent;
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    color: white;
}

.btn-danger {
    background: var(--status-danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

.btn-success {
    background: var(--status-success);
    color: white;
}

.btn-link {
    color: var(--brand-primary);
    text-decoration: none;
}

.btn-link:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

/* ========================================
   Forms
   ======================================== */

.form-control {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    transition: all 0.2s;
}

.form-control:focus {
    background: transparent;
    border-color: var(--brand-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.input-group-text {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    border-radius: var(--border-radius);
    border: 1px solid;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--status-success);
    color: var(--status-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--status-danger);
    color: var(--status-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--status-warning);
    color: var(--status-warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--status-info);
    color: var(--status-info);
}

.flash-messages {
    position: fixed;
    top: calc(var(--nav-height) + 1rem);
    right: 1rem;
    z-index: 1050;
    max-width: 400px;
}

/* ========================================
   Badges
   ======================================== */

.badge {
    padding: 0.375rem 0.625rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-critical {
    background: var(--severity-critical);
    color: white;
}

.badge-high {
    background: var(--severity-high);
    color: white;
}

.badge-medium {
    background: var(--severity-medium);
    color: #000;
}

.badge-low {
    background: var(--severity-low);
    color: white;
}

.badge-info {
    background: var(--status-info);
    color: white;
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: var(--status-success);
    color: white;
}

.badge-warning {
    background: var(--status-warning);
    color: white;
}

.badge-danger {
    background: var(--status-danger);
    color: white;
}

/* ========================================
   Tables
   ======================================== */

.table {
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem;
}

.table tbody td {
    border-color: var(--border-color);
    padding: 0.75rem;
}

.table tbody tr {
    transition: background 0.2s;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table-bordered {
    border-color: var(--border-color);
}

/* Bootstrap compatibility */
.thead-light th {
    background: transparent !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-secondary);
}

.table-striped tbody tr:hover {
    background: var(--bg-hover);
}

.alert-light {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.bg-light {
    background-color: transparent !important;
}

.bg-white {
    background-color: transparent !important;
}

/* ========================================
   Modal
   ======================================== */

.modal-content {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-header {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

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

.modal-body {
    background: rgba(255, 255, 255, 0.93);
    padding: 1.25rem;
}

.modal-footer {
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.modal-backdrop.show {
    opacity: 0.65;
}

.modal .form-control,
.modal .form-select,
.modal select.form-control,
.modal textarea.form-control,
.modal .input-group-text,
.modal .custom-select {
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.modal .form-control:focus,
.modal .form-select:focus,
.modal select.form-control:focus,
.modal textarea.form-control:focus {
    background: #ffffff;
}

.modal .card,
.modal .card-header,
.modal .card-body,
.modal .card-footer {
    background: rgba(248, 250, 252, 0.96);
}

.modal .alert,
.modal [role="alert"] {
    background-clip: padding-box;
}

.modal .alert-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #7a4b00;
}

.modal .alert-info {
    background: rgba(59, 130, 246, 0.18);
    color: #174ea6;
}

.modal .alert-danger {
    background: rgba(239, 68, 68, 0.18);
    color: #991b1b;
}

.modal .alert-success {
    background: rgba(16, 185, 129, 0.18);
    color: #065f46;
}

.dark .modal-content,
[data-theme="dark"] .modal-content {
    background: rgba(15, 18, 25, 0.96);
}

.dark .modal-header,
.dark .modal-footer,
.dark .modal-body,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .modal-body {
    background: rgba(15, 18, 25, 0.94);
}

.dark .modal .form-control,
.dark .modal .form-select,
.dark .modal select.form-control,
.dark .modal textarea.form-control,
.dark .modal .input-group-text,
.dark .modal .custom-select,
[data-theme="dark"] .modal .form-control,
[data-theme="dark"] .modal .form-select,
[data-theme="dark"] .modal select.form-control,
[data-theme="dark"] .modal textarea.form-control,
[data-theme="dark"] .modal .input-group-text,
[data-theme="dark"] .modal .custom-select {
    background: rgba(22, 27, 38, 0.98);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark .modal .form-control:focus,
.dark .modal .form-select:focus,
.dark .modal select.form-control:focus,
.dark .modal textarea.form-control:focus,
[data-theme="dark"] .modal .form-control:focus,
[data-theme="dark"] .modal .form-select:focus,
[data-theme="dark"] .modal select.form-control:focus,
[data-theme="dark"] .modal textarea.form-control:focus {
    background: #161b26;
}

.dark .modal .card,
.dark .modal .card-header,
.dark .modal .card-body,
.dark .modal .card-footer,
[data-theme="dark"] .modal .card,
[data-theme="dark"] .modal .card-header,
[data-theme="dark"] .modal .card-body,
[data-theme="dark"] .modal .card-footer {
    background: rgba(22, 27, 38, 0.96);
}

.dark .modal .alert-warning,
[data-theme="dark"] .modal .alert-warning {
    background: rgba(245, 158, 11, 0.24);
    color: #fcd34d;
}

.dark .modal .alert-info,
[data-theme="dark"] .modal .alert-info {
    background: rgba(59, 130, 246, 0.22);
    color: #bfdbfe;
}

.dark .modal .alert-danger,
[data-theme="dark"] .modal .alert-danger {
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
}

.dark .modal .alert-success,
[data-theme="dark"] .modal .alert-success {
    background: rgba(16, 185, 129, 0.22);
    color: #a7f3d0;
}

.close {
    color: var(--text-secondary);
    opacity: 0.6;
}

.close:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* ========================================
   Utilities
   ======================================== */

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--status-success) !important; }
.text-danger { color: var(--status-danger) !important; }
.text-warning { color: var(--status-warning) !important; }
.text-info { color: var(--status-info) !important; }

.bg-card { background: transparent !important; }
.bg-tertiary { background: transparent !important; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .flash-messages {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}
