@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

* {
    padding: 0%;
    margin: 0%;
    box-sizing: border-box;
}

body {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    background: #f5f5f5;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    background: #1a1a1a;
    color: #fff;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    font-size: 1.2em;
    border: none;
    border-radius: 50px;
    background: #667eea;
    color: white;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

body.dark-mode .theme-toggle {
    background: #fbbf24;
}

header {
    width: 90%;
    max-width: 1400px;
    min-height: 70vh;
    background: #fff;
    box-shadow: 0px 0px 25px rgb(197, 197, 211);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

body.dark-mode header {
    background: #2d2d2d;
    box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.5);
}

header .male,
.cal,
.female {
    position: relative;
    width: 33.33%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    padding: 20px;
}

.gender-title {
    font-size: 1.8em;
    font-weight: 700;
    margin: 15px 0 20px 0;
    color: #333;
}

body.dark-mode .gender-title {
    color: #fff;
}

header img {
    width: 180px;
    margin-bottom: 10px;
}

/* Speedometer - Center only */
header .speed {
    display: inline-block;
    position: relative;
    height: 57px;
    overflow: hidden;
    margin: 30px 0;
}

header .speed .speedmeter {
    width: 115px;
    height: 115px;
    border-top: 13px solid #000;
    border-left: 13px solid #000;
    border-right: 13px solid #fff;
    border-bottom: 13px solid #fff;
    border-radius: 100%;
    transform: rotate(45deg);
    display: flex;
    box-shadow: inset 0px 0px 20px gray;
    transition: all 0.5s ease;
}

body.dark-mode header .speed .speedmeter {
    border-right-color: #2d2d2d;
    border-bottom-color: #2d2d2d;
}

header .speed .needle {
    position: absolute;
    width: 5px;
    height: 35px;
    background: linear-gradient(45deg, transparent, #000);
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    border-top-left-radius: 100%;
    border-top-right-radius: 100%;
    top: 15px;
    left: 53px;
    display: inline-block;
    transform-origin: bottom;
    transform: rotate(-90deg);
    transition: all 0.5s ease;
}

body.dark-mode header .speed .needle {
    background: linear-gradient(45deg, transparent, #fbbf24);
}

header .speed h3 {
    position: absolute;
    top: 35px;
    left: 30px;
    font-size: 1.4em;
    font-weight: 700;
}

body.dark-mode header .speed h3 {
    color: #fff;
}

header input[type="submit"] {
    margin-top: 20px;
    padding: 12px 40px;
    border: none;
    outline: none;
    border-radius: 8px;
    background: #000;
    color: #fff;
    cursor: pointer;
    transition: .3s ease;
    font-weight: 600;
    font-size: 1.1em;
}

header input[type="submit"]:hover {
    background: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

body.dark-mode header input[type="submit"] {
    background: #667eea;
}

body.dark-mode header input[type="submit"]:hover {
    background: #764ba2;
}

.status-btn {
    margin: 20px 0;
    padding: 12px 30px;
    border: none;
    outline: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2em;
    cursor: default;
    transition: all 0.3s ease;
    background: #e0e0e0;
    color: #333;
}

body.dark-mode .status-btn {
    background: #555;
    color: #fff;
}

header .cal {
    border-left: 2px solid #e0e0e0;
    border-right: 2px solid #e0e0e0;
}

body.dark-mode header .cal {
    border-left-color: #444;
    border-right-color: #444;
}

header .cal h1 {
    margin-bottom: 20px;
    font-size: 2em;
}

body.dark-mode header .cal h1 {
    color: #fff;
}

header .cal .card,
header .male .card,
header .female .card {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-top: 15px;
    width: 100%;
}

header .cal .card h4,
header .male .card h4,
header .female .card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

body.dark-mode header .cal .card h4,
body.dark-mode header .male .card h4,
body.dark-mode header .female .card h4 {
    color: #fff;
}

header .cal .card h4 span,
header .male .card h4 span,
header .female .card h4 span {
    font-size: 11px;
    font-weight: 600;
    color: #666;
}

body.dark-mode header .cal .card h4 span,
body.dark-mode header .male .card h4 span,
body.dark-mode header .female .card h4 span {
    color: #aaa;
}

.input-slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

header .cal .card input[type="number"],
header .male .card input[type="number"],
header .female .card input[type="number"] {
    border: 3px solid gray;
    outline: none;
    width: 100px;
    font-size: 26px;
    font-weight: 900;
    border-radius: 5px;
    box-shadow: inset 0px 0px 20px rgba(128, 128, 128, 0.3);
    text-align: center;
    transition: all 0.3s ease;
}

header .cal .card input[type="number"]:focus,
header .male .card input[type="number"]:focus,
header .female .card input[type="number"]:focus {
    border-color: #667eea;
    box-shadow: inset 0px 0px 20px rgba(102, 126, 234, 0.3);
}

body.dark-mode header .cal .card input[type="number"],
body.dark-mode header .male .card input[type="number"],
body.dark-mode header .female .card input[type="number"] {
    background: #3d3d3d;
    color: #fff;
    border-color: #555;
}

body.dark-mode header .cal .card input[type="number"]:focus,
body.dark-mode header .male .card input[type="number"]:focus,
body.dark-mode header .female .card input[type="number"]:focus {
    border-color: #667eea;
}

/* Custom Slider Styles */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 220px;
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(to right, #ddd 0%, #888 50%, #000 100%);
    outline: none;
    transition: all 0.3s ease;
    position: relative;
}

body.dark-mode .slider {
    background: linear-gradient(to right, #333 0%, #666 50%, #999 100%);
}

.slider:hover {
    background: linear-gradient(to right, #ccc 0%, #777 50%, #000 100%);
}

body.dark-mode .slider:hover {
    background: linear-gradient(to right, #444 0%, #777 50%, #aaa 100%);
}

/* Chrome, Safari, Edge, Opera */
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c2c2c 0%, #000 100%);
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    margin-top: -7px;
    border: 2px solid #fff;
}

body.dark-mode .slider::-webkit-slider-thumb {
    background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.3), inset 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 2px solid #000;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

body.dark-mode .slider::-webkit-slider-thumb:hover {
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.5), inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Firefox */
.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c2c2c 0%, #000 100%);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

body.dark-mode .slider::-moz-range-thumb {
    background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.3), inset 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 2px solid #000;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

body.dark-mode .slider::-moz-range-thumb:hover {
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.5), inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb:active {
    transform: scale(1.05);
}

/* Track */
.slider::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(to right, #ddd 0%, #888 50%, #000 100%);
}

body.dark-mode .slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #333 0%, #666 50%, #999 100%);
}

.slider::-moz-range-track {
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(to right, #ddd 0%, #888 50%, #000 100%);
}

body.dark-mode .slider::-moz-range-track {
    background: linear-gradient(to right, #333 0%, #666 50%, #999 100%);
}

.info-box {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    width: 100%;
}

body.dark-mode .info-box {
    background: #3d3d3d;
    border-left-color: #fbbf24;
}

.info-box h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1.1em;
}

body.dark-mode .info-box h3 {
    color: #fff;
}

.info-box p {
    margin: 6px 0;
    font-size: 0.85em;
    color: #555;
}

body.dark-mode .info-box p {
    color: #ccc;
}

.info-box strong {
    color: #667eea;
}

body.dark-mode .info-box strong {
    color: #fbbf24;
}

.advice-box {
    margin-top: 20px;
    padding: 15px 20px;
    background: #fff3cd;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .advice-box {
    background: #4a4a2d;
    border-left-color: #fbbf24;
}

.advice-box p {
    font-size: 0.95em;
    color: #856404;
    font-weight: 500;
    text-align: center;
    line-height: 1.5;
}

body.dark-mode .advice-box p {
    color: #fbbf24;
}

.history-section {
    width: 90%;
    max-width: 1400px;
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0px 0px 25px rgb(197, 197, 211);
    transition: all 0.3s ease;
}

body.dark-mode .history-section {
    background: #2d2d2d;
    box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.5);
}

.history-section h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

body.dark-mode .history-section h2 {
    color: #fff;
}

#history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

body.dark-mode .history-item {
    background: #3d3d3d;
    color: #fff;
}

.history-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-item .delete-btn {
    padding: 6px 15px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.history-item .delete-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.clear-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

@media (max-width: 1024px) {
    header {
        flex-direction: column;
    }

    header .male,
    .cal,
    .female {
        width: 100%;
        border: none !important;
    }

    header .cal {
        order: -1;
    }
}

@media (max-width: 768px) {
    header {
        width: 95%;
        padding: 15px;
    }

    header img {
        width: 150px;
    }

    header .cal h1 {
        font-size: 1.5em;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 1em;
    }

    .slider {
        max-width: 180px;
    }
}