:root {
    /* Modern color palette */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #dc2626;
    --secondary-dark: #b91c1c;
    
    --success: #16a34a;
    --warning: #ea580c;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --white: #ffffff;
    --black: #000000;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 3rem 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.4;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    opacity: 0.95;
    font-weight: 400;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Calculator Section */
.calculator-section {
    margin-bottom: 3rem;
}

.calculator-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    padding: 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    color: var(--gray-900);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin: 0;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 0.25rem;
}

.unit-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.unit-btn:hover {
    color: var(--gray-900);
}

.unit-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Calculator Body */
.calculator-body {
    padding: 2rem;
}

.form-section {
    margin-bottom: 1.75rem;
}

.section-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

/* Input Styles */
.input-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--gray-900);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

.input-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-field {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1.125rem;
    color: var(--gray-900);
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-unit {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.95rem;
    min-width: 2rem;
}

/* Quick Distance Buttons */
.quick-distances {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.quick-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--gray-50);
}

.quick-btn:active {
    transform: scale(0.98);
}

/* Time Inputs */
.time-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-input-group input {
    padding: 0.875rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1.125rem;
    text-align: center;
    color: var(--gray-900);
    transition: var(--transition);
}

.time-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.time-input-group label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    text-align: center;
}

/* Pace Inputs */
.pace-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.pace-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pace-input-group input {
    padding: 0.875rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1.125rem;
    text-align: center;
    color: var(--gray-900);
    transition: var(--transition);
}

.pace-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pace-input-group label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    text-align: center;
}

.pace-unit {
    font-weight: 600;
    color: var(--gray-600);
    padding-bottom: 0.875rem;
    font-size: 0.95rem;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results */
.results {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-200);
}

.results.hidden {
    display: none;
}

.results-title {
    color: var(--gray-900);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    text-align: center;
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Splits Section */
.splits-section {
    margin-top: 2rem;
}

.splits-section h4 {
    color: var(--gray-900);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Pace Table Section */
.pace-table-section {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
}

.pace-table-section h2 {
    color: var(--gray-900);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.section-intro {
    color: var(--gray-600);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.table-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.table-toggle-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.table-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.table-toggle-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pace-reference-table {
    font-size: 0.9rem;
}

.pace-reference-table.hidden {
    display: none;
}

.pace-reference-table th {
    font-size: 0.8rem;
}

.pace-reference-table td:first-child {
    font-weight: 600;
    color: var(--gray-900);
}

/* Content Section */
.content-section {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
}

.content-section h2 {
    color: var(--gray-900);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section h3 {
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.content-section p {
    color: var(--gray-700);
    font-size: 1.0625rem;
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.content-section ul {
    margin: 1.25rem 0;
    padding-left: 0;
    list-style: none;
}

.content-section li {
    color: var(--gray-700);
    font-size: 1.0625rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
    padding-left: 2rem;
    position: relative;
}

.content-section li::before {
    content: '→';
    position: absolute;
    left: 0.5rem;
    color: var(--primary);
    font-weight: 700;
}

.content-section strong {
    color: var(--gray-900);
    font-weight: 600;
}

/* FAQ Section */
.faq-section {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
}

.faq-section h2 {
    color: var(--gray-900);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 2rem;
}

.faq-grid {
    display: grid;
    gap: 1rem;
}

.faq-item {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--white);
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-item[open] {
    border-color: var(--primary);
    background: var(--gray-50);
}

.faq-item summary {
    font-weight: 600;
    color: var(--gray-900);
    cursor: pointer;
    font-size: 1.125rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
    transition: var(--transition);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    margin-top: 1rem;
    color: var(--gray-700);
    line-height: 1.7;
}

/* Footer */
footer {
    background: var(--gray-900);
    color: var(--white);
    padding: 2.5rem 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .time-inputs,
    .pace-inputs {
        grid-template-columns: 1fr;
    }
    
    .pace-unit {
        padding-bottom: 0;
        padding-top: 0.5rem;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .quick-distances {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}