/* CSS Custom Properties - Professional Color System */
:root {
    /* Primary Brand Colors */
    --color-primary: #006B7D;          /* Professional Teal */
    --color-primary-light: #008B9E;    /* Light Teal */
    --color-primary-dark: #004D5A;     /* Dark Teal */
    --color-secondary: #FF6B35;        /* Alert Orange */
    --color-success: #10B981;          /* Success Green */
    
    /* Background Colors */
    --bg-primary: #F7F9FC;             /* Light Gray Background */
    --bg-card: #FFFFFF;                /* Card Background */
    --bg-header-start: #1a2332;        /* Header Gradient Start */
    --bg-header-end: #2c3e50;          /* Header Gradient End */
    
    /* Text Colors */
    --text-primary: #2D3748;           /* Charcoal */
    --text-secondary: #718096;         /* Medium Gray */
    --text-muted: #A0AEC0;             /* Light Gray */
    --text-white: #FFFFFF;             /* White */
    
    /* Border and Neutral Colors */
    --border-light: #E2E8F0;           /* Soft Gray */
    --border-medium: #CBD5E0;          /* Medium Border */
    --border-dark: #A0AEC0;            /* Dark Border */
    
    /* Damage Status Colors */
    --status-undamaged: #10B981;       /* Soft Green */
    --status-light: #F59E0B;           /* Yellow-Amber */
    --status-moderate: #FB923C;        /* Orange */
    --status-heavy: #EF4444;           /* Red */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Spacing Scale */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 1.5rem;    /* 24px */
    --space-lg: 2rem;      /* 32px */
    --space-xl: 3rem;      /* 48px */
    --space-2xl: 4rem;     /* 64px */
    
    /* Border Radius */
    --radius-sm: 0px;      /* 0px - No curves */
    --radius-md: 0px;      /* 0px - No curves */
    --radius-lg: 0px;      /* 0px - No curves */
    --radius-xl: 0px;      /* 0px - No curves */
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Sans', 'SF Mono', Monaco, monospace;
}

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

body {
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    background: var(--bg-card);
    min-height: 100vh;
    position: relative;
}

/* Header - Professional Design with Banner */
header {
    background: url('banner.png') center/cover, linear-gradient(135deg, var(--bg-header-start) 0%, var(--bg-header-end) 100%);
    color: var(--text-white);
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 35, 50, 0.7) 0%, rgba(44, 62, 80, 0.7) 100%);
    z-index: 0;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
    position: relative;
    z-index: 2;
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Tab Navigation - Modern Design */
.tab-container {
    margin-bottom: var(--space-xl);
}

.tab-nav {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease-in-out;
    position: relative;
    font-family: var(--font-primary);
}

.tab-btn:hover {
    background: rgba(0, 107, 125, 0.05);
    color: var(--color-primary);
}

.tab-btn.active {
    background: var(--color-primary);
    color: var(--text-white);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary-light);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: var(--space-xl) var(--space-lg);
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

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

/* Upload Section - Card Based Design */
.upload-section {
    background: var(--bg-primary);
    padding: var(--space-xl);
    margin: var(--space-lg) 0;
}

.upload-section h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 2rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.upload-zone {
    position: relative;
}

.upload-area {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    background: var(--bg-card);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.upload-area:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.05);
    transform: scale(1.02);
}

.upload-area p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-weight: 500;
}

.upload-btn {
    background: var(--color-primary);
    color: var(--text-white);
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
    font-family: var(--font-primary);
}

.upload-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Image Preview */
.image-preview {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.image-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.image-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.remove-btn {
    background: var(--color-secondary);
    color: var(--text-white);
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.remove-btn:hover {
    background: #E55A2B;
    transform: translateY(-1px);
}

/* Action Section */
.action-section {
    text-align: center;
    margin-top: var(--space-xl);
}

.process-btn {
    background: linear-gradient(135deg, var(--color-success), #059669);
    color: var(--text-white);
    border: none;
    padding: var(--space-md) var(--space-2xl);
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
    font-family: var(--font-primary);
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.process-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    margin-right: var(--space-sm);
}

/* Loading States */
.loading {
    text-align: center;
    margin-top: var(--space-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

/* Analysis Section */
.analysis-section h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 2rem;
}

.results-header {
    margin-bottom: var(--space-xl);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-item {
    text-align: center;
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease-in-out;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Visualization Grid - Responsive Layout */
.visualization-container-3x2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.viz-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease-in-out;
}

.viz-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.viz-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-align: center;
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--border-light);
}

.image-container {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-primary);
}

.image-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* Original Images Container */
.original-images-container {
    margin-bottom: var(--space-xl);
}

.original-images-container h3 {
    text-align: center;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
}

.original-images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.original-image-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    padding: var(--space-md);
    transition: all 0.2s ease-in-out;
}

.original-image-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.original-image-panel h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-align: center;
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--border-light);
}

/* Area Calibration Section */
.area-calibration-section {
    background: #FEF3C7;
    border: 2px solid #F59E0B;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.area-calibration-section h3 {
    color: #92400E;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.calibration-info p {
    color: #92400E;
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.calibration-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: var(--space-md);
    align-items: end;
    margin-top: var(--space-md);
}

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

.form-group label {
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group select,
.form-group input {
    padding: var(--space-sm);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font-primary);
    background: var(--bg-card);
    transition: all 0.2s ease-in-out;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 107, 125, 0.1);
}

.primary-btn {
    background: var(--color-primary);
    color: var(--text-white);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    font-family: var(--font-primary);
}

.primary-btn:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.loading-indicator {
    text-align: center;
    color: var(--color-primary);
    font-weight: 500;
    padding: var(--space-sm);
}

/* Results Table */
.results-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.results-table-container h3 {
    padding: var(--space-lg);
    margin: 0;
    background: linear-gradient(135deg, var(--bg-header-start), var(--bg-header-end));
    color: var(--text-white);
    font-weight: 600;
}

.table-controls {
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.legend {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.legend-item {
    font-size: 0.8rem;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.legend-item.undamaged { background: rgba(16, 185, 129, 0.1); color: var(--status-undamaged); }
.legend-item.light { background: rgba(245, 158, 11, 0.1); color: var(--status-light); }
.legend-item.moderate { background: rgba(251, 146, 60, 0.1); color: var(--status-moderate); }
.legend-item.heavy { background: rgba(239, 68, 68, 0.1); color: var(--status-heavy); }

.export-btn {
    background: var(--color-secondary);
    color: var(--text-white);
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
}

.export-btn:hover {
    background: #E55A2B;
    transform: translateY(-1px);
}

/* New button controls layout */
.controls-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.financial-impact-btn {
    background: var(--color-primary);
    color: var(--text-white);
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
}

.financial-impact-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.export-btn-icon {
    background: var(--color-secondary);
    color: var(--text-white);
    border: none;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

.export-btn-icon:hover {
    background: #E55A2B;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

#results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#results-table th {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 600;
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

#results-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

#results-table tbody tr:hover {
    background: rgba(0, 107, 125, 0.1);
    transform: scale(1.01);
    transition: all 0.2s ease-in-out;
}

/* Remove zebra striping - use damage status colors instead */
#results-table tbody tr.status-undamaged {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--status-undamaged);
}

#results-table tbody tr.status-light {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--status-light);
}

#results-table tbody tr.status-moderate {
    background: rgba(251, 146, 60, 0.1);
    border-left: 4px solid var(--status-moderate);
}

#results-table tbody tr.status-heavy {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--status-heavy);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-xl);
}

/* Status Classes */
.status-undamaged { background: rgba(16, 185, 129, 0.1); color: var(--status-undamaged); font-weight: 500; }
.status-light { background: rgba(245, 158, 11, 0.1); color: var(--status-light); font-weight: 500; }
.status-moderate { background: rgba(251, 146, 60, 0.1); color: var(--status-moderate); font-weight: 500; }
.status-heavy { background: rgba(239, 68, 68, 0.1); color: var(--status-heavy); font-weight: 500; }

/* Financial Section */
.financial-section h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 2rem;
}

.financial-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.form-section h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border-light);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.form-group select {
    background: var(--bg-card);
}

.parcel-selection {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-parcels, .no-segments {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Segment selection items in financial tab */
.segment-selection-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.segment-selection-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.segment-selection-item.selected {
    border-color: var(--color-primary);
    background: rgba(0, 107, 125, 0.05);
}

.segment-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.segment-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.segment-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    font-size: 0.9rem;
}

.segment-detail-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
}

.selected-segment {
    background: var(--bg-card);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.selected-segment span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Original Images Container */
.original-images-container {
    margin-top: var(--space-xl);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.original-images-container h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-lg);
    text-align: center;
}

.original-images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.original-image-panel {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}

.original-image-panel h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    font-size: 1.1rem;
}

.original-image-panel .image-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.original-image-panel canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.calculate-btn {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--text-white);
    border: none;
    padding: var(--space-md) var(--space-2xl);
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: block;
    margin: var(--space-xl) auto 0;
}

.calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Financial Results */
.financial-results {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-top: var(--space-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.financial-results h3 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.5rem;
}

.report-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.detail-section h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table td {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-table td:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.report-item {
    text-align: center;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-light);
    transition: all 0.2s ease-in-out;
}

.report-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.report-item.total-loss {
    border-color: var(--color-secondary);
    background: rgba(255, 107, 53, 0.05);
}

.report-item.crop-loss {
    border-color: var(--status-moderate);
    background: rgba(251, 146, 60, 0.05);
}

.report-item.land-loss {
    border-color: var(--status-heavy);
    background: rgba(239, 68, 68, 0.05);
}

.report-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    font-family: var(--font-mono);
}

.report-item.total-loss .report-value { color: var(--color-secondary); }
.report-item.crop-loss .report-value { color: var(--status-moderate); }
.report-item.land-loss .report-value { color: var(--status-heavy); }

.report-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-btn {
    background: var(--color-secondary);
    color: var(--text-white);
    border: none;
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: block;
    margin: 0 auto;
}

.report-btn:hover {
    background: #E55A2B;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Footer */
footer {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .upload-grid {
        grid-template-columns: 1fr;
    }
    
    .visualization-container-3x2 {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, 1fr);
    }
}

/* Tablet responsive layout */
@media (max-width: 1024px) and (min-width: 769px) {
    .visualization-container-3x2 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    
    .original-images-grid {
        grid-template-columns: 1fr;
    }
    
    .report-summary {
        grid-template-columns: 1fr;
    }
    
    .report-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    header {
        padding: var(--space-lg) var(--space-md);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tab-content {
        padding: var(--space-lg) var(--space-md);
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .calibration-controls {
        grid-template-columns: 1fr;
    }
    
    .table-controls {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }
    
    .legend {
        justify-content: center;
    }
}

/* Image Zoom Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
}

.modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--text-white);
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease-in-out;
    z-index: 1001;
}

.modal-close:hover {
    background: var(--color-secondary);
    color: var(--text-white);
    transform: scale(1.1);
}

/* Make canvas elements clickable */
canvas {
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

canvas:hover {
    opacity: 0.9;
}

/* Modal animations */
.image-modal.show {
    animation: fadeIn 0.3s ease-in-out;
}

.image-modal.hide {
    animation: fadeOut 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .tab-nav {
        flex-direction: column;
    }
    
    .tab-btn {
        padding: var(--space-sm) var(--space-md);
    }
    
    .upload-area {
        padding: var(--space-lg);
    }
    
    .image-container {
        height: 200px;
    }
}