/* 
   Modern Marathon Pace Calculator 
   Theme: Professional Utility (Slate/Blue/Teal)
*/

:root {
    /* Color System */
    --primary: #0F172A;
    /* Slate 900 */
    --primary-light: #334155;
    /* Slate 700 */
    --accent: #2563EB;
    /* Blue 600 */
    --accent-hover: #1D4ED8;
    /* Blue 700 */
    --success: #10B981;
    /* Emerald 500 */

    --bg-page: #F8FAFC;
    /* Slate 50 */
    --bg-card: #FFFFFF;
    --bg-input: #F1F5F9;
    /* Slate 100 */

    --text-main: #1E293B;
    /* Slate 800 */
    --text-muted: #64748B;
    /* Slate 500 */
    --text-light: #94A3B8;
    /* Slate 400 */
    --text-white: #FFFFFF;

    --border-color: #E2E8F0;
    /* Slate 200 */

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    /* Soft drop shadow */
    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utility Utilities */
button,
input {
    font-family: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-icon {
    color: var(--accent);
    font-size: 1.5rem;
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Main Layout */
.main-content {
    flex: 1;
    padding: 40px 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 50px;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Calculator Grid */
.calc-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    /* Fixed sidebar-ish + Fluid content */
    gap: 30px;
    align-items: start;
}

/* Sections */
.calc-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.section-header {
    padding: 20px 25px;
    background: linear-gradient(to right, #f8fafc, #fff);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--accent);
    opacity: 0.8;
}

/* Control Groups (Inputs) */
.input-section {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Distance Switcher */
.distance-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.distance-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    background: var(--bg-input);
}

.distance-card:hover {
    border-color: var(--accent);
    background: #EFF6FF;
    /* Blue 50 */
}

.distance-card.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.distance-card .card-icon {
    font-size: 1.5rem;
    opacity: 0.8;
}

.distance-card.active .card-icon {
    opacity: 1;
}

.distance-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.distance-card span {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Time Inputs */
.time-inputs-container {
    display: flex;
    align-items: flex-end;
    /* Align baselines */
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.time-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.time-field input {
    width: 60px;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--primary);
    outline: none;
    padding: 0;
}

.time-field .unit {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 5px;
}

.separator {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-light);
    margin-bottom: 25px;
    /* Offset to center vertically with inputs */
}

/* Combined Action Input */
.input-with-action {
    display: flex;
    gap: 15px;
}

.time-field.combined {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 15px;
    flex-direction: row;
    gap: 10px;
    flex: 1;
}

.time-field.combined input {
    font-size: 1.4rem;
    width: 50px;
    text-align: right;
    border: none;
    background: transparent;
    outline: none;
    font-weight: 700;
}

.calculate-btn {
    flex: 1;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.calculate-btn:hover {
    background: var(--accent-hover);
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Results Table */
.results-section {
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.header-actions .action-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.header-actions .action-btn:hover {
    background: var(--bg-page);
    border-color: var(--text-light);
}

.table-wrapper {
    overflow-y: auto;
    flex: 1;
}

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

.results-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 15px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
}

.results-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-main);
}

.results-table tbody tr:hover {
    background: #f1f5f9;
}

.stop-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.2s;
}

.stop-toggle.active {
    background: #DBEAFE;
    /* Blue 100 */
    color: var(--accent);
}

.results-table .pace-val {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent);
}

.total-row,
.split-row {
    background: var(--primary);
    color: white;
}

.total-row td,
.split-row td {
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
}

.split-row {
    background: var(--primary-light);
}

/* Footer */
.global-footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    background: white;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }

    .app-header h1 {
        font-size: 1.8rem;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    /* Slate 900 with opacity */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-dialog {
    background: white;
    width: 95%;
    max-width: 600px;
    height: 90vh;
    /* Fixed height for scrollable internal area */
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    background: var(--bg-page);
    display: flex;
    justify-content: center;
    padding: 20px;
}

.preview-scroll-area {
    overflow-y: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Wristband Card Design */
.wristband-card {
    width: 300px;
    /* Height dynamic in reality, but for screenshot we might need minimums */
    min-height: 900px;
    background: white;
    padding: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px dashed #cbd5e1;
    /* For preview boundary */
}

/* To force specific "Print" look for the canvas export */
.wristband-header-visual {
    background: var(--primary);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.wristband-header-visual .band-title {
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 0.1em;
    line-height: 1;
}

.wristband-header-visual .band-subtitle {
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    opacity: 0.8;
    margin-top: 5px;
}

.wristband-content {
    flex: 1;
    padding: 20px;
}

.wristband-table {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
}

.wristband-table th {
    text-align: center;
    font-size: 0.8rem;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.wristband-table td {
    text-align: center;
    padding: 6px 2px;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}

.wristband-table tfoot tr {
    background: #f8fafc;
    font-weight: bold;
}

.wristband-footer-visual {
    background: var(--accent);
    color: white;
    padding: 20px;
    text-align: center;
}

.wristband-footer-visual .motivation {
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* SEO Content Section */
.seo-content {
    margin-top: 40px;
    padding: 30px;
    background: white;
    grid-column: 1/-1;
}

.seo-content .content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-main);
}

.seo-content h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 700;
}

.seo-content h3 {
    font-size: 1.1rem;
    color: var(--primary-light);
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
}

.seo-content p {
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.7;
    color: var(--text-main);
}

.seo-content ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.seo-content li {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.seo-content strong {
    color: var(--primary);
    font-weight: 600;
}