@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --muted-text: #6c757d;
    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --border-radius: 8px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    font-family: var(--font-family);
    color: var(--dark-text);
    background-color: #f3f4f6;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
}

/* Header & Navigation */
.navbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
}
.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-link {
    font-weight: 500;
    color: #4b5563 !important;
    display: flex;
    align-items: center;
    gap: 6px;
}
@media (min-width: 992px) {
    .navbar-nav {
        align-items: center;
    }
}
.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Page Wrapper */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #ffffff;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hero-section h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.5rem;
}
.hero-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Live Search Container */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 1rem 0 0 0;
}
.search-input {
    border-radius: 20px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: all 0.2s ease;
}
.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}
.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-text);
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 5px;
}
.search-results .search-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--dark-text);
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}
.search-results .search-item:last-child {
    border-bottom: none;
}
.search-results .search-item:hover {
    background-color: var(--light-bg);
}

/* Grid & Layout Structure */
.layout-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 992px) {
    .layout-container {
        grid-template-columns: 8fr 4fr;
    }
}

/* Card Styling */
.card-custom {
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.card-custom-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Two-column Form layout */
.form-grid-two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) {
    .form-grid-two-col {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group-custom {
    margin-bottom: 0.75rem;
}
.form-group-custom label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.35rem;
}
.form-input-row {
    display: flex;
    gap: 6px;
    width: 100%;
}
.form-select-custom, .form-input-custom {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #ffffff;
    outline: none;
    flex: 1;
    min-width: 0; /* Enable shrinking without overflow */
}
.form-select-custom:focus, .form-input-custom:focus {
    border-color: var(--primary-color);
}
.form-select-custom {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234b5563' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 10px 8px;
    padding-right: 1.25rem !important;
}
.select-day {
    flex: 1;
    min-width: 55px;
    max-width: 70px;
}
.select-month {
    flex: 2;
    min-width: 95px;
}
/* ---- Custom Year Picker ---- */
.year-picker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1.5;
    min-width: 75px;
    max-width: 115px;
}
.year-picker-wrap .year-picker-input {
    flex: 1;
    width: 100%;
    padding-right: 1.6rem !important;
    min-width: 0;
    cursor: text;
}
.year-picker-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}
.year-picker-btn svg { pointer-events: none; }
.year-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.year-picker-dropdown.open { display: block; }
.year-picker-option {
    padding: 6px 10px;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--dark-text);
    transition: background 0.1s;
    white-space: nowrap;
}
.year-picker-option:hover { background: #f0f4ff; color: var(--primary-color); }
.year-picker-option.active {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}
.year-picker-option.hidden { display: none; }
/* Keep .input-year as alias for backward compat sizing */
.input-year { flex: 1.5; min-width: 75px; max-width: 115px; }
.btn-primary-custom {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}
.btn-primary-custom:hover {
    background-color: var(--primary-hover);
}

/* Results Display Styling */
.result-box {
    background: #f8fafc;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
}
.result-box-success {
    background: #f0fdf4;
    border-left-color: var(--success-color);
}
.result-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 0.25rem;
}
.result-main-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}
.result-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
@media (min-width: 576px) {
    .result-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.result-detail-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.result-detail-label {
    font-size: 0.75rem;
    color: var(--muted-text);
    margin-bottom: 0.2rem;
}
.result-detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    word-break: break-all;
}

/* Mini Calendar CSS Grid */
.mini-calendar {
    max-width: 250px;
    margin: 0 auto;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.calendar-day-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    color: var(--muted-text);
    padding-bottom: 4px;
}
.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    height: 24px;
}
.calendar-day.blank {
    background: transparent;
}

/* Popular calculators cards */
.calculator-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 576px) {
    .calculator-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 768px) {
    .calculator-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1200px) {
    .calculator-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.calc-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-decoration: none;
    color: var(--dark-text);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.calc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
    border-color: var(--primary-color);
}
.calculator-cards-grid .calc-card {
    height: 100%;
    min-height: 110px;
    padding: 0.75rem 1rem;
}
.calculator-cards-grid .calc-card-icon,
.calculator-cards-grid .calc-card-icon img {
    max-height: 80px;
    max-width: 80px;
}
.calc-card-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    background: rgba(13, 110, 253, 0.08);
    border-radius: 6px;
    padding: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.calc-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.calc-card-desc {
    font-size: 0.8rem;
    color: var(--muted-text);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* FAQ Section */
.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}
.faq-item:last-child {
    border-bottom: none;
}
.faq-question {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-answer {
    font-size: 0.85rem;
    color: #4b5563;
    padding-top: 0.5rem;
    display: none;
}

/* Ads Styles */
.ad-placeholder, .ad-placeholder-sticky {
    border-radius: 4px;
    overflow: hidden;
}

/* Footer Styling */
footer {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 2.5rem 1rem 1.5rem 1rem;
    margin-top: 2.5rem;
    border-top: 1px solid #334155;
    font-size: 0.9rem;
}
footer a {
    color: #cbd5e1;
    text-decoration: none;
}
footer a:hover {
    color: #ffffff;
}

/* Blog Styles */
.blog-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
}
.blog-img {
    height: 160px;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-text);
    object-fit: cover;
    width: 100%;
}
.blog-content {
    padding: 1rem;
}
.blog-meta {
    font-size: 0.75rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}
.blog-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.blog-title a {
    color: var(--dark-text);
    text-decoration: none;
}
.blog-title a:hover {
    color: var(--primary-color);
}
.blog-excerpt {
    font-size: 0.85rem;
    color: #4b5563;
}

@media (min-width: 768px) {
    .border-start-md {
        border-left: 1px solid rgba(0, 0, 0, 0.1);
    }
}

