/* General Styles */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f4f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    letter-spacing: 0.2px;
}

h1, h2, h3 {
    margin: 0;
    color: #333;
    font-weight: 600;
    letter-spacing: 0.2px;
}

a {
    text-decoration: none;
    color: #007bff;
}

a:hover {
    color: #0056b3;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 5px;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 24px;
    color: #007bff;
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav ul li {
    margin-left: 20px;
}

.nav ul li a {
    font-size: 16px;
    font-weight: 500;
}

.nav ul li a.active {
    color: #0056b3;
    font-weight: 600;
    border-bottom: 2px solid #0056b3;
}

/* Calculator Section */
.calculator-section {
    padding: 40px 0;
}

.calculator-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.intro-text {
    flex: 1;
}

.intro-text h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.intro-text p {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.calculator-wrapper {
    flex: 1;
    max-width: min(340px, 90vw);
    width: 100%;
    padding: 0 5px;
    box-sizing: border-box;
}

.calculator-wrapper h2 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.calculator-section .calculator {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 12px;
    border: 1px solid #66b0ff;
    box-sizing: border-box;
}

.calculator-section .display {
    background: #f4f4f9;
    padding: 10px;
    font-size: clamp(16px, 4.5vw, 18px);
    text-align: right;
    border-radius: 5px;
    margin-bottom: 8px;
    color: #333;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}

.calculator-section .buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(44px, 1fr));
    gap: 6px;
}

.calculator-section .btn {
    padding: 10px;
    font-size: clamp(13px, 3.5vw, 15px);
    border: none;
    background: #e9ecef;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 44px;
    box-sizing: border-box;
}

.calculator-section .btn:hover {
    background: #dee2e6;
}

.calculator-section .operator {
    background: #007bff;
    color: #fff;
}

.calculator-section .operator:hover {
    background: #0056b3;
}

.calculator-section .clear {
    background: #dc3545;
    color: #fff;
}

.calculator-section .clear:hover {
    background: #c82333;
}

.calculator-section .calculator-footer {
    text-align: center;
    font-size: 12px;
    color: #666;
    padding-top: 10px;
}

/* History List */
#historyList {
    list-style: none;
    padding: 0;
    margin-top: 8px;
    font-size: clamp(12px, 3vw, 14px);
    color: #333;
    max-height: 100px;
    overflow-y: auto;
    max-width: 100%;
    box-sizing: border-box;
}

#historyList li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow-x: hidden;
    text-overflow: ellipsis;
}

/* Categories Section */
.categories {
    padding: 40px 0;
}

.category-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.category-row-two {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.centered-row {
    justify-content: center;
}

.category-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    flex: 1;
    margin: 10px;
    max-width: calc(33.33% - 20px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.category-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: block;
}

.category-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.category-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.category-card ul {
    list-style: none;
    padding: 0;
}

.category-card ul li {
    margin: 5px 0;
}

.category-card ul li a {
    font-size: 14px;
}

/* Footer */
.footer {
    background: #333;
    color: #fff;
    padding: 20px 0;
    text-align: center;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: #fff;
    margin: 0 10px;
    font-size: 14px;
}

.footer-links a:hover {
    color: #007bff;
}

.footer p {
    margin: 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-content {
        flex-direction: column;
        gap: 20px;
    }

    .calculator-wrapper {
        max-width: 90vw;
        padding: 0 5px;
    }

    .category-row {
        flex-direction: column;
    }

    .category-row-two {
        flex-direction: column;
    }

    .centered-row {
        flex-direction: column;
    }

    .category-card {
        max-width: 100%;
    }
}

@media (max-width: 430px) {
    .container {
        padding: 0 2px;
    }

    .calculator-wrapper {
        max-width: 92vw;
        padding: 0 3px;
    }

    .calculator-section .calculator {
        padding: 6px;
    }

    .calculator-section .display {
        padding: 4px;
        font-size: clamp(15px, 4vw, 17px);
        overflow-x: hidden;
        text-overflow: ellipsis;
    }

    .calculator-section .buttons {
        gap: 4px;
    }

    .calculator-section .btn {
        padding: 4px;
        font-size: clamp(13px, 3.5vw, 15px);
        min-height: 44px;
    }

    .calculator-section .calculator-footer {
        font-size: 11px;
        padding-top: 8px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #historyList {
        font-size: clamp(11px, 2.8vw, 13px);
        max-height: 80px;
    }
}

.input-group {
    margin-bottom: 10px;
}
.input-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}
.input-group input {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}
#results {
    margin-top: 20px;
    padding: 10px;
    background: #f4f4f9;
    border-radius: 5px;
}
.graphs {
    margin-top: 20px;
}
.graphs h3 {
    font-size: 18px;
    margin-bottom: 10px;
}
canvas {
    max-width: 100%;
    height: auto;
}
@media (max-width: 430px) {
    .input-group label {
        font-size: 12px;
    }
    .input-group input {
        font-size: 12px;
        padding: 6px;
    }
    #results {
        font-size: 12px;
    }
    .graphs h3 {
        font-size: 16px;
    }
}
.calculator-container {
    max-width: 100%;
    padding: 20px;
    box-sizing: border-box;
    margin: 0 auto;
}

#bmi-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#weight, #height, button {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    box-sizing: border-box;
}

#result {
    margin-top: 10px;
    text-align: center;
}

@media (max-width: 430px) {
    .calculator-container {
        padding: 10px;
    }
    #weight, #height, button {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    .calculator-container {
        max-width: 600px;
    }
}