/* Add Poppins font import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700&family=Poppins:wght@400;500;600;700&display=swap');

/* Change the body font to Outfit */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
    padding: 0 7px;
}

/* Make all text use Poppins except specific elements */
* {
    font-family: 'Poppins', 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Keep tabs, tables, and th elements with original font */
.tabs,
.tab,
table,
th {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Keep h1 with Outfit (as it was already set) */
h1 {
font-family: 'Poppins', 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root {
    --primary-color: #0ea6ec;
    --primary-dark: #0b85c0;
    --secondary-color: #1a3e72;
    --bg-color: #090f1b;
    --card-bg: #0f172a;
    --text-color: #f1f1f1;
    --text-muted: #94a3b8;
    --highlight-color: #32a852;
    --highlight-dark: #2b9748;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --border-color: #1e293b;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --container-width: min(1000px, 95vw);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    padding: 0 7px;
}

/* Improved container with clamp for better responsiveness */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 15px 7px;
    flex: 1;
}

/* Header styles with better mobile spacing */
header {
    text-align: center;
    margin: 0 auto 1.5rem;
    padding: 0 7px;
    max-width: 800px;
}

h1 {

    font-size: clamp(1.8rem, 5vw, 2.5rem);
    /* Scales perfectly on all devices */
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--primary-color), var(--highlight-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.1;
    /* Reduced for better fit on mobile */
    margin-bottom: 8px;
    display: inline-block;
    position: relative;
    margin-top: 15px;
    ;
}

h1::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 40%;
    height: 2px;
    background: var(--primary-dark);
    transform: translateX(-50%);
    border-radius: 2px;
    opacity: 0.8;
}

/* Media Query: Optimize for Small Screens */
@media (max-width: 600px) {
    h1 {
        font-size: 1.7rem;
        /* Slightly smaller for better fit */
        line-height: 1;
        /* Even tighter for compact display */
        margin-bottom: 5px;
        /* Less spacing for a tighter look */
    }

    h1::after {
        width: 35%;
        /* Smaller underline for mobile */
        height: 1.5px;
    }
}


.subtitle {
    color: var(--text-muted);
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    max-width: 700px;
    margin: 0 auto;
    text-align: center;

}

/* Media Query: Adjust font size for smaller screens */
@media (max-width: 600px) {
    .subtitle {
        font-size: 0.8rem;
        /* Slightly smaller for better mobile fit */
    }
}






/* Grid layout with responsive columns */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0 7px;
}

/* Card styles with performance optimizations */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    will-change: transform;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: clamp(1.1rem, 4vw, 1.25rem);
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.card-title svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* Form elements with better mobile UX */
.form-group {
    margin-bottom: 0.75rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
    -webkit-appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 166, 236, 0.2);
}

/* Buttons with better touch targets */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
    white-space: nowrap;
    min-height: 44px;
    /* Better for touch */
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.checkmark:after {
    content: "";
    position: absolute;
    left: 4px;
    top: 4px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.checkbox-container input:checked~.checkmark {
    background-color: #38b2ac;
    /* Teal-400 */
}

.checkbox-container input:checked~.checkmark:after {
    transform: translateX(32px);
}

.checkbox-container:hover input~.checkmark {
    background-color: #cbd5e0;
}

.checkbox-container:hover input:checked~.checkmark {
    background-color: #319795;
    /* Teal-500 */
}

.checkbox-container input:focus~.checkmark {
    box-shadow: 0 0 0 3px rgba(56, 178, 172, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #142a57;
    transform: translateY(-2px);
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Results section */
.results {
    margin-top: 1.5rem;
}

.summary-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.summary-item {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-3px);
}

.summary-item.income {
    border-left-color: var(--highlight-color);
}

.summary-item.expense {
    border-left-color: var(--danger-color);
}

.summary-item.savings {
    border-left-color: var(--warning-color);
}

.summary-item-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.summary-item-value {
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    font-weight: 700;
}

/* Chart container with aspect ratio */
.chart-container {
    height: 0;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    position: relative;
    margin-top: 1.5rem;
}

.chart-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Tables with responsive font sizes */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: clamp(0.8rem, 3vw, 0.9rem);
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Tabs with better mobile scrolling */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 7px;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 0.75rem 1rem;
    cursor: pointer;
    position: relative;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}

.tab:hover,
.tab:focus {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 0 7px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced footer with better spacing */
footer {
    background-color: var(--card-bg);
    padding: 1.5rem 7px;
    text-align: center;
    color: var(--text-muted);
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.footer-content p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.footer-credit {
    font-size: 0.85rem;
    margin-top: 1rem;
}

.footer-credit a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-credit a:hover {
    text-decoration: underline;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .btn-group {
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    th,
    td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem 5px;
    }


    input,
    select {
        padding: 0.65rem;
    }
}

/* Print styles */
@media print {
    body {
        background-color: white;
        color: black;
        padding: 0;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .btn,
    .tabs,
    .social-share,
    footer {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}



@media (max-width: 480px) {
    .social-share {
        gap: 6px;
    }

    .social-btn {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    .btn-text {
        display: none;
    }

    .social-btn svg {
        width: 12px !important;
        height: 12px !important;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .social-btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }

    .btn-text {
        display: inline;
    }
}