/* ==========================================================================
   EquiLog Global Styles & CSS Variables
   ========================================================================== */

:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --card-bg: rgba(17, 24, 39, 0.55);
    --card-border: rgba(255, 255, 255, 0.06);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    /* Harmonious Curated Colors */
    --accent-violet: #8b5cf6;
    --accent-violet-glow: rgba(139, 92, 246, 0.3);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.3);
    
    /* State Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.4);
    
    /* Fonts */
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Glowing Blurs */
.bg-blur-1 {
    position: absolute;
    width: 500px;
    height: 500px;
    top: -150px;
    right: -100px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

.bg-blur-2 {
    position: absolute;
    width: 600px;
    height: 600px;
    bottom: -150px;
    left: -150px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

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

/* ==========================================================================
   Sidebar Navigation Component
   ========================================================================== */

.sidebar {
    width: 280px;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.brand-icon {
    font-size: 1.8rem;
    color: var(--accent-violet);
    filter: drop-shadow(0 0 10px var(--accent-violet-glow));
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.badge-secure {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border-left: 3px solid var(--accent-violet);
}

.sidebar-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
}

.sidebar-footer .ip-domain {
    color: var(--accent-blue);
    font-weight: 600;
    margin-top: 2px;
}

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

.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1300px;
    margin: 0 auto;
    width: calc(100% - 280px);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.5rem;
}

.top-bar h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
}

/* Glassmorphism Card Style */
.card-blur {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: var(--transition-smooth);
}

.card-blur:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: var(--font-primary);
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-violet) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 15px var(--accent-violet-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* ==========================================================================
   Dashboard Tab Components
   ========================================================================== */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-violet {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-violet);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.icon-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.quick-record-card h3 {
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
}

.quick-record-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ==========================================================================
   Incident Recording Components
   ========================================================================== */

.recording-flow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .recording-flow {
        grid-template-columns: 1fr;
    }
}

.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.voice-widget {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.wave-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 60px;
    width: 100%;
}

.wave-bar {
    width: 6px;
    height: 10px;
    background: var(--text-secondary);
    border-radius: 3px;
    transition: all 0.15s ease;
}

/* Visualizer pulse animation when recording */
.wave-visualizer.active .wave-bar {
    background: var(--accent-violet);
    animation: wavePulse 1.2s infinite ease-in-out;
}

.wave-visualizer.active .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-visualizer.active .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-visualizer.active .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-visualizer.active .wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-visualizer.active .wave-bar:nth-child(6) { animation-delay: 0.5s; }
.wave-visualizer.active .wave-bar:nth-child(7) { animation-delay: 0.6s; }
.wave-visualizer.active .wave-bar:nth-child(8) { animation-delay: 0.7s; }

@keyframes wavePulse {
    0%, 100% { height: 10px; }
    50% { height: 50px; }
}

.visualizer-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.visualizer-text.active {
    color: var(--color-danger);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.recording-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.btn-record {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 4px 15px var(--color-danger-glow);
}

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

.btn-record:disabled {
    background: rgba(239, 68, 68, 0.4);
    cursor: not-allowed;
    transform: none;
}

.btn-stop {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-stop:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-stop:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.divider {
    text-align: center;
    position: relative;
    margin: 0.5rem 0;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--card-border);
    z-index: 1;
}

.divider span {
    background: var(--bg-secondary);
    padding: 0 10px;
    position: relative;
    z-index: 2;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.audio-file-upload {
    width: 100%;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.01);
}

.file-upload-label:hover {
    border-color: var(--accent-violet);
    background: rgba(139, 92, 246, 0.03);
}

.file-upload-label i {
    font-size: 1.8rem;
    color: var(--text-secondary);
}

.file-upload-label input {
    display: none;
}

.file-name-preview {
    font-size: 0.8rem;
    color: var(--accent-blue);
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Transcript Form & Inputs */
.transcript-editor form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
}

.transcript-editor textarea {
    width: 100%;
    height: 200px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    transition: var(--transition-smooth);
}

.transcript-editor textarea:focus {
    outline: none;
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 2px var(--accent-violet-glow);
}

.notes-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.notes-field input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.notes-field input:focus {
    outline: none;
    border-color: var(--accent-violet);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: auto;
}

/* ==========================================================================
   Table & Analysis Layouts
   ========================================================================== */

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.15);
}

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

.data-table th, .data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

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

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2.5rem !important;
    font-style: italic;
}

.severity-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.severity-low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.severity-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.severity-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Comparator Ledger Tab Styles
   ========================================================================== */

.ledger-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ledger-inputs form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ledger-inputs select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    outline: none;
    cursor: pointer;
}

.ledger-grid-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.ledger-grid-inputs textarea {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    resize: none;
    line-height: 1.5;
}

.ledger-grid-inputs textarea:focus {
    outline: none;
    border-color: var(--accent-violet);
}

/* ==========================================================================
   Evidence Timeline & Records
   ========================================================================== */

.timeline-records {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.record-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.record-date-badge {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 1.05rem;
}

.record-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.record-transcript {
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.95rem;
    background: rgba(0,0,0,0.1);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-violet);
}

.record-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
}

.record-audio {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.record-audio audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
}

/* Sub-table within Timeline Log for Violations */
.record-violations-box {
    margin-top: 1rem;
}

.record-violations-box h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Overlay Panels
   ========================================================================== */

.analysis-results {
    margin-top: 2rem;
    border-color: var(--accent-violet);
    animation: fadeIn 0.4s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.results-header h3 {
    font-family: var(--font-heading);
    color: var(--accent-violet);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tab Management */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ==========================================================================
   Print / PDF Export Configuration
   ========================================================================== */

.only-print {
    display: none;
}

@media print {
    /* Hide all UI layout elements */
    .no-print, .sidebar, .top-bar, .form-actions, .ledger-inputs, .recording-controls, .transcript-editor, .btn, aside, header, form {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .app-container {
        display: block;
    }
    
    .main-content {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Reveal print-only elements */
    .only-print {
        display: block !important;
    }
    
    /* Format formal print header */
    .print-header {
        border-bottom: 3px double #000;
        padding-bottom: 15px;
        margin-bottom: 30px;
    }
    
    .print-brand h2 {
        font-family: var(--font-heading);
        font-size: 18pt;
        font-weight: 700;
        color: black;
    }
    
    .print-brand p {
        font-size: 10pt;
        font-weight: 600;
        letter-spacing: 1px;
        margin-top: 5px;
    }
    
    .print-meta {
        display: flex;
        justify-content: space-between;
        margin-top: 15px;
        font-size: 10pt;
        border-top: 1px solid #ccc;
        padding-top: 8px;
    }
    
    /* Ensure all tabs are visible in sequential order for printing */
    .tab-pane {
        display: block !important;
        page-break-after: always;
        margin-bottom: 30px;
    }
    
    /* Format Tables for Print */
    .table-container {
        border: 1px solid #000 !important;
        background: transparent !important;
    }
    
    .data-table {
        font-size: 10pt;
    }
    
    .data-table th, .data-table td {
        border-bottom: 1px solid #000 !important;
        color: black !important;
        padding: 8px 12px;
    }
    
    .data-table th {
        background: #f0f0f0 !important;
    }
    
    /* Format timeline cards for printing */
    .record-card {
        border: 1px solid #000;
        padding: 15px;
        margin-bottom: 20px;
        page-break-inside: avoid;
        background: transparent !important;
        box-shadow: none !important;
    }
    
    .record-header {
        border-bottom: 1px solid #000;
    }
    
    .record-date-badge {
        color: black !important;
    }
    
    .record-transcript {
        border-left: 3px solid #000;
        background: #f9f9f9 !important;
        color: black !important;
    }
    
    .severity-badge {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: black !important;
    }
}
