/*
==========================================
Track Cycling Calcs
Calculator layout and controls
==========================================
*/

.calculator {
    width: 100%;
    max-width: 1400px;
    background: #FAFAFA;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    margin-top: 20px;
}

.calculator-header {
    background: #1862b5;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
}

.calculator-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.calculator-header p {
    margin: 8px 0 0;
    font-size: 1rem;
}

.mobile-break {
    display: none;
}

.collapse-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
}

.calculator-body {
    padding: 20px;
}

.calculator-body h3 {
    margin: 18px 0 15px;
    font-size: 1.4rem;
    font-weight: 500;
}

h3:first-of-type {
    margin-top: 0;
}

.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.grid + .grid {
    margin-top: 12px;
}

.grid-2 .field,
.grid-2 .result-box {
    flex: 1 1 calc(50% - 9px);
}

.grid-3 .field,
.grid-3 .result-box {
    flex: 1 1 calc(33.33% - 12px);
}

.field {
    display: flex;
    flex-direction: column;
}

.field label {
    font-weight: 600;
    margin-bottom: 8px;
}

.field input,
.field select {
    height: 46px;
    border: 1px solid #d3d3d3;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    background: white;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #4f6478;
}

.field input:disabled {
    background: #eee;
    color: #777;
    cursor: not-allowed;
}

/* Slider labels only */

.range-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-label span {
    min-width: 2.5em;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #4f6478;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Range inputs */

.field input[type="range"] {
    width: 100%;
    height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    accent-color: #4f6478;
    cursor: pointer;
}

.field-spacing-top {
    margin-top: 20px;
}

.result-box {
    background: #efefef;
    border-radius: 12px;
    padding: 18px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-box span {
    color: #666;
    margin-bottom: 10px;
    justify-content: left;
}

.result-box strong {
    font-size: 1.6rem;
    font-family: Consolas, monospace;
}

.result-box.hidden {
    display: none;
}

.result-box.active {
    /*background: #e3f2fd;*/
    background: #dce6f9;
}

.result-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.results-section {
    margin-top: 20px;
}

.field-margin {
    margin-bottom: 20px;
}

/* Event Selector */

.event-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

input[type="radio"] {
    display: none;
}

input[type="radio"]:checked + .event-card {
    background: #dce6f9;
    border-color: #dce6f9;
}

/*Gear selection calculator*/

.gear-input-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.gear-input {
    margin-top: 24px;
}

.gear-input label {
    display: block;
    margin-bottom: 6px;
    white-space: nowrap;
    font-weight: 600;
}

/*.gear-input input {
    width: 130px;
}*/

.gear-limits {
    display: flex;
    gap: 20px;
}

.limit-group {
    display: flex;
    flex-direction: column;
}

.limit-group label {
    display: block;
    margin-bottom: 6px;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.75rem;
}

.min-max {
    display: flex;
    align-items: center;
    gap: 8px;
}

.min-max input {
    width: 70px;
    text-align: center;
}

.gear-table-output {
    width: 100%;
    max-width: 280px;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 30px;
}

.gear-table-output td,
.gear-table-output th {
    padding: 5px 3px;
    line-height: 1;
    font-size: 16px;
    height: 30px;
    box-sizing: border-box;
    vertical-align: middle;
    text-align: center;
}

.gear-table-output th {
    background: #f2f2f2;
    font-weight: 600;
}

.hidden {
    display: none;
}

.checkbox-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding-left: 4px;
    margin-top: 20px;
    margin-bottom: 15px;   
}

.checkbox-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 auto;
}

.checkbox-field label {
    margin: 0;
}

@media (max-width: 768px) {
    .calculator {
        border-radius: 18px;
    }

    .calculator-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .mobile-break {
        display: inline;
    }    

    .grid-2 .field,
    .grid-2 .result-box,
    .grid-3 .field,
    .grid-3 .result-box {
        flex: 1 1 100%;
    }

    #tyreSize::placeholder {
        font-size: 0.8rem;
    }

    /*Gear selection calculator*/
    
    .gear-table-output {
        max-width: 100%;
    }

    .gear-table-output th,
    .gear-table-output td {
        padding: 12px 6px;
        font-size: 0.95rem;
    }

    .gear-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .gear-limits {
        flex-direction: column;
        gap: 15px;
    }

    /*.gear-input input {
        width: 100%;
        max-width: 120px;
    }*/
    
    /* Event Selector */

    .grid-tight {
        gap: 0;
    }

}