/*
 * FILE: style.css
 * This file contains the custom styles for the Physical Penetration Test Report Generator.
 * It uses CSS variables for easy color scheme changes (currently set to Light Mode).
 */

/* --- Global Variables (for Light Mode colors) --- */
:root {
    /* Primary Colors: Clean, professional blues/grays */
    --primary-color: #007bff; /* Bootstrap Blue for main accents */
    --secondary-color: #6c757d; /* Muted Gray for secondary elements */
    --info-color: #17a2b8; /* Bootstrap Info for section headers */
    --success-color: #28a745; /* Green for compliant status */
    --danger-color: #dc3545; /* Red for non-compliant/accents */
    
    /* Backgrounds: White and off-white for brightness */
    --bg-light: #ffffff; /* Main background color (white) */
    --bg-card: #f8f9fa; /* Off-white for cards/secondary containers */
    
    /* Text & Borders */
    --text-dark: #212529; /* Dark gray for main text - ensures high contrast */
    --text-muted: #6c757d; /* Muted text */
    --border-color: #dee2e6; /* Light gray border */
    --shadow-color: rgba(0, 0, 0, 0.1); /* Subtle shadow for elevation */
}

/* --- Base Layout Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-card);
    color: var(--text-dark);
    /* Ensure enough space for the fixed header */
    padding-top: 100px; 
    padding-bottom: 40px;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Fix for View Overlap (CRITICAL) --- */
.hidden-view {
    display: none !important;
}

/* --- Header & Navigation --- */
.header-bar {
    background-color: var(--bg-light) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 0.125rem 0.25rem var(--shadow-color);
}

.logo-text {
    font-weight: 700;
    color: var(--primary-color);
}

.navbar-text strong {
    font-weight: bold;
    color: var(--primary-color);
}

/* --- Dashboard & Card Styles --- */
.card {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 0.125rem 0.25rem var(--shadow-color);
}

.card-header {
    font-weight: 600;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

/* --- Inspection Form Styles (Custom Button Logic) */
.btn-choice {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    margin: 2px 0;
    transition: all 0.2s;
    flex-grow: 1; 
}

/* Custom button states for better visual feedback */
.btn-choice.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}
.btn-choice.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

.btn-choice.btn-outline-success:hover {
    color: #fff;
    background-color: var(--success-color); 
    border-color: var(--success-color);
}

.btn-choice.btn-outline-danger:hover {
    color: #fff;
    background-color: var(--danger-color); 
    border-color: var(--danger-color);
}

/* Styling for the non-compliant observation image preview */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* --- Report View Styles --- */
.report-header {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 2rem;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 0;
}

.report-summary-card {
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Styling for badges in the report summary */
.report-badge {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

/* List group in the report for checklist items */
.list-group-item {
    /* *** FINAL OVERLAP FIX: REMOVE FLEXBOX FOR STACKING RELIABILITY *** */
    display: block !important; /* Force block stacking */
    /* Removed justify-content, align-items, flex-wrap */
    border-color: var(--border-color);
    overflow: auto !important; /* Forces container to wrap internal content */
    min-height: calc(100% + 50px) !important; /* Retained aggressive height protection */
    padding-bottom: 50px !important; /* Retained aggressive bottom padding */
}

/* Now, we explicitly handle the layout of the text and status inside the list item */
.list-group-item > div:first-child {
    width: 70%; /* Give question room */
    float: left; /* Use floats to put them side-by-side */
    font-weight: 500;
    display: block !important;
}

.list-group-item > div:last-child {
    width: 30%; /* Status text */
    float: right;
    text-align: right;
    display: block !important;
}

/* --- ENHANCEMENT: Report Item Image Size and Layout (On-Screen View) --- */
.list-group-item img {
    /* Layout Adjustments */
    /* flex-basis removed as parent is no longer flex */
    width: auto !important; 
    height: auto;
    display: block !important; /* Force block */
    position: relative !important; /* Force relative positioning */
    
    /* Centering and Spacing (CRITICAL OVERLAP FIX) */
    clear: both !important; /* THIS is now the definitive tool for separation */
    /* AGGRESSIVE MARGIN: top: 40px, right/left: auto (centered), bottom: 30px */
    margin: 40px auto 30px auto !important; 
    
    /* Size Adjustments */
    max-width: 350px !important; 
    max-height: 350px !important; 
}

/* --- User Management List --- */
#userListTable tbody td {
    vertical-align: middle;
}

/* --- Responsive Adjustments (Mobile) --- */
@media (max-width: 768px) {
    body {
        padding-top: 80px; 
    }
    
    .navbar-brand {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .question-group .btn-group {
        flex-wrap: wrap; 
        width: 100%;
    }
    
    .btn-choice {
        min-width: 48%; 
        font-size: 0.85rem;
        margin: 2px 1%;
    }
    
    /* In mobile, force text and status to stack using block display and full width */
    .list-group-item > div {
        width: 100% !important; 
        float: none !important; 
        text-align: left !important;
    }
    
    .list-group-item > div:last-child {
        margin-top: 0.25rem;
        font-size: 0.9rem;
    }
}


/* --- PDF Print Styles --- */
@media print {
    /* Hide non-report elements */
    .header-bar,
    .btn,
    #reportActionButtons,
    #dashboardView,
    #inspectionView,
    #userManagementView,
    .modal-backdrop,
    .modal {
        display: none !important;
    }

    /* Ensure the report view is displayed and uses maximum width */
    #reportView {
        display: block !important;
        width: 100% !important;
        background-color: #ffffff !important;
        color: #000 !important;
        margin: 0;
        padding: 0;
    }
    
    body {
        font-size: 10pt;
        color: #000;
        background-color: #fff !important;
        padding-top: 0;
    }

    /* Force background colors to print for professional report look */
    .report-header {
        background-color: #333 !important; 
        color: #fff !important;
        border-bottom: 2px solid #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Ensure other colors default to black or a strong shade */
    .text-primary, .text-info {
        color: #000 !important;
    }

    /* Avoid page breaks inside checklist items */
    .list-group-item, .card {
        page-break-inside: avoid;
    }
    
    /* AGGRESSIVE FIX FOR PRINT OVERLAP */
    .list-group-item {
        overflow: auto !important; 
        padding-bottom: 40px !important; 
    }
    
    /* Layout adjustments for print */
    .list-group-item img {
        display: block; 
        clear: both; 
        position: relative; 
        margin: 30px auto 15px auto; 
        max-width: 350px; 
        max-height: 350px; 
    }
}