/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Calculator container */
.calculator-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.calc-heading {
    grid-column: 1 / -1;
    font-size: 36px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.calc-intro {
    grid-column: 1 / -1;
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

/* Explicitly place tabs */
.calc-tab:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 2;
}

.calc-tab:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 2;
}

.calc-tab:nth-child(3) {
    grid-column: 1 / 2;
    grid-row: 3;
}

.calc-tab:nth-child(4) {
    grid-column: 2 / 3;
    grid-row: 3;
}

.calc-tab:nth-child(5) {
    grid-column: 1 / 2;
    grid-row: 4;
}

.calc-tab:nth-child(6) {
    grid-column: 2 / 3;
    grid-row: 4;
}

.calc-tab:nth-child(7) {
    grid-column: 1 / 2;
    grid-row: 5;
}

.calc-tab:nth-child(8) {
    grid-column: 2 / 3;
    grid-row: 5;
}

.calc-tab {
    background: linear-gradient(45deg, #0073aa, #00aaff);
    color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calc-tab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.calc-tab i {
    font-size: 24px;
}

/* Popup styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.popup-content {
    background: white;
    width: 100vw;
    height: 100vh;
    padding: 30px;
    position: relative;
    overflow-y: auto;
}

#calc-grid-popup .popup-content {
    width: 100vw;
    height: 100vh;
    padding: 30px;
}

.close {
    position: fixed;
    top: 15px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
}

.close:hover {
    color: #ff0000;
    transform: rotate(90deg);
}

/* Form styles */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.popup-heading {
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
    text-align: center;
    margin-bottom: 20px;
}

input, select {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    transition: border-color 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

button {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.3s ease;
}

button:hover {
    background: #005d87;
    transform: translateY(-2px);
}

#result {
    margin-top: 20px;
    font-size: 16px;
    color: #333;
    white-space: pre-wrap;
    text-align: center;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
}

body.popup-active {
    overflow: hidden;
}

/* Open calculators button */
.open-calculators-btn {
    background: green !important;
    color: white!important;
    padding: 14px 28px;
    border: none!important;
    border-radius: 5px!important;
    cursor: pointer!important;
    font-size: 18px;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.3s ease;
    display: inline-block;
    margin: 20px auto;
}

.open-calculators-btn:hover {
    background: #005d87;
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .calculator-container {
        grid-template-columns: 1fr;
        padding: 15px;
    }

    .calc-heading {
        font-size: 28px;
    }

    .calc-intro {
        font-size: 16px;
    }

    .calc-tab {
        font-size: 16px;
        padding: 15px;
    }

    .popup-content {
        padding: 20px;
    }

    .popup-heading {
        font-size: 20px;
    }

    .form-group label {
        font-size: 14px;
    }

    input, select, button {
        font-size: 14px;
        padding: 10px;
    }

    .open-calculators-btn {
        font-size: 16px;
        padding: 12px 20px;
    }

    .close {
        top: 10px;
        right: 10px;
        font-size: 24px;
    }
}