/* ============================================================
   ITR Advisor — Custom CSS
   Follows style.md specification exactly
   ============================================================ */

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

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #334155;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Container ───────────────────────────────────────────────── */
.container-custom {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
}

@media (min-width: 640px)  { .container-custom { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container-custom { padding: 0 2rem;   } }
@media (min-width: 1280px) { .container-custom { padding: 0 2.5rem; } }

/* ── Page Wrapper ────────────────────────────────────────────── */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

/* ── Section ─────────────────────────────────────────────────── */
.section { padding: 2.5rem 0; }
@media (min-width: 640px)  { .section { padding: 3rem 0; } }
@media (min-width: 768px)  { .section { padding: 4rem 0; } }
@media (min-width: 1024px) { .section { padding: 5rem 0; } }
@media (min-width: 1280px) { .section { padding: 6rem 0; } }

/* ── Typography ──────────────────────────────────────────────── */
.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: #1a365d;
    font-size: 1.5rem;
    line-height: 1.25;
}
@media (min-width: 768px) { .section-title { font-size: 2.25rem; } }

.section-subtitle {
    font-family: 'Inter', sans-serif;
    color: #475569;
    font-size: 1rem;
    max-width: 65ch;
    line-height: 1.7;
}
@media (min-width: 768px) { .section-subtitle { font-size: 1.125rem; } }

.stat-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: #243b53;
    font-size: 1.75rem;
    line-height: 1;
}
@media (min-width: 768px) { .stat-number { font-size: 2.2rem; } }

.text-responsive-hero { font-size: 2rem; line-height: 1.15; }
@media (min-width: 640px)  { .text-responsive-hero { font-size: 2.75rem; } }
@media (min-width: 1024px) { .text-responsive-hero { font-size: 3.75rem; } }

.text-responsive-lg   { font-size: 1rem; }
@media (min-width: 768px) { .text-responsive-lg { font-size: 1.125rem; } }

.text-responsive-base { font-size: 0.9375rem; }
@media (min-width: 768px) { .text-responsive-base { font-size: 1rem; } }

.text-responsive-sm   { font-size: 0.8125rem; }
@media (min-width: 768px) { .text-responsive-sm { font-size: 0.875rem; } }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    min-height: 44px;
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: #243b53; color: white; }
.btn-primary:hover { background: #1a365d; color: white; }

.btn-secondary { border: 2px solid #243b53; color: #243b53; background: transparent; }
.btn-secondary:hover { background: #243b53; color: white; }

.btn-gold { background: #d69e2e; color: #1a365d; }
.btn-gold:hover { background: #b7791f; color: #1a365d; }

.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover { background: #1ebe57; color: white; }

.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 1rem; font-size: 0.8125rem; min-height: 36px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -2px rgba(0,0,0,.05);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: scale(1.03);
    box-shadow: 0 20px 40px -8px rgba(36,59,83,.15), 0 8px 16px -4px rgba(0,0,0,.08);
}

.card-hover {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.07);
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
}

.card-hover:hover {
    border-color: #d69e2e;
    box-shadow: 0 10px 25px -5px rgba(214,158,46,.15);
    transform: translateY(-2px);
}

/* ── Service Cards ───────────────────────────────────────────── */
.service-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.07);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    min-height: 260px;
}

.service-card-content-hidden,
.service-card-content-shown {
    padding: 2rem 1.5rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.service-card-content-shown {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #243b53;
    color: white;
    border-radius: 0.75rem;
    opacity: 0;
    visibility: hidden;
}

@media (min-width: 1024px) and (hover: hover) {
    .service-card:hover .service-card-content-hidden { opacity: 0; visibility: hidden; }
    .service-card:hover .service-card-content-shown  { opacity: 1; visibility: visible; }
    .service-card:hover { border-color: #d69e2e; }
}

@media (max-width: 1023px) {
    .service-card-content-shown {
        position: relative;
        inset: auto;
        opacity: 1;
        visibility: visible;
        margin-top: 0.5rem;
        border-radius: 0.5rem;
    }
}

.icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: #d9e2ec;
    color: #334e68;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.service-card:hover .icon-wrapper {
    background: #d69e2e;
    color: white;
}

.icon-wrapper svg { transition: transform 0.3s ease; }
.service-card:hover .icon-wrapper svg { transform: scale(1.1); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

.badge-gold  { background: #fef3c7; color: #744210; }
.badge-navy  { background: #d9e2ec; color: #243b53; }
.badge-green { background: #dcfce7; color: #166534; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 16px; /* prevents iOS zoom */
    font-family: inherit;
    color: #334155;
    background: white;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #243b53;
    box-shadow: 0 0 0 3px rgba(36,59,83,.1);
}

.form-input::placeholder,
.form-textarea::placeholder { color: #9ca3af; }

.form-textarea { resize: vertical; min-height: 120px; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.375rem;
}

.form-error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

.form-group { margin-bottom: 1.25rem; }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.07);
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Timeline ────────────────────────────────────────────────── */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid #bcccdc;
    padding-bottom: 2rem;
}

.timeline-item:last-child { border-left-color: transparent; }

.timeline-dot {
    position: absolute;
    left: -0.5rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #d69e2e;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #d69e2e;
}

/* ── Navigation ──────────────────────────────────────────────── */
.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover { color: #243b53; }
.nav-link.active { color: #243b53; font-weight: 600; }

/* Mobile nav links */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-nav-link:hover { background: #f0f4f8; color: #1a365d; }
.mobile-nav-link.active { background: #f0f4f8; color: #1a365d; font-weight: 600; }

/* ── Gradient Backgrounds ────────────────────────────────────── */
.bg-gradient-navy  { background: linear-gradient(to bottom right, #243b53, #1a365d); }
.bg-gradient-light { background: linear-gradient(to bottom right, #f8fafc, white);   }
.bg-gradient-hero  { background: linear-gradient(135deg, #1a365d 0%, #243b53 50%, #2d5282 100%); }

.text-gradient {
    background: linear-gradient(to right, #243b53, #2b6cb0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Scroll Reveal Classes ───────────────────────────────────── */
/* Only hide elements when JS is available — prevents invisible content if JS fails */
.js .fade-up, .js .fade-in, .js .fade-scale, .js .slide-left, .js .slide-right {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
}
.js .fade-up    { transform: translateY(28px); }
.js .fade-scale { transform: scale(0.93); }
.js .slide-left  { transform: translateX(-40px); }
.js .slide-right { transform: translateX(40px); }

.fade-up.in-view,
.fade-in.in-view,
.fade-scale.in-view,
.slide-left.in-view,
.slide-right.in-view {
    opacity: 1;
    transform: none;
}

/* ── CSS-only Animations ──────────────────────────────────────── */
@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.8,0,1,1); }
    50%       { transform: translateY(-8px); animation-timing-function: cubic-bezier(0,0,0.2,1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(214,158,46,.3); }
    50%       { box-shadow: 0 0 40px rgba(214,158,46,.6); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33%       { transform: translateY(-12px) rotate(2deg); }
    66%       { transform: translateY(-6px) rotate(-1deg); }
}

@keyframes pulse-ring {
    0%   { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.animate-bounce-slow { animation: bounce-slow 2s infinite; }
.animate-glow        { animation: glow 2s infinite; }
.float               { animation: float 4s ease-in-out infinite; }
.animate-pulse-ring  { animation: pulse-ring 1.5s ease-out infinite; }

/* ── WhatsApp Float Button ────────────────────────────────────── */
.whatsapp-float {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 999;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37,211,102,.4);
    text-decoration: none;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(37,211,102,.5);
    color: white;
}

/* ── Back to Top ─────────────────────────────────────────────── */
#back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #243b53;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(36,59,83,.3);
}

#back-to-top.visible { opacity: 1; visibility: visible; }
#back-to-top:hover { background: #1a365d; transform: translateY(-2px); }

/* ── Grids ───────────────────────────────────────────────────── */
.grid-responsive-2 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-responsive-3 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-responsive-4 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.stats-grid        { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }

@media (min-width: 640px) {
    .grid-responsive-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-responsive-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-responsive-4 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid        { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .grid-responsive-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-responsive-4 { grid-template-columns: repeat(4, 1fr); }
    .stats-grid        { grid-template-columns: repeat(3, 1fr); }
}

/* ── Footer ──────────────────────────────────────────────────── */
footer a { transition: color 0.2s ease; }
footer a:hover { color: #fbbf24; }

/* ── Accessibility ───────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid #d69e2e;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    background: #243b53;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0 0 0.5rem 0.5rem;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus { top: 0; }

.touch-target { min-height: 44px; min-width: 44px; }

/* ── Responsive visibility ───────────────────────────────────── */
.hide-mobile    { display: none; }
.float-element  { display: none; }
@media (min-width: 768px)  { .hide-mobile   { display: initial; } }
@media (min-width: 1024px) { .float-element { display: block; } }

.show-mobile-only { display: initial; }
@media (min-width: 768px) { .show-mobile-only { display: none; } }

.text-center-mobile { text-align: center; }
@media (min-width: 768px) { .text-center-mobile { text-align: left; } }

/* ── Utility ──────────────────────────────────────────────────── */
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.no-select    { user-select: none; -webkit-user-select: none; }
.break-word   { overflow-wrap: break-word; word-break: break-word; }

[id] { scroll-margin-top: 80px; }
@media (min-width: 768px) { [id] { scroll-margin-top: 100px; } }

.min-h-screen-ios { min-height: -webkit-fill-available; }

.gap-responsive    { gap: 1rem; }
.gap-responsive-lg { gap: 1.5rem; }
@media (min-width: 768px) {
    .gap-responsive    { gap: 1.5rem; }
    .gap-responsive-lg { gap: 2.5rem; }
}

.py-responsive { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.px-responsive { padding-left: 1rem; padding-right: 1rem; }
.mb-responsive { margin-bottom: 1.5rem; }
@media (min-width: 768px) {
    .py-responsive { padding-top: 2.5rem; padding-bottom: 2.5rem; }
    .px-responsive { padding-left: 2rem; padding-right: 2rem; }
    .mb-responsive { margin-bottom: 2rem; }
}

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Hero decorative elements ─────────────────────────────────── */
.hero-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(214,158,46,.08);
    pointer-events: none;
}

/* ── Alert / Toast ────────────────────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ── Mobile Menu Overlay ──────────────────────────────────────── */
#mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    width: min(22rem, 100vw);
    background: white;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 40px rgba(0,0,0,.12);
}

#mobile-menu.open { transform: translateX(0); }

body.mobile-menu-open { overflow: hidden; }

/* ── Mega Menu ────────────────────────────────────────────────── */
.mega-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 8px 16px -4px rgba(36,59,83,.08), 0 24px 64px -12px rgba(36,59,83,.18);
    padding: 1.5rem;
    width: 580px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
    border: 1px solid rgba(36,59,83,.06);
}

/* Arrow pointer */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 7px;
    background: white;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    filter: drop-shadow(0 -2px 2px rgba(36,59,83,.06));
}

.nav-group:hover .mega-menu,
.nav-group:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-group:hover .mega-chevron { transform: rotate(180deg); }

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid rgba(255,255,255,.06); }

/* ── Testimonial card ─────────────────────────────────────────── */
.testimonial-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 20px -4px rgba(36,59,83,.08);
    border: 1px solid #f1f5f9;
    position: relative;
}

.testimonial-card::before {
    content: '"';
    font-family: 'Playfair Display', serif;
    font-size: 5rem;
    color: #fef3c7;
    position: absolute;
    top: -0.5rem;
    left: 1.25rem;
    line-height: 1;
}

/* ── Blog Card ────────────────────────────────────────────────── */
.blog-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.07);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 30px -8px rgba(36,59,83,.12);
    border-color: #d69e2e;
}

.blog-card-img {
    height: 200px;
    background: linear-gradient(135deg, #243b53, #1a365d);
    overflow: hidden;
    position: relative;
}

.blog-card-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }

/* ── Pricing Card ─────────────────────────────────────────────── */
.pricing-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.pricing-card.featured {
    border-color: #d69e2e;
    box-shadow: 0 20px 40px -8px rgba(214,158,46,.2);
}

.pricing-card:not(.featured):hover {
    border-color: #829ab1;
    box-shadow: 0 10px 25px -5px rgba(36,59,83,.1);
}

/* ── Admin Table ──────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #243b53;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    vertical-align: top;
}

.admin-table tr:hover td { background: #f8fafc; }

/* ── Reduced Motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .js .fade-up, .js .fade-in, .js .fade-scale, .js .slide-left, .js .slide-right {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
