/* SelfFi Home Page Styles */

/* CSS Custom Properties for unified design system */
:root {
    --primary-color: #4D4DDC;
    --primary-dark: #3636A5;
    --accent-color: #6F6FF2;
    --secondary-color: #5b4b8a;
    --secondary-dark: #4a3d6b;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --background-color: #f5f7fa;
    --card-background: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --light-gray: #ecf0f1;
    --medium-gray: #bdc3c7;
    --hover-bg: #edf2f7;
    --purple-light: #9b8bb3;
    --purple-lighter: #b8a9d1;
    --animation-duration: 0.3s;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --background-light: #f5f7fa;
    --text-dark: #2d3748;
    --border-light: #e2e8f0;
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    /* Savings Goals specific colors */
    --savings-goals-primary: #4CAF50;
    --savings-goals-secondary: #81C784;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
}

/* Touch-friendly input improvements */
input, select, textarea {
    /* Larger touch targets */
    min-height: 44px;
    
    /* Better mobile appearance */
    -webkit-appearance: none;
    border-radius: 8px;
    
    /* Prevent zoom on double-tap */
    touch-action: manipulation;
    
    /* Better touch feedback */
    transition: all 0.2s ease;
}

/* Remove iOS styling */
input[type="number"], 
input[type="text"], 
input[type="email"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

/* Mobile-optimized hover states */
@media (hover: hover) {
    /* Only apply hover effects on devices that support hover */
    .calculator-btn:hover {
        transform: translateY(-2px);
    }
    
    .calculator-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    }
}

@media (hover: none) {
    /* Touch-specific styles */
    .calculator-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
    
    .calculator-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* Remove hover effects on touch devices */
    .calculator-card:hover {
        transform: none;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    }
}

/* Keyboard-aware sticky elements */
.floating-home-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 15px rgba(77, 77, 220, 0.3);
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 1000;
    /* Use environment-safe-area for newer iOS devices */
    bottom: max(20px, env(safe-area-inset-bottom));
}

/* Container Styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* Header Styles - Matching existing calculators */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px 16px 0 0;
    margin: -30px -30px 30px -30px;
    padding: 60px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 2;
}

.header h1 {
    color: white;
    margin-bottom: 16px;
    font-size: 3rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 300;
    letter-spacing: 2px;
}

.header .tagline {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 0;
    font-style: italic;
}

.header-graphic {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    opacity: 0.1;
}

.graphic-element {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.graphic-element:nth-child(1) {
    width: 200px;
    height: 200px;
    top: -50px;
    right: -50px;
}

.graphic-element:nth-child(2) {
    width: 150px;
    height: 150px;
    bottom: -30px;
    left: 10%;
}

.graphic-element:nth-child(3) {
    width: 100px;
    height: 100px;
    top: 30%;
    left: 60%;
}

/* Main Content */
.main-content {
    padding: 0;
}

.intro-section {
    text-align: center;
    margin-bottom: 50px;
    padding: 0 20px;
}

.intro-section h2 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.intro-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Calculator Grid Layout */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 30px;
    position: relative;
    padding: 0 20px;
    margin-bottom: 60px;
}

/* All cards have consistent styling */
.calculator-grid .simple-card {
    min-height: 190px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.calculator-grid .simple-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Fourth and fifth cards (bottom row) span across middle columns to center them */
.calculator-grid .simple-card:nth-child(4) {
    grid-column: 1 / 2;
    grid-row: 2;
}

.calculator-grid .simple-card:nth-child(5) {
    grid-column: 3 / 4;
    grid-row: 2;
}

/* SPECIFIC FIX for perfect grid alignment at medium width */
@media screen and (max-width: 700px) and (min-width: 620px) {
    /* Make all cards the same height for perfect grid alignment */
    .calculator-grid .simple-card {
        min-height: 220px !important;
        max-height: 220px !important;
    }
    
    /* Adjust gaps for tighter alignment */
    .calculator-grid {
        gap: 20px !important;
    }
}

/* Media query for better grid alignment at medium screen sizes */
@media screen and (max-width: 900px) and (min-width: 600px) {
    .calculator-grid .simple-card {
        min-height: 240px;
    }
}

/* Compact styling for the simple cards */
.simple-card .card-header {
    padding: 15px 20px 10px;
}

.simple-card .card-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.simple-card .card-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.simple-card .card-content {
    padding: 0 20px 10px;
    flex: 1;
}

.simple-card .card-content p {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0;
}

.simple-card .card-footer {
    padding: 10px 20px 15px;
    margin-top: auto;
}

.simple-card .calculator-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
}

/* Calculator Cards */
.calculator-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all var(--animation-duration) ease;
    position: relative;
    border: 1px solid #f0f4f8;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 2.7s ease forwards;
}

.calculator-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.calculator-card.featured {
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.calculator-card.featured:hover {
    transform: scale(1.02) translateY(-8px);
}

.featured-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(77, 77, 220, 0.3);
}

.new-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(91, 75, 138, 0.3);
}

/* Specific new badge colors for each card type */
.mortgage-card .new-badge,
.resp-card .new-badge,
.savings-goals-card .new-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 2px 8px rgba(77, 77, 220, 0.3);
}

.income-savings-card .new-badge,
.car-ownership-card .new-badge {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    box-shadow: 0 2px 8px rgba(91, 75, 138, 0.3);
}

/* Coming Soon Banner */
.coming-soon-banner {
    position: absolute;
    top: 25px;
    right: -35px;
    background: linear-gradient(135deg, var(--purple-light), var(--secondary-color));
    color: white;
    padding: 8px 50px;
    transform: rotate(45deg);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(91, 75, 138, 0.3);
}

/* Card Headers */
.card-header {
    padding: 30px 25px 20px;
    text-align: center;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-color), #667eea);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: all var(--animation-duration) ease;
    margin-bottom: 16px;
}

.income-savings-card .card-icon {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    color: white;
}

.mortgage-card .card-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.savings-goals-card .card-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.calculator-card:hover .card-icon {
    transform: scale(1.1);
}

.card-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Card Content */
.card-content {
    padding: 0 25px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.feature-list li i {
    color: var(--success-color);
    margin-right: 10px;
    font-size: 0.9rem;
}

.feature-list.disabled li i {
    color: var(--medium-gray);
}

.feature-list.disabled li {
    color: var(--text-secondary);
}

.card-footer {
    padding: 0 25px 25px;
    margin-top: auto;
}

.calculator-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--animation-duration) ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.2);
    position: relative;
    overflow: hidden;
}

.calculator-btn span,
.calculator-btn i {
    position: relative;
    z-index: 2;
}

.income-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    box-shadow: 0 4px 12px rgba(91, 75, 138, 0.2);
}

.income-btn:hover {
    box-shadow: 0 6px 16px rgba(91, 75, 138, 0.3);
    transform: translateY(-2px);
}

.mortgage-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.2);
}

.mortgage-btn:hover {
    box-shadow: 0 6px 16px rgba(77, 77, 220, 0.3);
    transform: translateY(-2px);
}

.car-ownership-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    box-shadow: 0 4px 12px rgba(91, 75, 138, 0.2);
}

.car-ownership-btn:hover {
    box-shadow: 0 6px 16px rgba(91, 75, 138, 0.3);
    transform: translateY(-2px);
}

.car-ownership-card .card-icon {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
}

.resp-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.2);
}

.resp-btn:hover {
    box-shadow: 0 6px 16px rgba(77, 77, 220, 0.3);
    transform: translateY(-2px);
}

.resp-card .card-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.savings-goals-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.2);
}

.savings-goals-btn:hover {
    box-shadow: 0 6px 16px rgba(77, 77, 220, 0.3);
    transform: translateY(-2px);
}

.retirement-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 12px rgba(77, 77, 220, 0.2);
}

.retirement-btn:hover {
    box-shadow: 0 6px 16px rgba(77, 77, 220, 0.3);
    transform: translateY(-2px);
}

.retirement-card .card-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.loans-card .card-icon {
    background: linear-gradient(135deg, var(--secondary-color), var(--purple-light));
    color: white;
}

.future-features {
    margin-top: 30px;
    padding: 0 20px;
}

.future-features h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: center;
}

.future-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.future-item i {
    color: var(--medium-gray);
    margin-right: 10px;
    font-size: 0.8rem;
}

.coming-soon {
    opacity: 0.7;
}

.coming-soon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.05) 10px,
        transparent 10px,
        transparent 20px
    );
    pointer-events: none;
}

.floating-home-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    box-shadow: 0 4px 15px rgba(77, 77, 220, 0.3);
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-home-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.floating-home-btn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: white;
    text-decoration: none;
    font-size: 24px;
    transition: all 0.3s ease;
}

.floating-home-btn a:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.floating-home-btn a:active {
    transform: scale(0.95);
}

.site-footer {
    background-color: #f5f7fa;
    border-top: 1px solid #e2e8f0;
    padding: 15px 20px;
    margin-top: 30px;
    color: #718096;
    font-size: 0.85rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

.footer-left, .footer-right {
    display: flex;
    flex-direction: column;
}

.footer-left p {
    margin: 0 0 5px 0;
}

.footer-credit, .footer-powered {
    font-weight: 500;
}

.footer-contact {
    font-weight: 500;
}

.footer-contact i {
    margin-right: 4px;
    color: #4D4DDC;
}

.footer-contact a {
    color: #4D4DDC;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-contact a:hover {
    color: #3636A5;
    text-decoration: underline;
}

.version {
    text-align: right;
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

@media screen and (max-width: 768px) {
    .site-footer {
        padding: 12px 15px;
        font-size: 0.75rem;
    }
    
    .footer-left p {
        margin: 0 0 3px 0;
    }
    
    .version {
        font-size: 0.7rem;
    }
}

/* Tablet Layout (1024px and below) */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .calculator-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, auto);
        gap: 25px;
    }
    
    /* First three cards: two on first row, one on second row */
    .calculator-grid .simple-card:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .calculator-grid .simple-card:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    
    .calculator-grid .simple-card:nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
        justify-self: center;
        max-width: 400px;
    }
    
    /* Fourth and fifth cards on third row */
    .calculator-grid .simple-card:nth-child(4) {
        grid-column: 1;
        grid-row: 3;
        margin: 0;
    }
    
    .calculator-grid .simple-card:nth-child(5) {
        grid-column: 2;
        grid-row: 3;
        margin: 0;
    }
    
    .calculator-grid .simple-card {
        min-height: 200px;
    }
}

/* Tablet Layout (768px and below) */
@media screen and (max-width: 768px) and (min-width: 601px) {
    .calculator-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, auto);
        gap: 20px;
        padding: 0 15px;
    }
    
    /* First two cards on first row */
    .calculator-grid .simple-card:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .calculator-grid .simple-card:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    
    /* Third card centered on second row */
    .calculator-grid .simple-card:nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
        justify-self: center;
        max-width: 350px;
    }
    
    /* Fourth and fifth cards on third row */
    .calculator-grid .simple-card:nth-child(4) {
        grid-column: 1;
        grid-row: 3;
        margin: 0;
    }
    
    .calculator-grid .simple-card:nth-child(5) {
        grid-column: 2;
        grid-row: 3;
        margin: 0;
    }
    
    .calculator-grid .simple-card {
        min-height: 220px;
    }
    
    .card-header {
        padding: 20px 20px 15px;
    }
    
    .card-content {
        padding: 0 20px 15px;
    }
    
    .card-footer {
        padding: 0 20px 20px;
    }
    
    .simple-card .card-header {
        padding: 12px 15px 8px;
    }
    
    .simple-card .card-content {
        padding: 0 15px 8px;
    }
    
    .simple-card .card-footer {
        padding: 8px 15px 12px;
    }
}

/* Mobile Layout (600px and below) */
@media screen and (max-width: 600px) {
    body {
        padding: 5px;
        overscroll-behavior: none;
    }
    
    .container {
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--background-color);
    }
    
    .header {
        margin: 0 0 20px 0;
        border-radius: 0;
        padding: 40px 20px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .header .tagline {
        font-size: 1.1rem;
    }
    
    .intro-section h2 {
        font-size: 1.8rem;
    }
    
    .intro-section p {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .card-header h3 {
        font-size: 1.3rem;
        line-height: 1.3;
    }
    
    .card-content p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .feature-list li {
        font-size: 0.85rem;
    }
    
    .calculator-btn {
        padding: 14px 20px;
        font-size: 0.9rem;
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .featured-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .new-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .coming-soon-banner {
        font-size: 0.8rem;
        padding: 6px 40px;
    }
    
    .footer-left p,
    .footer-contact {
        font-size: 0.8rem;
    }
    
    /* Single column layout for mobile */
    .calculator-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 0 5px;
        margin-bottom: 40px;
    }
    
    /* Mobile-specific card ordering */
    .calculator-grid .mortgage-card {
        order: 1;
    }
    
    .calculator-grid .calculator-card.tax-card {
        order: 2 !important;
    }
    
    .calculator-grid .retirement-card {
        order: 3;
    }
    
    .calculator-grid .loans-card {
        order: 4;
    }
    
    .calculator-grid .resp-card {
        order: 5;
    }
    
    .calculator-grid .income-savings-card {
        order: 6;
    }
    
    .calculator-grid .savings-goals-card {
        order: 7;
    }
    
    .calculator-grid .car-ownership-card {
        order: 8;
    }
    
    /* Reset grid positioning for mobile */
    .calculator-grid .simple-card:nth-child(4),
    .calculator-grid .simple-card:nth-child(5) {
        grid-column: 1;
        grid-row: auto;
        margin: 0;
        max-width: none;
        justify-self: stretch;
    }
    
    .calculator-card {
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        border: none;
    }
    
    /* Remove hover effects on mobile */
    .calculator-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .calculator-card.featured {
        transform: none;
    }
    
    .calculator-card.featured:hover {
        transform: none;
    }
    
    .calculator-grid .simple-card {
        min-height: 140px;
    }
    
    .calculator-grid .simple-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .feature-list {
        display: none;
    }
    
    .card-header {
        padding: 15px 20px 10px;
    }
    
    .card-content {
        padding: 0 20px 15px;
    }
    
    .card-footer {
        padding: 0 20px 20px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: left;
        padding: 0 5px;
    }
    
    .footer-right {
        text-align: center;
        justify-content: center;
    }
    
    .site-footer {
        padding: 30px 15px 15px;
        margin-top: 40px;
    }
    
    /* Specific card color themes for mobile differentiation */
    .income-savings-card {
        border-left: 4px solid var(--secondary-color);
    }
    
    .car-ownership-card {
        border-left: 4px solid var(--secondary-color);
    }
    
    .mortgage-card {
        border-left: 4px solid var(--primary-color);
    }
    
    .resp-card {
        border-left: 4px solid var(--primary-color);
    }
    
    .savings-goals-card {
        border-left: 4px solid var(--primary-color);
    }
    
    .retirement-card {
        border-left: 4px solid var(--primary-color);
    }
    
    .loans-card {
        border-left: 4px solid var(--secondary-color);
    }
    
    /* Mobile-specific animation delays */
    .calculator-card.mortgage-card {
        animation-delay: 0.2s !important;
    }
    
    .calculator-card.tax-card {
        animation-delay: 0.4s !important;
    }
    
    .calculator-card.retirement-card {
        animation-delay: 0.6s !important;
    }
    
    .calculator-card.loans-card {
        animation-delay: 0.8s !important;
    }
    
    .calculator-card.resp-card {
        animation-delay: 1.0s !important;
    }
    
    .calculator-card.income-savings-card {
        animation-delay: 1.2s !important;
    }
    
    .calculator-card.savings-goals-card {
        animation-delay: 1.4s !important;
    }
    
    .calculator-card.car-ownership-card {
        animation-delay: 1.6s !important;
    }
}

/* Extra small mobile (480px and below) */
@media screen and (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header .tagline {
        font-size: 1rem;
    }
    
    .intro-section h2 {
        font-size: 1.6rem;
    }
    
    .intro-section p {
        font-size: 0.9rem;
    }
    
    .card-header h3 {
        font-size: 1.2rem;
    }
    
    .card-content p {
        font-size: 0.85rem;
    }
    
    .calculator-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .featured-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .new-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .coming-soon-banner {
        font-size: 0.7rem;
        padding: 5px 35px;
    }
    
    .footer-left p,
    .footer-contact {
        font-size: 0.75rem;
    }
    
    .calculator-grid {
        gap: 12px;
        padding: 0;
    }
    
    .calculator-grid .simple-card {
        min-height: 130px;
    }
    
    .card-header {
        padding: 12px 15px 8px;
    }
    
    .card-content {
        padding: 0 15px 12px;
    }
    
    .card-footer {
        padding: 0 15px 15px;
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional specific card styling - Desktop animation delays */
@media screen and (min-width: 769px) {
    .mortgage-card {
        animation-delay: 0.2s;
    }

    .income-savings-card,
    .car-ownership-card {
        animation-delay: 0.4s;
    }

    .resp-card,
    .savings-goals-card {
        animation-delay: 0.6s;
    }

    .tax-card {
        animation-delay: 0.8s;
    }

    .retirement-card {
        animation-delay: 1.0s;
    }

    .loans-card {
        animation-delay: 1.2s;
    }
}

/* Mobile animation delays (updated) */
@media screen and (max-width: 768px) {
    .mortgage-card {
        animation-delay: 0.2s;
    }

    .calculator-card.tax-card {
        animation-delay: 0.4s !important;
    }

    .retirement-card {
        animation-delay: 0.6s;
    }

    .loans-card {
        animation-delay: 0.8s;
    }

    .resp-card {
        animation-delay: 1.0s;
    }

    .income-savings-card {
        animation-delay: 1.2s;
    }

    .savings-goals-card {
        animation-delay: 1.4s;
    }

    .car-ownership-card {
        animation-delay: 1.6s;
    }

    .calculator-grid .simple-card:last-child:nth-child(3n + 1) {
        grid-column-start: 2;
        grid-column-end: 3;
    }
}

.form-validation-error {
    animation: shake 0.3s ease-in-out;
    border-color: var(--danger-color) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Keyboard visibility handling for better mobile UX */
@media (max-height: 600px) {
    body:has(input:focus) .floating-home-btn {
        display: none;
    }
}

/* Accessibility improvements */
html {
    scroll-behavior: smooth;
}

/* Focus styles for keyboard navigation */
input:focus, select:focus, textarea:focus, button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading animation for dynamic content */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Star Animation - Similar to banner stars but for buttons */
.btn-stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    border-radius: 12px;
}

.btn-star {
    position: absolute;
    color: white;
    font-size: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    animation: btnStarMove 3s linear infinite, btnTwinkle 1.5s ease-in-out infinite alternate;
    animation-play-state: paused;
}

.calculator-btn:hover .btn-star {
    opacity: 1;
    visibility: visible;
    animation-play-state: running;
}

@keyframes btnStarMove {
    0% {
        transform: translate(0px, 0px);
        opacity: 0;
    }
    15% {
        opacity: 0.9;
    }
    85% {
        opacity: 0.9;
    }
    100% {
        transform: translate(80px, -40px);
        opacity: 0;
    }
}

@keyframes btnTwinkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.8);
        color: white;
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        color: white;
    }
}

/* Individual star positioning for buttons */
.btn-star-1 {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
    font-size: 10px;
}

.btn-star-2 {
    top: 60%;
    left: 25%;
    animation-delay: -0.8s;
    font-size: 8px;
}

.btn-star-3 {
    top: 40%;
    left: 70%;
    animation-delay: -1.6s;
    font-size: 12px;
}

.btn-star-4 {
    top: 80%;
    left: 60%;
    animation-delay: -2.4s;
    font-size: 9px;
}

.btn-star-5 {
    top: 15%;
    left: 80%;
    animation-delay: -1.2s;
    font-size: 11px;
}

/* Unique star positions for Income & Savings button */
.income-btn .btn-star-1 {
    top: 25%;
    left: 10%;
    animation-delay: 0s;
    font-size: 11px;
}

.income-btn .btn-star-2 {
    top: 70%;
    left: 30%;
    animation-delay: -1.0s;
    font-size: 9px;
}

.income-btn .btn-star-3 {
    top: 35%;
    left: 75%;
    animation-delay: -2.0s;
    font-size: 13px;
}

.income-btn .btn-star-4 {
    top: 85%;
    left: 65%;
    animation-delay: -1.5s;
    font-size: 8px;
}

.income-btn .btn-star-5 {
    top: 10%;
    left: 85%;
    animation-delay: -0.5s;
    font-size: 10px;
}

/* Unique star positions for Mortgage Calculator button */
.mortgage-btn .btn-star-1 {
    top: 30%;
    left: 20%;
    animation-delay: -0.3s;
    font-size: 12px;
}

.mortgage-btn .btn-star-2 {
    top: 65%;
    left: 15%;
    animation-delay: -1.2s;
    font-size: 10px;
}

.mortgage-btn .btn-star-3 {
    top: 45%;
    left: 80%;
    animation-delay: -1.8s;
    font-size: 9px;
}

.mortgage-btn .btn-star-4 {
    top: 75%;
    left: 70%;
    animation-delay: -2.1s;
    font-size: 11px;
}

.mortgage-btn .btn-star-5 {
    top: 20%;
    left: 90%;
    animation-delay: -0.7s;
    font-size: 8px;
}

/* Unique star positions for Car Ownership Calculator button */
.car-ownership-btn .btn-star-1 {
    top: 15%;
    left: 25%;
    animation-delay: -0.6s;
    font-size: 9px;
}

.car-ownership-btn .btn-star-2 {
    top: 55%;
    left: 20%;
    animation-delay: -1.4s;
    font-size: 12px;
}

.car-ownership-btn .btn-star-3 {
    top: 30%;
    left: 85%;
    animation-delay: -2.2s;
    font-size: 10px;
}

.car-ownership-btn .btn-star-4 {
    top: 90%;
    left: 55%;
    animation-delay: -1.7s;
    font-size: 11px;
}

.car-ownership-btn .btn-star-5 {
    top: 25%;
    left: 75%;
    animation-delay: -0.9s;
    font-size: 8px;
}

/* Unique star positions for RESP Calculator button */
.resp-btn .btn-star-1 {
    top: 35%;
    left: 5%;
    animation-delay: -0.4s;
    font-size: 10px;
}

.resp-btn .btn-star-2 {
    top: 75%;
    left: 35%;
    animation-delay: -1.6s;
    font-size: 9px;
}

.resp-btn .btn-star-3 {
    top: 25%;
    left: 65%;
    animation-delay: -2.3s;
    font-size: 12px;
}

.resp-btn .btn-star-4 {
    top: 60%;
    left: 85%;
    animation-delay: -1.1s;
    font-size: 8px;
}

.resp-btn .btn-star-5 {
    top: 5%;
    left: 90%;
    animation-delay: -1.9s;
    font-size: 11px;
}

/* Unique star positions for Savings Goals Calculator button */
.savings-goals-btn .btn-star-1 {
    top: 40%;
    left: 12%;
    animation-delay: -0.8s;
    font-size: 11px;
}

.savings-goals-btn .btn-star-2 {
    top: 80%;
    left: 25%;
    animation-delay: -1.3s;
    font-size: 8px;
}

.savings-goals-btn .btn-star-3 {
    top: 20%;
    left: 60%;
    animation-delay: -2.5s;
    font-size: 10px;
}

.savings-goals-btn .btn-star-4 {
    top: 65%;
    left: 90%;
    animation-delay: -0.2s;
    font-size: 12px;
}

.savings-goals-btn .btn-star-5 {
    top: 10%;
    left: 75%;
    animation-delay: -1.8s;
    font-size: 9px;
}

/* Unique star positions for Retirement Calculator button */
.retirement-btn .btn-star-1 {
    top: 25%;
    left: 18%;
    animation-delay: -0.5s;
    font-size: 10px;
}

.retirement-btn .btn-star-2 {
    top: 70%;
    left: 28%;
    animation-delay: -1.7s;
    font-size: 8px;
}

.retirement-btn .btn-star-3 {
    top: 35%;
    left: 72%;
    animation-delay: -2.4s;
    font-size: 11px;
}

.retirement-btn .btn-star-4 {
    top: 85%;
    left: 80%;
    animation-delay: -0.9s;
    font-size: 9px;
}

.retirement-btn .btn-star-5 {
    top: 15%;
    left: 88%;
    animation-delay: -2.1s;
    font-size: 10px;
}

/* Mobile optimizations for button star animations */
@media screen and (max-width: 768px) {
  .btn-star {
    font-size: 8px;
    animation-duration: 2.5s;
  }
  
  .btn-star-1 { font-size: 8px; }
  .btn-star-2 { font-size: 6px; }
  .btn-star-3 { font-size: 10px; }
  .btn-star-4 { font-size: 7px; }
  .btn-star-5 { font-size: 9px; }
  
  /* Unique mobile positions for Income & Savings button */
  .income-btn .btn-star-1 { font-size: 9px; }
  .income-btn .btn-star-2 { font-size: 7px; }
  .income-btn .btn-star-3 { font-size: 11px; }
  .income-btn .btn-star-4 { font-size: 6px; }
  .income-btn .btn-star-5 { font-size: 8px; }
  
  /* Unique mobile positions for Mortgage Calculator button */
  .mortgage-btn .btn-star-1 { font-size: 10px; }
  .mortgage-btn .btn-star-2 { font-size: 8px; }
  .mortgage-btn .btn-star-3 { font-size: 7px; }
  .mortgage-btn .btn-star-4 { font-size: 9px; }
  .mortgage-btn .btn-star-5 { font-size: 6px; }
  
  /* Unique mobile positions for Car Ownership Calculator button */
  .car-ownership-btn .btn-star-1 { font-size: 7px; }
  .car-ownership-btn .btn-star-2 { font-size: 10px; }
  .car-ownership-btn .btn-star-3 { font-size: 8px; }
  .car-ownership-btn .btn-star-4 { font-size: 9px; }
  .car-ownership-btn .btn-star-5 { font-size: 6px; }
  
  /* Unique mobile positions for RESP Calculator button */
  .resp-btn .btn-star-1 { font-size: 8px; }
  .resp-btn .btn-star-2 { font-size: 7px; }
  .resp-btn .btn-star-3 { font-size: 10px; }
  .resp-btn .btn-star-4 { font-size: 6px; }
  .resp-btn .btn-star-5 { font-size: 9px; }
  
  /* Unique mobile positions for Savings Goals Calculator button */
  .savings-goals-btn .btn-star-1 { font-size: 9px; }
  .savings-goals-btn .btn-star-2 { font-size: 6px; }
  .savings-goals-btn .btn-star-3 { font-size: 8px; }
  .savings-goals-btn .btn-star-4 { font-size: 10px; }
  .savings-goals-btn .btn-star-5 { font-size: 7px; }
  
  /* Unique mobile positions for Retirement Calculator button */
  .retirement-btn .btn-star-1 { font-size: 8px; }
  .retirement-btn .btn-star-2 { font-size: 6px; }
  .retirement-btn .btn-star-3 { font-size: 9px; }
  .retirement-btn .btn-star-4 { font-size: 7px; }
  .retirement-btn .btn-star-5 { font-size: 8px; }
  
  /* Trigger star animation on touch/active for mobile */
  .calculator-btn:active .btn-star {
    opacity: 1;
    visibility: visible;
    animation-play-state: running;
  }
}

@media screen and (max-width: 480px) {
  .btn-star {
    font-size: 6px;
    animation-duration: 2s;
  }
  
  .btn-star-1 { font-size: 6px; }
  .btn-star-2 { font-size: 5px; }
  .btn-star-3 { font-size: 8px; }
  .btn-star-4 { font-size: 5px; }
  .btn-star-5 { font-size: 7px; }
  
  /* Unique small mobile positions for Income & Savings button */
  .income-btn .btn-star-1 { font-size: 7px; }
  .income-btn .btn-star-2 { font-size: 5px; }
  .income-btn .btn-star-3 { font-size: 9px; }
  .income-btn .btn-star-4 { font-size: 4px; }
  .income-btn .btn-star-5 { font-size: 6px; }
  
  /* Unique small mobile positions for Mortgage Calculator button */
  .mortgage-btn .btn-star-1 { font-size: 8px; }
  .mortgage-btn .btn-star-2 { font-size: 6px; }
  .mortgage-btn .btn-star-3 { font-size: 5px; }
  .mortgage-btn .btn-star-4 { font-size: 7px; }
  .mortgage-btn .btn-star-5 { font-size: 4px; }
  
  /* Unique small mobile positions for Car Ownership Calculator button */
  .car-ownership-btn .btn-star-1 { font-size: 5px; }
  .car-ownership-btn .btn-star-2 { font-size: 8px; }
  .car-ownership-btn .btn-star-3 { font-size: 6px; }
  .car-ownership-btn .btn-star-4 { font-size: 7px; }
  .car-ownership-btn .btn-star-5 { font-size: 4px; }
  
  /* Unique small mobile positions for RESP Calculator button */
  .resp-btn .btn-star-1 { font-size: 6px; }
  .resp-btn .btn-star-2 { font-size: 5px; }
  .resp-btn .btn-star-3 { font-size: 8px; }
  .resp-btn .btn-star-4 { font-size: 4px; }
  .resp-btn .btn-star-5 { font-size: 7px; }
  
  /* Unique small mobile positions for Savings Goals Calculator button */
  .savings-goals-btn .btn-star-1 { font-size: 7px; }
  .savings-goals-btn .btn-star-2 { font-size: 4px; }
  .savings-goals-btn .btn-star-3 { font-size: 6px; }
  .savings-goals-btn .btn-star-4 { font-size: 8px; }
  .savings-goals-btn .btn-star-5 { font-size: 5px; }
  
  /* Unique small mobile positions for Retirement Calculator button */
  .retirement-btn .btn-star-1 { font-size: 6px; }
  .retirement-btn .btn-star-2 { font-size: 4px; }
  .retirement-btn .btn-star-3 { font-size: 7px; }
  .retirement-btn .btn-star-4 { font-size: 5px; }
  .retirement-btn .btn-star-5 { font-size: 6px; }
  
  @keyframes btnStarMove {
    0% {
      transform: translate(0px, 0px);
      opacity: 0;
    }
    15% {
      opacity: 0.9;
      color: white;
    }
    85% {
      opacity: 0.9;
      color: white;
    }
    100% {
      transform: translate(60px, -30px);
      opacity: 0;
    }
  }
} 

/* ===== Country Toggle Styles ===== */
.country-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 25px 0 35px;
}

.country-toggle .toggle-btn {
    background-color: #f0f4f8;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.15s ease;
}

.country-toggle .toggle-btn:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
}

.country-toggle .toggle-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Ensure toggle buttons are compact on mobile */
@media screen and (max-width: 600px) {
    .country-toggle .toggle-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Override grid placement rules when in US view to prevent gaps */
.calculator-grid.us-view .simple-card {
    grid-column: auto !important;
    grid-row: auto !important;
}

.retirement-card {
    animation-delay: 1.0s;
}

.calculator-grid .retirement-card {
    grid-column: 2 / 3;
} 