/* calculators.css */

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

/* Container styles */
.main-container,
.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Calculator Grid (Home Page) */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px;
}

/* Individual Calculator Pages */
.calculator {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

/* Headers */
h1, h2 {
    text-align: center;
    color: #1a202c;
    margin-bottom: 1.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; margin: 1.5rem 0 1rem; }

/* Form Elements */
label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

/* Buttons */
button, .use-calculator-button {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 15px;
    text-align: center;
    text-decoration: none;
}

button:hover, .use-calculator-button:hover {
    background-color: #3182ce;
}

button.secondary-button {
    background-color: #718096;
    margin-bottom: 15px;
}

button.secondary-button:hover {
    background-color: #4a5568;
}

/* Results Section */
.results {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.results p {
    margin: 10px 0;
}

/* Calculator Items (Home Page) */
.calculator-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.calculator-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Attribution */
.attribution {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    font-size: 0.9rem;
}

.attribution a {
    color: #4299e1;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a202c;
        color: #e2e8f0;
    }

    .calculator,
    .calculator-item {
        background-color: #2d3748;
    }

    input, select {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    h1, h2, h3 {
        color: #e2e8f0;
    }

    label {
        color: #a0aec0;
    }

    .results {
        border-top-color: #4a5568;
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .main-container,
    .calculator-container {
        padding: 15px;
    }

    .calculator {
        padding: 20px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }

    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    input, select, button {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Safe area insets */
@supports (padding: max(0px)) {
    .main-container,
    .calculator-container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Toggle Switch Styles */
.toggle-group {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    z-index: 1;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

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

/* Section Styles */
.section {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.blue-section { background-color: #ebf8ff; }
.pink-section { background-color: #fef1f7; }
.grey-section { background-color: #f7fafc; }

/* Results Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 10px;
    text-align: right;
    border: 1px solid #e2e8f0;
}

th:first-child,
td:first-child {
    text-align: left;
}

.positive { color: #48bb78; }
.negative { color: #f56565; }

.result {
    font-weight: 600;
    margin-top: 5px;
}