/* Mathematics page specific styles */
.mathematics{
    padding: 100px 9% 120px 9%;
    color: #fff;
    background: #000;
    min-height: calc(100vh - 60px);
}

.achievements-section{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 80px;
}

.achievement-card{
    background: #1b2028;
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s;
}

.achievement-card:hover{
    transform: translateY(-5px);
    border-color: rgba(255, 77, 77, 0.5);
    box-shadow: 0 10px 30px rgba(255, 77, 77, 0.2);
}

.achievement-icon{
    width: 80px;
    height: 80px;
    background: red;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.achievement-icon i{
    font-size: 40px;
    color: #000;
}

.achievement-card h3{
    font-size: 22px;
    margin-bottom: 8px;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.achievement-subject{
    color: #ff4d4d;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.achievement-desc{
    color: #d4d4d4;
    line-height: 1.6;
    font-size: 14px;
}

/* Calculator Section */
.calculator-section{
    margin-top: 60px;
}

.calculator-container{
    background: #1b2028;
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 16px;
    padding: 32px;
    margin-top: 40px;
}

.calculator-controls{
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 77, 77, 0.2);
}

.control-group{
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.control-group label{
    color: #d4d4d4;
    font-size: 14px;
    font-weight: 500;
}

.control-group input[type="text"],
.control-group input[type="number"]{
    background: #1f242d;
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.control-group input[type="text"]{
    flex: 1;
    min-width: 200px;
}

.control-group input[type="number"]{
    width: 80px;
}

.control-group input[type="checkbox"]{
    width: 18px;
    height: 18px;
    accent-color: red;
}

.calc-btn{
    background: red;
    color: #000;
    border: 1px solid red;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.calc-btn:hover{
    background: transparent;
    color: red;
}

.preset-functions{
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.preset-functions span{
    color: #d4d4d4;
    font-weight: 500;
}

.preset-btn{
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #ff4d4d;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Courier New', monospace;
}

.preset-btn:hover{
    background: rgba(255, 77, 77, 0.2);
    border-color: rgba(255, 77, 77, 0.5);
}

/* Graph Container */
.graph-container{
    position: relative;
    background: #0f1419;
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 12px;
    padding: 20px;
    overflow: hidden;
}

#graph-canvas{
    width: 100%;
    height: 500px;
    display: block;
    background: #0f1419;
}

.graph-info{
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    max-width: 250px;
}

.graph-info .info-line{
    margin: 4px 0;
}

.graph-info .info-label{
    color: #ff4d4d;
    font-weight: 600;
}

/* Distance Calculators Section */
.distance-calculators-section{
    margin-top: 60px;
    margin-bottom: 60px;
}

.distance-calculators-section .section-title{
    max-width: 900px;
    margin: 0 auto 40px auto;
}

.distance-intro{
    font-size: 20px;
    color: #ff4d4d;
    font-weight: 600;
    margin: 16px 0 12px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
}

.distance-description{
    color: #d4d4d4;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: 0;
    margin-right: auto;
    text-align: left;
}

.distance-definitions{
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 77, 77, 0.05);
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.distance-definitions dl{
    margin: 0;
}

.distance-definitions dt{
    color: #ff4d4d;
    font-weight: 600;
    font-size: 16px;
    margin-top: 16px;
    margin-bottom: 6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.distance-definitions dt:first-child{
    margin-top: 0;
}

.distance-definitions dd{
    color: #d4d4d4;
    font-size: 14px;
    line-height: 1.6;
    margin-left: 20px;
    margin-bottom: 12px;
}

.distance-calculators-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.calculator-card{
    background: #1b2028;
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 16px;
    padding: 32px;
    position: relative;
}

.calculator-card.advanced{
    border-color: rgba(255, 77, 77, 0.4);
    /* Make room so badges don't overlap the heading */
    padding-top: 72px;
}

.advanced-badge{
    position: absolute;
    top: 16px;
    right: 16px;
    background: red;
    color: #000;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.smk-proof-badge{
    position: absolute;
    top: 16px;
    left: 16px;
    background: red;
    color: #000;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}

.smk-proof-badge:hover{
    background: rgba(255, 0, 0, 0.8);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.calculator-card h3{
    font-size: 24px;
    margin-bottom: 8px;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.calc-description{
    color: #d4d4d4;
    font-size: 14px;
    margin-bottom: 24px;
}

.use-case,
.use-case.euclidean-story{
    background: rgba(255, 77, 77, 0.1);
    border-left: 3px solid red;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #ff4d4d;
    line-height: 1.6;
}

.distance-controls{
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.point-input{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.point-input label{
    color: #d4d4d4;
    font-size: 14px;
    font-weight: 500;
}

.point-input input{
    background: #1f242d;
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.point-input input[type="number"]{
    width: 100%;
}

.quick-locations{
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.quick-locations span{
    color: #d4d4d4;
    font-size: 13px;
}

.quick-btn{
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #ff4d4d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-btn:hover{
    background: rgba(255, 77, 77, 0.2);
    border-color: rgba(255, 77, 77, 0.5);
}

.result-display{
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-label{
    color: #d4d4d4;
    font-size: 14px;
}

.result-value{
    color: #ff4d4d;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.formula-display{
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 8px;
    margin-top: 8px;
}

.formula-display strong{
    color: #ff4d4d;
    display: block;
    margin-bottom: 8px;
}

.formula-display p{
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin: 4px 0;
}

/* Haversine Tabs */
.haversine-tabs{
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 77, 77, 0.2);
}

.tab-btn{
    background: transparent;
    border: none;
    color: #d4d4d4;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active{
    color: #ff4d4d;
    border-bottom-color: red;
}

.tab-btn:hover{
    color: #fff;
}

.tab-content{
    display: none;
}

.tab-content.active{
    display: block;
}

/* Bus Routing Scenario */
.routing-scenario{
    margin-top: 20px;
}

.routing-scenario h4{
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    font-size: 18px;
    margin-bottom: 12px;
}

.scenario-desc{
    color: #d4d4d4;
    font-size: 13px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.stops-container{
    margin-bottom: 24px;
}

.stops-list{
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.stop-item{
    display: grid;
    grid-template-columns: 40px 100px 1fr 120px 120px 40px;
    gap: 8px;
    align-items: center;
    background: #1f242d;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.stop-item.depot-stop,
.stop-item:first-child{
    grid-template-columns: 40px 1fr 120px 120px 40px;
}

.stop-item[data-type="pickup"]{
    grid-template-columns: 40px 100px 1fr 120px 120px 100px 110px 110px 40px;
}

.stop-type-label{
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.stop-type-label.pickup{
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.stop-type-label.destination{
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
}

.time-window-info,
.routing-controls-info{
    background: rgba(255, 77, 77, 0.1);
    border-left: 3px solid rgba(255, 77, 77, 0.5);
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.time-window-info p,
.routing-controls-info p{
    margin: 0 0 12px 0;
    color: #d4d4d4;
    font-size: 13px;
    line-height: 1.6;
}

.time-window-info p:last-child,
.routing-controls-info p:last-child{
    margin-bottom: 0;
}

.time-window-info strong,
.routing-controls-info strong{
    color: #ff4d4d;
}

.stop-number{
    background: red;
    color: #000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.stop-item input{
    background: #0f1419;
    border: 1px solid rgba(255, 77, 77, 0.2);
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
}

.stop-item input.stop-name{
    font-family: sans-serif;
}

.stop-item input[type="number"]{
    font-family: 'Courier New', monospace;
}

.remove-stop{
    background: rgba(255, 77, 77, 0.2);
    border: 1px solid rgba(255, 77, 77, 0.4);
    color: #ff4d4d;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s;
}

.remove-stop:hover{
    background: rgba(255, 77, 77, 0.4);
}

.add-stop-btn{
    width: 100%;
    background: rgba(255, 77, 77, 0.1);
    border: 1px dashed rgba(255, 77, 77, 0.4);
    color: #ff4d4d;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.add-stop-btn:hover{
    background: rgba(255, 77, 77, 0.2);
}

.routing-controls{
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 77, 77, 0.05);
    border-radius: 8px;
}

.routing-controls label{
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d4d4d4;
    font-size: 14px;
}

.routing-controls input[type="number"]{
    background: #1f242d;
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    width: 100px;
    font-family: 'Courier New', monospace;
}

.route-results{
    margin-top: 24px;
}

.distance-matrix{
    background: #1f242d;
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.distance-matrix table{
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.distance-matrix th,
.distance-matrix td{
    padding: 8px;
    text-align: center;
    border: 1px solid rgba(255, 77, 77, 0.1);
}

.distance-matrix th{
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
    font-weight: 700;
}

.distance-matrix td{
    color: #d4d4d4;
}

.route-summary{
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    border-radius: 8px;
    padding: 20px;
}

.route-summary h5{
    color: #ff4d4d;
    margin-bottom: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.route-summary p{
    color: #d4d4d4;
    margin: 8px 0;
    font-size: 14px;
}

.explanation-box{
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid red;
    padding: 20px;
    border-radius: 8px;
    margin-top: 24px;
}

.explanation-box h5{
    color: #ff4d4d;
    margin-bottom: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.explanation-box ul{
    color: #d4d4d4;
    margin: 12px 0;
    padding-left: 20px;
}

.explanation-box li{
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.6;
}

.explanation-box p{
    color: #d4d4d4;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.6;
}

@media (max-width: 900px){
    .achievements-section{
        grid-template-columns: 1fr;
    }
    .calculator-container{
        padding: 20px;
    }
    #graph-canvas{
        height: 400px;
    }
    .control-group{
        flex-direction: column;
        align-items: flex-start;
    }
    .control-group input[type="text"]{
        width: 100%;
    }
    .distance-calculators-grid{
        grid-template-columns: 1fr;
    }
    .stop-item{
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .routing-controls{
        flex-direction: column;
        align-items: flex-start;
    }
}

