/**
 * M5 Digital Marketing - SEO Revenue Ceiling Calculator
 * Enterprise technical SEO tool
 */

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

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

:root {
    /* M5 Digital Marketing Brand Colors */
    --primary-color: #2C5364;        /* Primary Navy */
    --primary-dark: #203A43;         /* Deep Teal */
    --secondary-color: #31708F;      /* Steel Blue */
    --background: #F8F9FA;           /* Light Grey */
    --surface: #FFFFFF;              /* Pure White */
    --text-primary: #1A1A1A;         /* Executive Black */
    --text-secondary: #666666;       /* Medium grey for secondary text */
    --border: #E5E7EB;               /* Subtle borders */
    --error: #DC2626;                /* Darker red for better contrast */
    --success: #31708F;              /* Steel Blue instead of green */
    --warning: #F59E0B;              /* Keep existing */

    /* Typography */
    --font-heading: Caros, 'Cera Pro', 'Futura PT', Futura, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* 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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* M5 Brand Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-weight: 700;
    font-size: 2.5rem;      /* 40px - reduced from 48px for tighter spacing */
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;     /* 28px - reduced from 36px for tighter spacing */
    line-height: 1.2;
}

h3 {
    font-size: 1.5rem;      /* 24px */
    line-height: 1.3;
}

h4 {
    font-size: 1.125rem;    /* 18px */
    line-height: 1.4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Header */
header {
    text-align: center;
    margin-bottom: var(--spacing-lg);  /* Reduced from 2xl for tighter spacing */
    padding: var(--spacing-lg) 0;      /* Reduced from xl for tighter spacing */
}

.brand-context {
    margin-bottom: var(--spacing-md);
}

.company-tagline {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary-color);      /* Steel Blue */
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-body);
}

header h1 {
    font-size: 3rem;                    /* 48px */
    font-weight: 700;
    color: var(--primary-color);        /* Primary Navy */
    margin-bottom: var(--spacing-sm);
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-family: var(--font-body);
}

/* Card */
.card {
    background: var(--surface);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    padding: var(--spacing-lg);         /* Reduced from xl for tighter spacing */
    margin-bottom: var(--spacing-lg);   /* Reduced from xl for tighter spacing */
    border: 1px solid var(--border);    /* M5 Brand: No shadows, use borders */
}

.card h2 {
    font-size: 2rem;                    /* 32px */
    font-weight: 600;
    color: var(--primary-color);        /* Primary Navy */
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 3px solid var(--primary-color);  /* Thicker, brand color */
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-sm);  /* Reduced from lg for tighter spacing */
}

.performance-inputs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.performance-inputs-row .form-group {
    margin-bottom: 0;
}

/* Input Method Selector */
.input-method-selector {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border);
}

.method-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.method-option input[type="radio"] {
    cursor: pointer;
    width: auto;
}

.method-option:has(input:checked) {
    color: var(--primary-color);
}

.input-section {
    margin-bottom: var(--spacing-md);
}

/* File Input Styling */
.file-input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px dashed var(--border);
    border-radius: 0;
    background: var(--background);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

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

.csv-instructions {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--background);
    border-left: 4px solid var(--secondary-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

.csv-instructions code {
    background: var(--surface);
    padding: 2px 6px;
    border: 1px solid var(--border);
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
}

.csv-instructions small {
    color: var(--text-secondary);
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    transition: all 0.2s;
    background: var(--surface);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    border-width: 2px;                  /* M5 Brand: No glow, emphasize with thicker border */
}

.form-group input:hover {
    border-color: var(--text-secondary);
}

/* Slider Styles */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60%;                         /* Reduced from 100% - more reasonable width */
    max-width: 400px;                   /* Cap maximum width */
    height: 8px;
    background: var(--border);
    outline: none;
    margin-top: var(--spacing-sm);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    transition: background 0.2s;
}

.slider:hover {
    background: var(--text-secondary);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);   /* Primary Navy */
    cursor: pointer;
    border-radius: 0;                   /* M5 Brand: Sharp edges - square thumb */
    border: 2px solid var(--surface);
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: var(--primary-dark);    /* Deep Teal */
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);   /* Primary Navy */
    cursor: pointer;
    border-radius: 0;                   /* M5 Brand: Sharp edges - square thumb */
    border: 2px solid var(--surface);
    transition: all 0.2s;
}

.slider::-moz-range-thumb:hover {
    background: var(--primary-dark);    /* Deep Teal */
    transform: scale(1.1);
}

.slider::-webkit-slider-thumb:active {
    background: var(--secondary-color); /* Steel Blue */
}

.slider::-moz-range-thumb:active {
    background: var(--secondary-color); /* Steel Blue */
}

/* Tooltip */
.tooltip {
    display: inline-block;
    margin-left: var(--spacing-xs);
    color: var(--text-secondary);
    cursor: help;
    font-size: 0.875rem;
}

.tooltip:hover {
    color: var(--primary-color);
}

/* RPV Display */
.rpv-display {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--background);              /* M5 Brand: No gradients */
    border-radius: 0;                           /* M5 Brand: Sharp edges */
    border-left: 4px solid var(--secondary-color);  /* Steel Blue accent */
    text-align: center;
}

.rpv-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-body);
    margin-bottom: var(--spacing-xs);
}

.rpv-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);                /* Primary Navy */
    font-family: var(--font-heading);
    margin: var(--spacing-sm) 0;
}

.rpv-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--surface);              /* Pure White */
    background: var(--primary-color);   /* Primary Navy */
    border: none;
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);    /* Deep Teal */
    transform: translateY(-1px);        /* Subtle lift */
}

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

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--primary-color);        /* Primary Navy text */
    background: var(--surface);         /* White background */
    border: 2px solid var(--primary-color);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--primary-color);   /* Primary Navy */
    color: var(--surface);              /* White text */
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Loader */
.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: #fee2e2;
    border: 1px solid var(--error);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border-left: 4px solid var(--error);
    color: #991b1b;
    font-size: 0.95rem;
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease-in;
}

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

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));  /* Reduced from 250px */
    gap: var(--spacing-md);              /* Reduced from lg for tighter spacing */
    margin-bottom: var(--spacing-lg);    /* Reduced from xl for tighter spacing */
}

.metric-card {
    padding: var(--spacing-md);             /* Reduced from lg for more compact cards */
    background: var(--surface);
    border-radius: 0;                       /* M5 Brand: Sharp edges */
    border: 2px solid var(--border);
    transition: all 0.2s;
    text-align: center;
}

.metric-card:hover {
    border-color: var(--secondary-color);   /* Steel Blue */
    transform: translateY(-2px);
}

.metric-card.highlight {
    background: var(--primary-color);       /* Primary Navy - no gradients */
    color: var(--surface);
    border: 2px solid var(--primary-color);
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-body);
    margin-bottom: var(--spacing-sm);
}

.metric-card.highlight .metric-label {
    color: rgba(255, 255, 255, 0.9);
}

.metric-value {
    font-size: 1.5rem;                      /* Reduced from 2rem for more compact display */
    font-weight: 700;
    color: var(--primary-color);            /* Primary Navy */
    font-family: var(--font-heading);
    margin-bottom: var(--spacing-xs);
}

.metric-card.highlight .metric-value {
    color: var(--surface);
}

.metric-description {
    font-size: 0.875rem;
    opacity: 0.7;
}

.metric-change {
    font-size: 1rem;
    font-weight: 600;
    margin-top: var(--spacing-sm);
}

/* Potential Section */
.potential-section {
    margin: var(--spacing-lg) 0;
}

/* Chart Container */
.chart-container {
    margin: var(--spacing-2xl) 0;
    padding: var(--spacing-xl);
    background: var(--surface);
    border-radius: 0;                       /* M5 Brand: Sharp edges */
    border: 1px solid var(--border);
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 500px;
}

/* Keyword Table Section */
.keyword-table-section {
    margin: var(--spacing-2xl) 0;
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-lg);
}

.keyword-table-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.table-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border: 1px solid var(--border);
    background: var(--surface);
}

.keyword-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.keyword-table thead {
    background: var(--primary-color);   /* Primary Navy - no gradients */
    color: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.keyword-table thead th {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    z-index: 10;
}

.keyword-table th {
    padding: var(--spacing-md) var(--spacing-sm);
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.keyword-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.keyword-table tbody tr:hover {
    background-color: var(--background);
}

.keyword-table tbody tr:last-child {
    border-bottom: none;
}

.keyword-table td {
    padding: var(--spacing-md) var(--spacing-sm);
    color: var(--text-primary);
}

.keyword-table td:first-child {
    font-weight: 500;
    max-width: 250px;
}

.keyword-cell {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.keyword-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.delete-keyword {
    display: none;
    cursor: pointer;
    color: #DC2626;  /* Red */
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    padding: 0 0.25rem;
    transition: all 0.2s;
    border-radius: 0;
    min-width: 20px;
    text-align: center;
}

.delete-keyword:hover {
    color: #FFFFFF;
    background: #DC2626;
}

.keyword-table tbody tr:hover .delete-keyword {
    display: inline-block;
}

.keyword-table .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.keyword-table .positive {
    color: var(--success);
    font-weight: 600;
}

.keyword-table .position-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    font-weight: 600;
    font-size: 0.85rem;
    font-family: var(--font-body);
    border: 1px solid;
}

.keyword-table .position-good {
    background: var(--secondary-color); /* Steel Blue */
    color: var(--surface);
    border-color: var(--secondary-color);
}

.keyword-table .position-medium {
    background: var(--primary-dark);    /* Deep Teal */
    color: var(--surface);
    border-color: var(--primary-dark);
}

.keyword-table .position-poor {
    background: var(--background);
    color: var(--text-primary);
    border-color: var(--border);
}

/* Methodology Section */
.methodology-section {
    margin: var(--spacing-2xl) 0;
    padding: var(--spacing-xl);
    background: var(--background);          /* M5 Brand: No gradients */
    border-radius: 0;                       /* M5 Brand: Sharp edges */
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-color);
}

.methodology-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.methodology-intro {
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto var(--spacing-2xl);
    line-height: 1.6;
}

.methodology-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.methodology-card {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border: 2px solid var(--border);
}

.methodology-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.methodology-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.methodology-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.methodology-card ul {
    margin-left: var(--spacing-lg);
    color: var(--text-secondary);
    line-height: 1.8;
}

.methodology-card li {
    margin-bottom: var(--spacing-sm);
}

.methodology-card table {
    width: 100%;
    font-size: 0.85rem;
    overflow-x: auto;
    display: block;
}

.formula-details {
    width: 100%;
}

/* Phase Timeline */
.phase-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.phase {
    display: grid;
    grid-template-columns: 100px 1fr 2fr;
    gap: var(--spacing-sm);
    align-items: center;
}

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

.phase-bar {
    height: 24px;
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    position: relative;
    overflow: hidden;
}

.phase-bar.fast {
    background: var(--secondary-color); /* Steel Blue - no gradients */
    width: 100%;
}

.phase-bar.medium {
    background: var(--primary-dark);    /* Deep Teal */
    width: 70%;
}

.phase-bar.slow {
    background: var(--primary-color);   /* Primary Navy */
    width: 40%;
}

.phase-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Formula Box */
.formula-box {
    background: var(--background);
    padding: var(--spacing-md);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border-left: 4px solid var(--primary-color);
    margin: var(--spacing-md) 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.formula-box code {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.formula-explanation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.formula-details {
    margin-top: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    padding: var(--spacing-sm);
    background: var(--surface);
}

.formula-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    padding: var(--spacing-sm);
    user-select: none;
}

.formula-details summary:hover {
    color: var(--primary-dark);
}

.example-calculation {
    padding: var(--spacing-md);
    overflow-x: auto;
}

.calculation-table {
    width: 100%;
    min-width: 500px;
    margin: var(--spacing-md) 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.calculation-table th,
.calculation-table td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.calculation-table th {
    background: var(--background);
    font-weight: 600;
}

.calculation-table .highlight-row {
    background: #d1fae5;
    font-weight: 600;
}

.conservative-note {
    background: rgba(49, 112, 143, 0.1);    /* Steel Blue tint */
    padding: var(--spacing-md);
    border-radius: 0;                       /* M5 Brand: Sharp edges */
    border-left: 4px solid var(--success);
    margin-top: var(--spacing-md);
}

/* Technical Details */
.toggle-technical-btn {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-xl) 0;
}

.toggle-technical-btn:hover {
    background: var(--primary-color);
    color: var(--surface);
}

.toggle-icon {
    transition: transform 0.3s;
}

.toggle-technical-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.technical-details {
    background: var(--surface);
    padding: var(--spacing-xl);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border: 1px solid var(--border);
    margin-top: var(--spacing-md);
}

.technical-details h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.technical-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.technical-section:last-child {
    border-bottom: none;
}

.technical-section h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.technical-section pre {
    background: var(--background);
    padding: var(--spacing-md);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border-left: 3px solid var(--primary-color);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.technical-section code {
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.rate-comparison {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
}

.rate-comparison th,
.rate-comparison td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.rate-comparison th {
    background: var(--background);
    font-weight: 600;
}

.rate-comparison .highlight-row {
    background: #dbeafe;
    font-weight: 600;
}

.sensitivity-chart {
    margin: var(--spacing-lg) 0;
    max-width: 100%;
}

.chart-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Assumptions */
.assumptions {
    margin-top: var(--spacing-2xl);
    padding: var(--spacing-lg);
    background: var(--background);
    border-radius: 0;                   /* M5 Brand: Sharp edges */
    border-left: 4px solid var(--primary-color);
}

.assumptions h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.assumptions ul {
    list-style: none;
    padding-left: 0;
}

.assumptions li {
    padding: var(--spacing-sm) 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    padding-left: var(--spacing-lg);
}

.assumptions li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.25rem;
}

/* Footer */
footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    margin-top: var(--spacing-2xl);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: var(--spacing-lg);
    }

    .performance-inputs-row {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 1.75rem;
    }

    .rpv-value {
        font-size: 2rem;
    }

    .chart-container {
        padding: var(--spacing-md);
        width: 100%;
    }

    .chart-container canvas {
        max-height: 400px;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .keyword-table {
        font-size: 0.8rem;
    }

    .keyword-table th,
    .keyword-table td {
        padding: var(--spacing-sm);
    }

    .methodology-grid {
        grid-template-columns: 1fr;
    }

    .phase {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }

    .phase-bar {
        width: 100% !important;
    }

    .methodology-icon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    .card h2 {
        font-size: 1.25rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border);
        page-break-inside: avoid;
    }

    .btn-primary,
    .error-message {
        display: none;
    }

    .chart-container {
        page-break-inside: avoid;
    }

    .keyword-table-section {
        page-break-inside: avoid;
    }

    .keyword-table {
        font-size: 0.75rem;
    }

    .keyword-table th,
    .keyword-table td {
        padding: var(--spacing-xs);
    }
}
