/* --- CSS DESIGN SYSTEM --- */

:root {
    /* Color Palette */
    --primary: #0F172A; /* Navy/Slate 900 */
    --primary-light: #1E293B;
    --accent: #B45309; /* Amber 700 */
    --accent-light: #FEF3C7; /* Amber 100 */
    --background: #F8FAFC; /* Slate 50 */
    --card-bg: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    /* Severity Colors */
    --severity-high-bg: #FFE4E6; /* Rose 100 */
    --severity-high-text: #9F1239; /* Rose 800 */
    --severity-high-border: #FDA4AF;
    
    --severity-medium-bg: #FEF3C7; /* Amber 100 */
    --severity-medium-text: #92400E; /* Amber 800 */
    --severity-medium-border: #FDE68A;
    
    --severity-low-bg: #D1FAE5; /* Emerald 100 */
    --severity-low-text: #065F46; /* Emerald 800 */
    --severity-low-border: #6EE7B7;
    
    /* Category Colors */
    --cat-branding: #6366F1; /* Indigo */
    --cat-web: #06B6D4;      /* Cyan */
    --cat-ads: #8B5CF6;      /* Purple */
    --cat-crm: #F59E0B;      /* Amber */
    --cat-sales: #10B981;    /* Emerald */
    
    /* Layout Constants */
    --sidebar-width: 280px;
    --border-radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    font-weight: 700;
}

/* App Container Layout */
#app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR STYLE --- */
#app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary);
    color: #F8FAFC;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
}

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

.brand-logo {
    background-color: var(--accent);
    color: #FFFFFF;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
}

.sidebar-brand h2 {
    color: #FFFFFF;
    font-size: 1.2rem;
    line-height: 1.2;
}

.sidebar-brand p {
    color: #94A3B8;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

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

.nav-item {
    background: transparent;
    border: none;
    outline: none;
    color: #94A3B8;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: left;
    transition: var(--transition);
}

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

.nav-item.active {
    border-left: 4px solid var(--accent);
    padding-left: calc(1rem - 4px);
}

.sidebar-divider {
    height: 1px;
    background-color: var(--primary-light);
    margin: 1.5rem 0;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #64748B;
    text-align: center;
}

/* --- MAIN CONTENT STYLE --- */
#app-main {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2.5rem 3rem;
    max-width: 1200px;
    transition: var(--transition);
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-title-area h1 {
    font-size: 2rem;
    margin-bottom: 0.35rem;
    letter-spacing: -0.025em;
}

.header-title-area .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Toggle Presentation Mode Switch */
.toggle-mode-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #F1F5F9;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.toggle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.toggle-label.active {
    color: var(--primary);
}

.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CBD5E1;
    transition: .4s;
    border-radius: 24px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider-toggle {
    background-color: var(--primary);
}

input:checked + .slider-toggle:before {
    transform: translateX(20px);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
}

.btn-block {
    display: flex;
    width: 100%;
}

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

.btn-primary:hover {
    background-color: #92400E;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: #E2E8F0;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

/* Sidebar action secondary is different */
aside .btn-secondary {
    background-color: var(--primary-light);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #CBD5E1;
}

aside .btn-secondary:hover {
    background-color: #334155;
    color: #FFFFFF;
}

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

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

.btn-danger {
    background-color: transparent;
    color: #EF4444;
    border: 1px dashed rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: #EF4444;
}

/* --- DASHBOARD SECTION --- */
.dashboard-section {
    margin-bottom: 2.5rem;
    border-left: 5px solid var(--accent);
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFD 100%);
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: transparent;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-blue { background-color: #EFF6FF; color: #3B82F6; }
.icon-rose { background-color: #FFE4E6; color: #F43F5E; }
.icon-amber { background-color: #FEF3C7; color: var(--accent); }
.icon-emerald { background-color: #D1FAE5; color: #10B981; }

.stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    line-height: 1.2;
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.health-progress-wrapper {
    background-color: #F1F5F9;
    padding: 1rem;
    border-radius: 8px;
}

.health-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
}

#health-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #F43F5E 0%, #F59E0B 50%, #10B981 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-danger { color: #E11D48 !important; }
.text-warning { color: #D97706 !important; }
.text-success { color: #059669 !important; }

/* --- CARDS & GENERAL CARDS --- */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

/* --- AUDIT LISTING CARDS --- */
.audit-card {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
    overflow: hidden;
}

.severity-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
}

.severity-high { background-color: #F43F5E; }
.severity-medium { background-color: #F59E0B; }
.severity-low { background-color: #10B981; }

.audit-content-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.audit-meta-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-severity-high { background-color: var(--severity-high-bg); color: var(--severity-high-text); border: 1px solid var(--severity-high-border); }
.badge-severity-medium { background-color: var(--severity-medium-bg); color: var(--severity-medium-text); border: 1px solid var(--severity-medium-border); }
.badge-severity-low { background-color: var(--severity-low-bg); color: var(--severity-low-text); border: 1px solid var(--severity-low-border); }

.badge-category {
    background-color: #F1F5F9;
    color: var(--primary);
    border: 1px solid #E2E8F0;
}

.badge-category-branding { border-color: var(--cat-branding); color: var(--cat-branding); }
.badge-category-web { border-color: var(--cat-web); color: var(--cat-web); }
.badge-category-ads { border-color: var(--cat-ads); color: var(--cat-ads); }
.badge-category-crm { border-color: var(--cat-crm); color: var(--cat-crm); }
.badge-category-sales { border-color: var(--cat-sales); color: var(--cat-sales); }

.audit-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.audit-diagnostic-block {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.diagnostic-item {
    font-size: 0.9rem;
}

.diagnostic-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    display: block;
}

.diagnostic-val {
    color: var(--primary-light);
    white-space: pre-wrap;
}

.recommendation-val {
    background-color: #FAFBFD;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    color: var(--primary);
}

.audit-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.audit-cost-val {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary);
}

.audit-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-card-action {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
}

.btn-card-action:hover {
    background-color: #E2E8F0;
    color: var(--primary);
}

.btn-card-delete:hover {
    background-color: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

/* Image Display Area */
.audit-image-right {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: #F1F5F9;
    border: 1px solid var(--border-color);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audit-screenshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 350px;
    display: block;
    cursor: zoom-in;
    transition: var(--transition);
}

.audit-screenshot:hover {
    transform: scale(1.02);
}

.no-screenshot-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* --- MODAL DIALOG --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

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

.modal-content {
    background-color: #FFFFFF;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.btn-close {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

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

/* Forms */
form {
    padding: 1.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.col-full {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-light);
}

.required {
    color: #EF4444;
}

input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    color: var(--primary);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

textarea {
    resize: vertical;
}

/* Dropzone style */
.dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background-color: #F8FAFC;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone:hover {
    border-color: var(--accent);
    background-color: #FEFBF6;
}

.dropzone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dropzone-prompt p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.4;
}

.preview-container {
    width: 100%;
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

.btn-remove-img {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-remove-img:hover {
    background-color: #EF4444;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

/* --- MULTIPLE SCREENSHOTS PREVIEW GRID (FORM) --- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.preview-thumb-wrap {
    position: relative;
    aspect-ratio: 16/10;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
}

.preview-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: var(--transition);
}

.btn-remove-thumb:hover {
    background: #EF4444;
    transform: scale(1.1);
}

/* --- MULTI-IMAGE GALLERY (CARD) --- */
.audit-image-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-self: flex-start;
    width: 100%;
}

.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.primary-image-container {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    position: relative;
}

.primary-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition);
}

.primary-image-container:hover img {
    transform: scale(1.02);
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.thumb-item {
    aspect-ratio: 16/10;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    background-color: #F1F5F9;
    transition: var(--transition);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-item:hover, .thumb-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(180, 83, 9, 0.15);
}

.thumb-item.active {
    transform: translateY(-2px);
}

/* --- DYNAMIC CATEGORY MANAGER & COLOR PICKER --- */
.color-picker-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.color-picker-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.color-picker-item:has(input:checked) {
    border-color: #0F172A;
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.category-manager-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #F8FAFC;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.category-manager-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.category-manager-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-delete-cat {
    background: transparent;
    border: none;
    color: #EF4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-delete-cat:hover {
    background-color: #FFE4E6;
}

/* --- HORIZONTAL FILTER CHIPS (MOBILE & PRESENTATION) --- */
.category-filter-bar {
    display: none; /* Hidden by default in Editor mode on desktop */
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.category-filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    background-color: #E2E8F0;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

.filter-chip:hover, .filter-chip.active {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.filter-chip.active {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

/* Show in presentation mode */
.presentation-mode .category-filter-bar {
    display: flex;
}

/* --- PRESENTATION MODE LAYOUT --- */
.presentation-mode #app-sidebar {
    display: none;
}

.presentation-mode #app-main {
    margin-left: 0;
    max-width: 1400px;
    padding: 3rem 6rem;
}

.presentation-mode .btn-card-action {
    display: none;
}

.presentation-mode .dashboard-section {
    border-left: 8px solid var(--accent);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    margin-bottom: 2rem;
}

/* Accordion Card Structure */
.presentation-mode .audit-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #E2E8F0;
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
    gap: 0;
}

.presentation-mode .audit-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

/* Header layout within card */
.audit-card-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.audit-card-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.audit-card-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.audit-cost-summary {
    display: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    background-color: var(--accent-light);
    color: var(--accent);
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    white-space: nowrap;
}

.presentation-mode .audit-card.collapsed .audit-cost-summary {
    display: block;
}

.presentation-mode .audit-card-title {
    font-size: 1.25rem;
    margin-bottom: 0;
    transition: var(--transition);
    color: var(--primary);
}

/* Toggle Arrow */
.card-toggle-arrow {
    display: none;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 1rem;
    align-items: center;
    justify-content: center;
}

.presentation-mode .card-toggle-arrow {
    display: flex;
}

/* Body container collapses/expands */
.audit-card-body-wrapper {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    width: 100%;
    margin-top: 1.5rem;
}

.presentation-mode .audit-card.collapsed .audit-card-body-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    pointer-events: none;
}

/* Active Expanded State */
.presentation-mode .audit-card.expanded {
    padding: 2.25rem;
    cursor: default;
}

.presentation-mode .audit-card.expanded .audit-card-header-wrapper {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    cursor: pointer;
}

.presentation-mode .audit-card.expanded .audit-card-title {
    font-size: 1.55rem;
    color: var(--accent);
}

.presentation-mode .audit-card.expanded .card-toggle-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

.presentation-mode .audit-card.expanded .audit-card-body-wrapper {
    max-height: 1500px;
    opacity: 1;
}

/* Editor mode overrides */
.editor-mode .audit-card-header-wrapper {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.editor-mode .audit-card-body-wrapper {
    display: grid !important;
    max-height: none !important;
    opacity: 1 !important;
}

.editor-mode .card-toggle-arrow, 
.editor-mode .audit-cost-summary {
    display: none !important;
}

/* --- CLIENT VIEWING MODE (read-only, premium clean UI) --- */

/* Hide all editor-only elements */
.client-mode #app-sidebar,
.client-mode .header-controls,
.client-mode .audit-actions,
.client-mode .no-screenshot-placeholder span:last-child {
    display: none !important;
}

/* Category filter bar: always visible & styled in client mode */
.client-mode .category-filter-bar {
    display: flex !important;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 0;
    margin-left: -4rem;
    margin-right: -4rem;
    padding-left: 4rem;
    padding-right: 4rem;
}

.client-mode .filter-chip {
    font-size: 0.8rem;
    padding: 0.45rem 1.1rem;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: var(--text-body);
    transition: all 0.2s ease;
}

.client-mode .filter-chip:hover {
    border-color: #94A3B8;
    background: #F8FAFC;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.client-mode .filter-chip.active {
    background-color: var(--primary) !important;
    color: #FFFFFF !important;
    border-color: var(--primary) !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
}

/* Full-width centered layout — wide enough for desktop */
.client-mode #app-main {
    margin-left: 0 !important;
    max-width: 100% !important;
    margin-inline: auto;
    padding: 2.5rem 4rem;
}

/* ── HERO HEADER ── */
.client-mode .main-header {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 2.5rem;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
    border-radius: 20px;
    color: #FFFFFF;
    border-bottom: none !important;
}

.client-mode .header-title-area {
    text-align: center !important;
}

.client-mode .header-title-area h1 {
    font-size: 2rem;
    line-height: 1.3;
    color: #FFFFFF;
    margin-bottom: 0.25rem;
}

.client-mode .header-title-area .subtitle {
    font-size: 1rem;
    margin-inline: auto;
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* ── DASHBOARD ── */
.client-mode .dashboard-section {
    border-left: none;
    border-radius: 18px;
    padding: 2rem;
    background: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 2.5rem;
}

.client-mode .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 1.25rem;
}

/* Each stat card spans 2 columns = 3 per row */
.client-mode .stat-card {
    grid-column: span 2;
    background: #FFFFFF !important;
    padding: 1.1rem 0.75rem !important;
    border-radius: 14px !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.5rem !important;
}

/* Bottom row: offset cards 4 & 5 to center */
.client-mode .dashboard-grid .stat-card:nth-child(4) {
    grid-column: 2 / 4;
}

.client-mode .dashboard-grid .stat-card:nth-child(5) {
    grid-column: 4 / 6;
}

.client-mode .stat-icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 10px !important;
}

.client-mode .stat-icon svg {
    width: 20px;
    height: 20px;
}

.client-mode .stat-info {
    text-align: center;
}

.client-mode .stat-val {
    font-size: 1.4rem !important;
    white-space: nowrap;
    line-height: 1.3;
}

.client-mode .stat-desc {
    font-size: 0.73rem !important;
    line-height: 1.35;
    color: var(--text-muted);
}

/* Health bar */
.client-mode .health-progress-wrapper {
    background-color: #FFFFFF;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}

.client-mode .health-progress-bar {
    height: 10px;
    border-radius: 5px;
}

/* ── AUDIT CARDS ── */
.client-mode .audit-card {
    border-radius: 16px;
    margin-bottom: 1rem;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #E2E8F0;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.client-mode .audit-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.07);
    border-color: #CBD5E1;
}

.client-mode .audit-card.expanded {
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border-color: #94A3B8;
    padding: 1.75rem 2rem;
}

/* Header layout */
.client-mode .audit-card-header-wrapper {
    padding-bottom: 0;
}

.client-mode .audit-card-title {
    font-size: 1.2rem !important;
}

.client-mode .audit-cost-summary {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

/* Badges */
.client-mode .audit-meta-header {
    display: flex !important;
    margin-bottom: 0.5rem;
}

.client-mode .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.7rem;
}

/* Expanded body: 2-column layout */
.client-mode .audit-card-body-wrapper {
    grid-template-columns: 1.3fr 0.7fr;
    gap: 2rem;
    padding-top: 1.25rem;
}

/* Diagnostics */
.client-mode .diagnostic-label {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.client-mode .diagnostic-val {
    font-size: 0.95rem;
    line-height: 1.65;
}

.client-mode .recommendation-val {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.65;
}

/* Cost footer */
.client-mode .audit-card-footer {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #F1F5F9;
}

.client-mode .audit-cost-val {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Gallery */
.client-mode .primary-image-container {
    border-radius: 12px;
    overflow: hidden;
}

.client-mode .primary-image-container img {
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s ease;
}

.client-mode .primary-image-container img:hover {
    transform: scale(1.02);
}

.client-mode .thumbnails-grid {
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.client-mode .thumb-item img {
    border-radius: 8px;
}

/* Severity indicator slightly thicker */
.client-mode .severity-indicator {
    width: 5px;
    border-radius: 5px 0 0 5px;
}

/* ── CLIENT MODE — MOBILE RESPONSIVE ── */
@media (max-width: 768px) {

    .client-mode #app-main {
        padding: 1.25rem 1rem;
    }

    /* Stack header vertically */
    .client-mode .main-header {
        text-align: left;
    }

    .client-mode .header-title-area h1 {
        font-size: 1.25rem;
    }

    .client-mode .header-title-area .subtitle {
        font-size: 0.8rem;
        margin-inline: 0;
    }

    /* Dashboard 2x2 grid on mobile */
    .client-mode .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .client-mode .stat-card {
        grid-column: span 1 !important;
    }

    /* 5th card spans full width */
    .client-mode .dashboard-grid .stat-card:nth-child(4),
    .client-mode .dashboard-grid .stat-card:nth-child(5) {
        grid-column: span 1 !important;
    }

    .client-mode .dashboard-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .client-mode .stat-card {
        flex-direction: row;
        gap: 0.6rem;
        padding: 0.5rem;
    }

    .client-mode .stat-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 8px;
    }

    .client-mode .stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .client-mode .stat-val {
        font-size: 1.1rem;
    }

    .client-mode .stat-desc {
        font-size: 0.65rem;
        line-height: 1.3;
    }

    /* Health bar */
    .client-mode .health-progress-wrapper {
        padding: 0.65rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Accordion cards */
    .client-mode .audit-card {
        padding: 1rem !important;
        margin-bottom: 0.6rem;
        border-radius: 12px;
    }

    .client-mode .audit-card-header-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .client-mode .audit-card-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .client-mode .audit-card-title {
        font-size: 1rem !important;
        line-height: 1.35;
    }

    .client-mode .audit-cost-summary {
        font-size: 0.85rem;
    }

    .client-mode .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.55rem;
    }

    .client-mode .card-toggle-arrow svg {
        width: 16px;
        height: 16px;
    }

    /* Expanded card body stacks vertically */
    .client-mode .audit-card-body-wrapper {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Image appears first on mobile */
    .client-mode .audit-image-right {
        order: -1;
    }

    .client-mode .primary-image-container img {
        border-radius: 8px;
        max-height: 240px;
        object-fit: cover;
        width: 100%;
    }

    /* Text content */
    .client-mode .diagnostic-item {
        font-size: 0.85rem;
    }

    .client-mode .diagnostic-label {
        font-size: 0.7rem;
    }

    .client-mode .recommendation-val {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }

    /* Cost footer */
    .client-mode .audit-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .client-mode .audit-cost-val {
        font-size: 1.1rem;
    }

    /* Severity indicator thinner on mobile */
    .client-mode .severity-indicator {
        width: 4px;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 380px) {
    .client-mode #app-main {
        padding: 1rem 0.75rem;
    }

    .client-mode .header-title-area h1 {
        font-size: 1.1rem;
    }

    .client-mode .stat-val {
        font-size: 0.95rem;
    }

    .client-mode .audit-card {
        padding: 0.85rem !important;
    }

    .client-mode .audit-card-title {
        font-size: 0.9rem !important;
    }
}

/* --- LIGHTBOX MODAL --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-img {
    max-width: 85%;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    object-fit: contain;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active .lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    color: #FFFFFF;
    font-size: 2rem;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-weight: 300;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev { left: 32px; }
.lightbox-next { right: 32px; }

#lightbox-counter {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1024px) {
    .audit-card {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .audit-card-body-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    #app-sidebar {
        display: none;
    }
    
    #app-main {
        margin-left: 0;
        padding: 1.25rem 1rem;
    }
    
    .category-filter-bar {
        display: flex;
    }
    
    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    
    .stat-card {
        background-color: #FFFFFF;
        border: 1px solid var(--border-color);
        padding: 0.85rem;
        border-radius: 8px;
        box-shadow: var(--shadow);
    }
    
    .stat-icon {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }
    
    .stat-val {
        font-size: 1.2rem;
    }
    
    .stat-desc {
        font-size: 0.7rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .col-full {
        grid-column: span 1;
    }
    
    .presentation-mode #app-main {
        padding: 1.25rem 1rem;
    }
    
    .presentation-mode .audit-card {
        padding: 1.25rem !important;
        margin-bottom: 0.75rem;
    }
    
    .presentation-mode .audit-card.expanded {
        padding: 1.25rem !important;
    }
    
    .presentation-mode .audit-card.expanded .audit-card-header-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .presentation-mode .audit-card.expanded .audit-card-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .presentation-mode .audit-card-title {
        font-size: 1.15rem !important;
    }
    
    .audit-image-right {
        order: -1; /* Display gallery/screenshots before text details on mobile */
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

/* --- PRINT / PDF EXPORT MEDIA QUERY --- */
@media print {
    .no-print, 
    #app-sidebar, 
    .header-controls, 
    .audit-actions, 
    .modal, 
    .dropzone-prompt,
    .category-filter-bar,
    .card-toggle-arrow,
    .audit-cost-summary,
    button {
        display: none !important;
    }
    
    body {
        background-color: #FFFFFF !important;
        color: #000000 !important;
        font-size: 11pt;
    }
    
    #app-container {
        display: block !important;
        width: 100% !important;
    }
    
    #app-main {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .main-header {
        border-bottom: 2px solid #000000 !important;
        margin-bottom: 30px !important;
        padding-bottom: 15px !important;
    }
    
    .main-header h1 {
        font-size: 24pt !important;
    }
    
    .dashboard-section {
        border: 1px solid #CBD5E1 !important;
        border-left: 6px solid #B45309 !important;
        background: #F8FAFC !important;
        margin-bottom: 40px !important;
        page-break-inside: avoid;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }
    
    .stat-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 5px !important;
    }
    
    .stat-icon {
        display: none !important;
    }
    
    .stat-val {
        font-size: 14pt !important;
    }
    
    .health-progress-wrapper {
        background-color: #F1F5F9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .audit-card {
        border: 1px solid #94A3B8 !important;
        background-color: #FFFFFF !important;
        padding: 20px !important;
        margin-bottom: 30px !important;
        display: block !important; /* Stack columns on print */
        page-break-inside: avoid !important;
        box-shadow: none !important;
    }
    
    .audit-card-body-wrapper {
        display: grid !important;
        grid-template-columns: 1.15fr 0.85fr !important;
        gap: 20px !important;
        max-height: none !important;
        opacity: 1 !important;
    }
    
    .severity-indicator {
        width: 4px !important;
    }
    
    .audit-card-title {
        font-size: 16pt !important;
        margin-top: 0 !important;
    }
    
    .diagnostic-val, .recommendation-val {
        font-size: 10pt !important;
    }
    
    .recommendation-val {
        border-left: 2px solid #B45309 !important;
        background-color: #FAFBFD !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .audit-image-right {
        min-height: auto !important;
        background-color: #FFFFFF !important;
        border: none !important;
        display: block !important;
    }
    
    .primary-image-container {
        border: 1px solid #CBD5E1 !important;
        aspect-ratio: 16/10 !important;
    }
    
    .thumbnails-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        margin-top: 10px !important;
    }
    
    .badge {
        border: 1px solid #94A3B8 !important;
        color: #000000 !important;
        background: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
