/* style.css */
/* Modern Light Professional Theme for QA Findings & Compliance Tracker */

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    --border-color: #e2e8f0;
    
    /* Severity Colors */
    --sev-critical: #e11d48;
    --sev-critical-bg: #fff1f2;
    --sev-high: #ea580c;
    --sev-high-bg: #fff7ed;
    --sev-medium: #d97706;
    --sev-medium-bg: #fef3c7;
    --sev-low: #2563eb;
    --sev-low-bg: #eff6ff;
    
    /* Status Colors */
    --status-open: #4f46e5;
    --status-open-bg: #e0e7ff;
    --status-ext: #d97706;
    --status-ext-bg: #fef3c7;
    --status-mitigated: #059669;
    --status-mitigated-bg: #d1fae5;
    --status-closed: #64748b;
    --status-closed-bg: #f1f5f9;
    --status-overdue: #dc2626;
    --status-overdue-bg: #fee2e2;

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary);
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    font-size: 16px;
}

/* Time Machine Sidebar Widget */
.time-machine-widget {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: auto;
    font-size: 13px;
}

.tm-title {
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.tm-date-display {
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    color: var(--primary);
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.tm-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.btn-tm {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-tm:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-tm-primary {
    grid-column: span 2;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    font-weight: 600;
}

.btn-tm-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 280px;
    padding: 40px;
    background-color: var(--bg-primary);
    min-width: 0; /* Prevent flex blowout */
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.role-switcher-container {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    gap: 8px;
}

.role-switcher-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.role-select {
    border: none;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
    background: transparent;
    cursor: pointer;
    outline: none;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--primary-light);
    border-radius: var(--radius-md);
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}

/* Banners */
.overdue-banner {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-left: 5px solid var(--status-overdue);
    color: #991b1b;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.overdue-banner-text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.overdue-banner-text i {
    font-size: 20px;
    color: var(--status-overdue);
}

.overdue-banner-action {
    background-color: #ffffff;
    color: #991b1b;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #fca5a5;
    transition: all 0.2s;
}

.overdue-banner-action:hover {
    background-color: #fee2e2;
}

/* Dashboard Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--border-color);
}

.stat-card.stat-total::before { background-color: var(--primary); }
.stat-card.stat-open::before { background-color: var(--status-open); }
.stat-card.stat-pending::before { background-color: var(--status-ext); }
.stat-card.stat-mitigated::before { background-color: var(--status-mitigated); }
.stat-card.stat-closed::before { background-color: var(--status-closed); }
.stat-card.stat-overdue::before { background-color: var(--status-overdue); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Analytics Row */
.analytics-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* Section Box */
.section-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 32px;
}

.section-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

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

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

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--status-overdue);
    color: #ffffff;
}

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

.btn-success {
    background-color: var(--status-mitigated);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #047857;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    background-color: var(--bg-primary);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-sev-critical { background-color: var(--sev-critical-bg); color: var(--sev-critical); border: 1px solid #fecdd3; }
.badge-sev-high { background-color: var(--sev-high-bg); color: var(--sev-high); border: 1px solid #ffedd5; }
.badge-sev-medium { background-color: var(--sev-medium-bg); color: var(--sev-medium); border: 1px solid #fef3c7; }
.badge-sev-low { background-color: var(--sev-low-bg); color: var(--sev-low); border: 1px solid #dbeafe; }

.badge-status-open { background-color: var(--status-open-bg); color: var(--status-open); }
.badge-status-extension { background-color: var(--status-ext-bg); color: var(--status-ext); }
.badge-status-mitigated { background-color: var(--status-mitigated-bg); color: var(--status-mitigated); }
.badge-status-closed { background-color: var(--status-closed-bg); color: var(--status-closed); }
.badge-status-overdue { background-color: var(--status-overdue-bg); color: var(--status-overdue); }

/* Timeline UI (Deadline History display as lines) */
.timeline {
    position: relative;
    padding-left: 24px;
    margin: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 7px;
    width: 2px;
    height: calc(100% - 24px);
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-dot {
    position: absolute;
    left: -23px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 3px solid var(--primary);
    z-index: 2;
}

.timeline-content {
    background-color: var(--bg-tertiary);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.timeline-date {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
}

.timeline-body {
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.timeline-dates-compare {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 12px;
    background-color: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    width: fit-content;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.timeline-arrow {
    color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 600px;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    background-color: #ffffff;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Notification Logs Specific Layout */
.notification-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.notification-subject {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.notification-body-preview {
    font-size: 13px;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-top: 8px;
    overflow-x: auto;
}

/* View Switch Tabs */
.view-tabs-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 4px;
}

.view-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

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

.view-tab.active {
    border-bottom-color: var(--primary);
}

/* Custom Activity Log Widget */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.activity-icon-container {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.activity-item.finding_created .activity-icon-container { background-color: var(--primary-light); color: var(--primary); }
.activity-item.extension_approved .activity-icon-container { background-color: var(--status-ext-bg); color: var(--status-ext); }
.activity-item.mitigation_submitted .activity-icon-container { background-color: var(--status-mitigated-bg); color: var(--status-mitigated); }

.activity-details {
    display: flex;
    flex-direction: column;
}

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

.activity-text strong {
    font-weight: 600;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Finding Details Modal layout */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-full-width {
    grid-column: span 2;
}

.detail-section-title {
    font-weight: 700;
    font-size: 14px;
    margin: 20px 0 10px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    color: var(--text-primary);
}

/* Toast Message */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background-color: var(--text-primary);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(100px);
    opacity: 0;
    animation: slideInUp 0.3s forwards;
}

.toast.toast-success { background-color: var(--status-mitigated); }
.toast.toast-error { background-color: var(--status-overdue); }

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 24px 8px;
        align-items: center;
    }
    
    .logo-text, .nav-item span, .time-machine-widget {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .analytics-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .user-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-full-width {
        grid-column: span 1;
    }
}

/* Auth Screen Styling */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    padding: 20px;
}
.auth-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
    padding: 32px;
}
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}
.alert-danger {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #b91c1c;
}
.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #dcfce7;
    color: #15803d;
}
