@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary: #2d6a4f;
    --primary-light: #40916c;
    --primary-lighter: #52b788;
    --primary-bg: #f0faf4;
    --primary-border: #b7e4c7;
    --accent: #1b4332;
    --success: #2d6a4f;
    --danger: #c1121f;
    --warning: #e09f3e;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --radius: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
    --max-width: 1140px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--white);
    color: var(--gray-800);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== MAIN CONTENT ===== */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ===== CARDS ===== */

.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: box-shadow 0.2s ease;
}

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

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--gray-900);
    border-bottom: none;
    padding-bottom: 0;
    letter-spacing: -0.01em;
}

.card h2::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--primary-lighter);
    border-radius: 2px;
    margin-right: 0.65rem;
    vertical-align: text-bottom;
}

/* ===== UPLOAD SECTION ===== */

.upload-instructions {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.7;
}

.upload-instructions p strong {
    color: var(--gray-900);
}

.upload-instructions ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.upload-instructions li {
    margin-bottom: 0.3rem;
    color: var(--gray-600);
}

.upload-instructions .note {
    margin-top: 0.75rem;
    color: var(--gray-500);
    font-style: italic;
    font-size: 0.825rem;
}

.instructions-row {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.instructions-text {
    flex: 1;
}

.instructions-example {
    max-width: 384px;
    height: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    flex-shrink: 0;
}

/* ===== DROP ZONE ===== */

.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--gray-50);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-lighter);
    background: var(--primary-bg);
}

.drop-zone-content svg {
    color: var(--gray-400);
    margin-bottom: 0.75rem;
}

.drop-zone:hover .drop-zone-content svg,
.drop-zone.dragover .drop-zone-content svg {
    color: var(--primary-lighter);
}

.drop-zone-content p {
    color: var(--gray-600);
    margin-bottom: 0.35rem;
    font-size: 0.925rem;
}

.file-label {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.file-label:hover {
    border-bottom-color: var(--primary);
}

.file-types {
    font-size: 0.8rem;
    color: var(--gray-400);
}

/* ===== FILE INFO & ERRORS ===== */

.file-info {
    margin-top: 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--primary-bg);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.error {
    margin-top: 1rem;
    padding: 0.85rem 1.15rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.875rem;
}

.hidden {
    display: none !important;
}

/* ===== BUTTONS ===== */

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.25rem;
    letter-spacing: 0.01em;
    font-family: inherit;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45,106,79,0.25);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

/* ===== LOADING INDICATOR ===== */

#loading-indicator {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--gray-500);
    font-style: italic;
}

/* ===== RESULTS TABLES ===== */

.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    white-space: nowrap;
}

.metrics-table th,
.metrics-table td {
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    text-align: right;
}

.metrics-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.725rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--gray-200);
}

.metrics-table th:first-child,
.metrics-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--white);
    z-index: 2;
    font-weight: 500;
    min-width: 160px;
    color: var(--gray-800);
}

.metrics-table th:first-child {
    background: var(--gray-50);
    z-index: 3;
}

.metrics-table tbody tr {
    transition: background 0.15s ease;
}

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

.metrics-table tbody tr:hover td:first-child {
    background: #e2f5ea;
}

.metrics-table .total-row td {
    font-weight: 700;
    border-top: 2px solid var(--gray-300);
    color: var(--gray-900);
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

/* ===== CHARTS ===== */

.chart-container {
    position: relative;
    height: 350px;
    margin-bottom: 0.75rem;
}

.results-card {
    overflow: hidden;
}

/* ===== FOOTER ===== */

footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    border-top: 1px solid var(--gray-100);
    letter-spacing: 0.01em;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    main {
        padding: 1.25rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: var(--radius);
    }

    .chart-container {
        height: 250px;
    }

    #net-loss-inputs {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}
