/* Base Styles */
html, body {
    margin: 0;
    padding: 0;
    height: auto;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    left: -10px;
}

body {
    font-family: Arial, sans-serif;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-wrapper {
    display: flex;
    justify-content: center;
    height: 80%;
    width: 95%;
    max-width: 1200px;
}

.container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

h2 {
    text-align: center;
    font-size: 1.8em;
    color: #333;
    margin-bottom: 20px;
}

.vehicle-tabs {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.vehicle-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85em;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #ddd;
    border-top: 1px solid #ddd;
    border-left: 1px solid #ddd;
    z-index: revert-layer;
    width: calc(100% + 20px); /* Slightly increase the width */
    margin-right: -20px; /* Overlap the container by moving it left */
}

.vehicle-tabs .vehicle-tab.active,
.vehicle-tabs .vehicle-tab:hover {
    background-color: #f5f5f5;
    color: white;
    border-right: none;
}

.vehicle-tabs .vehicle-tab.active {
    background-color: #f5f5f5 !important;
    color: white !important;
    border-right: none; /* Remove right border when active */
    width: calc(100% + 20px); /* Slightly increase the width */
    margin-right: -20px; /* Overlap the container by moving it left */
    border-bottom: none;
    border-top: none;
    border-radius: 5px;
    z-index: 5;
}

.vehicle-icon {
    width: 30px;
    margin-right: 15px;
}

.selector-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Create two equal-width columns */
    gap: 20px; /* Space between dropdowns */
    row-gap: 0px;
    width: 100%;
    box-sizing: border-box;
}

.selector {
    display: flex;
    flex-direction: column;
    width: 100%; /* Ensure each dropdown takes the full width of its grid column */

}

label {
    font-weight: bold;
    margin-bottom: 5px;
}

select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="5"><path fill="%23000" d="M0 0l5 5 5-5H0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    box-sizing: border-box;
}

select:focus {
    border-color: #3498db;
    outline: none;
}

.button-container {
    width: 100%;
    text-align: right;
    margin-bottom: 20px;
}

button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #4b85ac;
    cursor: not-allowed;
}


label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

select, button {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

button {
    background-color: #3498db;
    color: #fff;
    cursor: pointer;
    margin-top: 20px;
}

.vehicle-tabs .vehicle-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #e9ecef;
    border: 1px solid #ddd;
    border-top: 1px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85em;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
    width: 100%;
    margin: 0; /* Remove any margin */
    z-index: revert-layer;
    width: calc(100% + 20px); /* Slightly increase the width */
    margin-right: -20px; /* Overlap the container by moving it left */
}

/* Chart container and Tile styling */
.chart-container, .circle-tile, .stats-table {
    display: none;
    margin-top: 30px;
}

.stats-table {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tile {
    flex: 1;
    padding: 10px;
    margin: 0 5px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
}
#dynoChart {
    width: 100%;
    height: 400px;
}

.tile.original { background-color: #dcdcdc; }
.tile.st1 { background-color: #3498db; color: white; cursor: pointer; position: relative; overflow: hidden;}
.tile.increase { background-color: #dcdcdc; color: #3498db; }

.clipboard-icon {
    position: absolute;
    top: 10px; /* Adjust to position the icon vertically */
    right: 10px; /* Adjust to position the icon horizontally */
    width: 20px; /* Adjust size as needed */
    height: 20px; /* Adjust size as needed */
    z-index: 3;
}

.tile-header {
    font-size: 16px;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tile-number {
    font-size: 28px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tile.increase .tile-number {
    color: #3498db;
    text-shadow: none !important;
}

.divider {
    border: 1px solid #ccc;
    width: 90%;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Styling for Dropdowns */
select {
    width: 100%;
    padding: 12px 20px 12px 20px; /* Added extra padding on the right */
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #f8f8f8;
    color: #333;
    margin-bottom: 20px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    appearance: none; /* Remove default dropdown arrow styling */
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="5"><path fill="%23000" d="M0 0l5 5 5-5H0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center; /* Adjusted the background position */
    background-size: 12px;
    padding-right: 28px; /* Increased padding on the right to give more space for the arrow */
}

select:focus {
    border-color: #3498db;
    background-color: #e0f7ff;
    outline: none; /* Remove default outline */
}

select:disabled {
    background-color: #eaeaea;
    color: #aaa;
    cursor: not-allowed;
}

/* Flex container for chart and circles */
.chart-and-circle-section {
    display: flex;
    justify-content: space-between;
}

/* Flex container for chart and circles */
.chart-and-circles {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.shifted-text {
    transform: translateX(-5px); /* Adjust this value for the best positioning */
}

/* Make the chart take more space */
.chart-section {
    flex: 3;
    position: relative;
    width: 100%;
}

/* Circles section */
.circle-container {
    display: flex;
    margin-top: 30px;
}

.circle-diagram-container {
    margin-bottom: 20px;
}

.circle-diagram {
    position: relative;
    width: 130px;
    height: 130px;
    margin-bottom: 30px;
}

#hpPercentage, #torquePercentage {
    position: absolute;
    top: 63%;
    left: 36.5%;
    font-size: 35px;
    font-weight: bold;
    color: #3498db;
    text-align: center;
    z-index: 1;
}

#hpCanvas, #torqueCanvas {
    width: 150px;
    height: 150px;
    display: inline-block;
    position: relative;
}

.circle-title {
    text-align: center;
    font-size: 23px;
    font-weight: bold;
    color: #3498db;
    margin-left: 5px;
}

.circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #3498db;
    margin: 10px;
    display: inline-block;
}

/* Stage buttons container */
.button-stage-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

/* Style for stage buttons */
.stage-button {
    padding: 10px 20px;
    background-color: #aaa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 120px;
    text-align: center;
    margin-left: 5px;
}

#stage1Button, #stage2Button {
    width: 200px;
    height: 35px;
    margin-top: 5px;
    margin-bottom: 5px;
}

#stage2Button:hover {
    background-color: #c0392b;
}

#stage1Button:hover {
    background-color: #2980b9;
}

.stage-button:hover {
    background-color: #2980b9;
}

.stage-button.active {
    background-color: #2980b9;
}

.tile.st1 span {
    position: relative;
    z-index: 1;
}

.tile.st1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 0;
    transition: background-color 0.1s ease;
    opacity: 0;
}

.tile.st1:hover::before {
    opacity: 1;
}

.tile.st1:hover .clipboard-icon {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8)); /* White glow effect */
}
.tile.st1 .tile-header,
.tile.st1 .tile-number {
    position: relative; /* Ensures only text elements remain above the ::before overlay */
    z-index: 2; /* Keeps the text on top */
}
.stage-button:focus {
    outline: none;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}


button:disabled {
    background-color: #4b85ac;
    cursor: not-allowed;
}

#selectedVehicleInfo {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    color: #333;
    margin-top: 20px;
    padding: 10px;
    background-color: #f1f1f1;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
}

#requiredModifications {
    font-size: 35px;
    font-weight: bold;
    text-align: center;
    color: #333;
    margin-top: 20px;
    padding: 10px;
    background-color: #f1f1f1;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#stage2Button:hover + #stage2Tooltip {
    display: block;
    opacity: 1;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid #3498db;
    border-top: 4px solid #ccc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 10px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #333;
}

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


.vehicle-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85em;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
    width: 100%;
    text-align: center;
}

.vehicle-tabs .vehicle-tab.active,
.vehicle-tabs .vehicle-tab:hover {
    color: white;
}

.vehicle-icon {
    width: 30px;
}

.selector-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Create two equal-width columns */
    gap: 20px; /* Space between dropdowns */
    row-gap: 0px;
    width: 100%;
    box-sizing: border-box;
}

.selector {
    display: flex;
    flex-direction: column;
    width: 100%; /* Ensure each dropdown takes the full width of its grid column */
}

label {
    font-weight: bold;
    margin-bottom: 5px;
}

select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="5"><path fill="%23000" d="M0 0l5 5 5-5H0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    box-sizing: border-box;
}

select:focus {
    border-color: #3498db;
    outline: none;
}

.button-container {
    width: 100%;
    text-align: right;
    margin-bottom: 20px;
}

button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

button:disabled {
    background-color: #4b85ac;
    cursor: not-allowed;
}

/* Chart and Tile Styling */
.chart-container, .circle-tile, .stats-table {
    display: none;
    margin-top: 30px;
}

.stats-table {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tile {
    flex: 1;
    padding: 10px;
    margin: 0 5px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
}
#dynoChart {
    width: 100%;
    height: 400px;
}

.tile.original { background-color: #dcdcdc; }
.tile.st1 { background-color: #3498db; color: white; cursor: pointer; position: relative; overflow: hidden;}
.tile.increase { background-color: #dcdcdc; color: #3498db; }

.tile-header {
    font-size: 16px;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tile-number {
    font-size: 28px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tile.increase .tile-number {
    color: #3498db;
    text-shadow: none !important;
}

.divider {
    border: 1px solid #ccc;
    width: 90%;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Circle Diagram */
.circle-section {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    margin-top: 20px;
}

.circle-diagram {
    width: 90px;
    height: 90px;
}

#hpCanvas, #torqueCanvas {
    width: 100px;
    height: 100px;
    display: inline-block;
    position: relative;
}

#hpPercentage, #torquePercentage {
    font-size: 24px;
    left: 32.5%;
    top: 61%;
}

.circle-title {
    font-size: 16px;
}

.percentage {
    font-size: 20px;
}

/* Mobile Styles */
@media (max-width: 768px) {

    /* General Layout */
    .container {
        width: 98%;
        max-width: 100%;
        padding: 15px;
        overflow: hidden; /* Prevents any internal overflow */
        margin: 0 auto; /* Center the container to avoid side overflow */
        box-sizing: border-box;
    }

    .loading-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 8px;
        background-color: rgba(255, 255, 255, 0.8);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 9999;
    }

    h2 {
        font-size: 20px;
    }

    .main-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0 10px; /* Add padding inside the wrapper to prevent side overflow */
        box-sizing: border-box;
        width: 98%;
    }

    /* Selector & Dropdowns */
    .selector-container, .button-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%; /* Ensures container is full width */
    }

    .selector-container select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box; /* Ensures padding stays within width */
        margin: 0 auto; /* Center-align to avoid left overflow */
    }

    .select {
        margin-bottom: 10px;
    }

    /* Chart Section */
    #dynoChart {
        width: 100%;
        height: auto !important;
        min-height: 300px;
    }

    .chart-and-circle-section {
        flex-direction: column;
        align-items: center;
    }

    .chart-section, .circle-section {
        width: 100%;
    }

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

    /* Stats & Tiles */
    .stats-table {
        flex-direction: column;
        align-items: center;
    }

    .tile {
        width: 95%;
        margin-bottom: 10px;
    }

    /* Circles & Percentage */
    .circle-section {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        margin-top: 20px;
    }

    .circle-diagrams {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
    }

    .circle-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-top: 10px;
        margin-right: 20px;
    }

    #hpCanvas, #torqueCanvas {
        width: 100px;
        height: 100px;
        display: inline-block;
        position: relative;
    }

    .circle-diagram {
        width: 90px;
        height: 90px;
    }

    #hpPercentage, #torquePercentage {
        font-size: 24px;
        left: 32.5%;
        top: 61%;
    }

    .circle-title {
        font-size: 16px;
    }

    .percentage {
        font-size: 20px;
    }

    /* Vehicle Tabs */
    .vehicle-tabs {
        display: flex!important;
        flex-direction: row;
        justify-content: space-between;
        width: 98%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .vehicle-tab {
        display: flex!important;
        padding: 10px;
        text-align: center;
        border-radius: 8px;
        z-index: 0;
        height: calc(100% + 20px);
        box-sizing: border-box;
    }

    .vehicle-tab.active {
        background-color: #007bff;
        color: white;
        width: 100%;
        margin-top: 5px;
    }

    .vehicle-icon {
        width: 30px;
        height: auto;
        margin-right: 0px;
    }

    .vehicle-tabs .vehicle-tab {
        display: flex!important;
        align-items: center;
        background-color: #e9ecef;
        border: 1px solid #ddd;
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.85em;
        color: #333;
        transition: background-color 0.3s, color 0.3s;
        width: 100%;
        margin: 0;
    }

    .vehicle-tabs .vehicle-tab + .vehicle-tab {
        margin-top: 5px;
        display: flex!important;
        transform: translateY(5px);
    }
    .vehicle-tabs .vehicle-tab.active {
        margin-right: 0px;
        z-index: 5;
    }

    .vehicle-tabs .vehicle-tab.active, .vehicle-tabs {
        color: white;
        margin-top: 5px;
        position: relative;
        top: 5px;
        border-radius: 8px;
        border-left: none;
    }
    .vehicle-tab:first-child {
        transform: translateY(7px); /* Adjust based on the difference */
    }

    body {
        margin-right: 0px;
    }
    html, body {
        left: 0px;
    }
    
    #selectedVehicleInfo {
        font-size: 17px;
    }
}