body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    flex-direction: column;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    position: relative;
}

.logo-image {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.calculator-container {
    background: rgba(255, 255, 255, 0.98);
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.menu {
    display: flex;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e0e0e0);
    border-bottom: 1px solid #ddd;
}

.menu-item {
    padding: 10px 20px;
    font-size: 14px;
    color: #333;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
    margin: 0;
    position: relative;
}

.menu-item:hover, .menu-item.active {
    background-color: #007BFF;
    color: white;
    border-radius: 5px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.calculator {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    font-size: 24px;
}

label {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: #555;
    width: 100%;
}

label span:first-child {
    text-align: right;
    justify-self: end;
}

input {
    width: 100%;
    padding: 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.2s;
    justify-self: center;
}

label span:last-child {
    text-align: left;
    justify-self: start;
}

input:focus {
    border-color: #007BFF;
    outline: none;
}

button {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    color: white;
    background-color: #007BFF;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 15px;
}

button:hover {
    background-color: #0056b3;
}

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

    label {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    label span:first-child,
    label span:last-child {
        text-align: left;
        justify-self: start;
    }

    input {
        justify-self: start;
    }
}

/* Remove spinner controls in number inputs for WebKit browsers (Chrome, Safari) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove spinner controls in number inputs for Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

.header {
    text-align: center;
    margin-bottom: 15px;
}

.logo {
    max-width: 120px;
    height: auto;
}

h1 {
    font-size: 22px;
    margin: 10px 0;
}

p {
    font-size: 14px;
    color: #555;
}

.explanation {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(249, 249, 249, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    font-size: 12px;
    color: #555;
    font-style: italic;
}

/* Divider styles */
.divider {
    width: 100%;
    text-align: center;
    margin: 20px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #007BFF 50%, transparent);
}

.divider-text {
    color: #007BFF;
    font-size: 12px;
    padding: 0 10px;
    background: white;
    font-weight: 500;
    white-space: nowrap;
}

/* Optional: Add some extra spacing around the first two fields */
#employer-calculator label:nth-child(-n+2) {
    margin-bottom: 12px;
}

/* Theme Switch Styles */
.theme-switch-wrapper {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #cbd5e1;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
    border-radius: 50%;
    z-index: 1;
    opacity: 0.9;
}

.slider .sun-icon,
.slider .moon-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    transition: .4s;
    stroke-width: 1.5px;
    z-index: 2;
}

.slider .sun-icon {
    left: 8px;
    stroke: #ff8800;
    fill: #ff8800;
}

.slider .moon-icon {
    right: 8px;
    stroke: #1e293b;
    fill: #1e293b;
}

.theme-switch input:checked + .slider {
    background-color: #1e40af;
}

.theme-switch input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-switch input:checked ~ .slider .moon-icon {
    stroke: #1e293b;
    fill: #1e293b;
    opacity: 1;
}

.theme-switch input:checked ~ .slider .sun-icon {
    opacity: 0.4;
    stroke: #ff8800;
    fill: #ff8800;
}

.theme-switch input:not(:checked) ~ .slider .moon-icon {
    opacity: 0.4;
    stroke: #1e293b;
    fill: #1e293b;
}

.theme-switch input:not(:checked) ~ .slider .sun-icon {
    stroke: #ff8800;
    fill: #ff8800;
    opacity: 1;
}

/* Dark Theme Colors */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

[data-theme="dark"] .calculator-container {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .menu {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-bottom: 1px solid #334155;
}

[data-theme="dark"] .menu-item {
    color: #e2e8f0;
}

[data-theme="dark"] label {
    color: #e2e8f0;
}

[data-theme="dark"] input {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .divider-text {
    background: #1e293b;
    color: #60a5fa;
}

[data-theme="dark"] .explanation,
[data-theme="dark"] .result {
    background-color: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
}

[data-theme="dark"] p {
    color: #e2e8f0;
}

/* Dark theme adjustments for icons */
[data-theme="dark"] .slider .moon-icon {
    stroke: #1e293b;
    fill: #1e293b;
}

/* Remove the old emoji styles */
.slider .sun,
.slider .moon {
    display: none;
}

/* Dark mode styles */
body.dark-mode {
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

body.dark-mode .calculator-container {
    background: rgba(30, 41, 59, 0.95);
}

body.dark-mode .menu {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

body.dark-mode .menu-item {
    color: #e2e8f0;
}

body.dark-mode label {
    color: #e2e8f0;
}

body.dark-mode input {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .divider-text {
    background: #1e293b;
    color: #60a5fa;
}

body.dark-mode .explanation,
body.dark-mode .result {
    background-color: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
}

body.dark-mode p {
    color: #e2e8f0;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .calculator-container {
        width: 95%;
        padding: 0;
        margin: 10px auto;
        min-height: auto;
        box-sizing: border-box;
    }

    .calculator {
        padding: 15px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    label {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-bottom: 15px;
        font-size: 14px;
        box-sizing: border-box;
    }

    label span:first-child {
        text-align: left;
        font-weight: 500;
        width: 100%;
    }

    label span:last-child {
        text-align: left;
        width: 100%;
        font-size: 12px;
    }

    input {
        width: 100%;
        padding: 10px;
        font-size: 16px;
        box-sizing: border-box;
        margin: 2px 0;
    }

    .logo-image {
        max-width: 150px;
    }

    .logo-container {
        margin-bottom: 15px;
        padding: 10px;
    }

    .theme-switch-wrapper {
        top: 10px;
        right: 10px;
        position: absolute;
    }

    /* Adjust divider for mobile */
    .divider {
        margin: 15px 0;
    }

    .divider-text {
        font-size: 11px;
        padding: 0 8px;
    }

    /* Better spacing for results on mobile */
    .result {
        margin-top: 15px;
        padding: 10px;
    }

    .result p {
        font-size: 13px;
        margin: 5px 0;
    }

    /* Adjust explanation text for mobile */
    .explanation {
        margin: 10px 5px;
        padding: 10px;
        font-size: 11px;
    }

    /* Make buttons more tappable on mobile */
    button {
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
        margin-top: 10px;
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 8px;
        gap: 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .menu-item {
        flex: 1 1 45%;
        padding: 8px 4px;
        font-size: 14px;
        white-space: nowrap;
        text-align: center;
        min-width: auto;
    }
}

/* Additional optimizations for very small screens */
@media (max-width: 380px) {
    .menu-item {
        font-size: 12px;
        padding: 6px 2px;
    }

    .logo-image {
        max-width: 150px;
    }

    label {
        font-size: 13px;
    }

    input {
        padding: 8px;
    }

    .menu-item {
        font-size: 11px;
        padding: 6px 2px;
    }
}

/* Ensure proper viewport height on mobile browsers */
@media (max-height: 800px) {
    body {
        min-height: 100vh;
        padding: 10px;
    }

    .calculator-container {
        margin: 5px auto;
    }
}

/* Prevent zoom on input focus for iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) { 
    input {
        font-size: 16px;
    }
    
    select:focus,
    textarea:focus,
    input:focus {
        font-size: 16px;
    }
}

/* Ad Container Styles */
.ad-container {
    min-height: 250px;
    margin: 10px;
    background-color: transparent;
}

.ad-left, .ad-right {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    display: none; /* Hidden by default on mobile */
}

.ad-left {
    left: 10px;
}

.ad-right {
    right: 10px;
}

.ad-bottom {
    width: 100%;
    max-width: 728px;
    margin: 20px auto;
    display: block; /* Shown by default on mobile */
}

/* Show side ads on larger screens */
@media (min-width: 1200px) {
    .ad-left, .ad-right {
        display: block;
    }
    
    .ad-bottom {
        display: none;
    }

    /* Adjust main content to make room for ads */
    body {
        padding: 20px 200px;
    }
}

/* Ensure ads don't overlap with content on medium screens */
@media (max-width: 1199px) and (min-width: 769px) {
    .ad-bottom {
        display: block;
    }
}

.hidden {
    display: none;
}

/* Add these styles for the loan table */
.loan-table-container {
    margin-top: 20px;
    width: 100%;
    overflow-x: auto;
}

.loan-table-container h3 {
    margin-bottom: 10px;
    color: #007BFF;
    font-size: 16px;
}

.loan-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.loan-table th,
.loan-table td {
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}

.loan-table th {
    background-color: #f8f9fa;
    font-weight: 500;
    text-align: center;
}

.loan-table tr:hover {
    background-color: #f5f5f5;
}

/* Dark theme support for loan table */
[data-theme="dark"] .loan-table th {
    background-color: #1e293b;
}

[data-theme="dark"] .loan-table td {
    border-bottom: 1px solid #334155;
}

[data-theme="dark"] .loan-table tr:hover {
    background-color: #334155;
}

/* Mobile responsiveness for table */
@media (max-width: 768px) {
    .loan-table {
        font-size: 12px;
    }
    
    .loan-table th,
    .loan-table td {
        padding: 6px;
    }
}
