/* I Can Fire - Mobile Specific Styles */

/* Mobile Navigation */

@media (max-width: 768px) {
    .btn-line{
        width: 80% !important;
        text-align: center;
    }
    .navbar-menu.mobile-open {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 999;
    }
    
    .navbar-menu.mobile-open .nav-links {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
}

/* Touch-Friendly Elements */
@media (max-width: 768px) {
    .btn {
        min-height: 48px;
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .nav-links a {
        padding: 12px 0;
        display: block;
        min-height: 44px;
        line-height: 20px;
    }
    
    /* Larger tap targets for mobile */
    .stat-item,
    .benefit-item,
    .step-item,
    .requirement-item {
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
}

/* Mobile Typography Adjustments */
@media (max-width: 480px) {
    .btn-line{
        width: 80% !important;
        text-align: center;
    }
    html {
        font-size: 16px;
    }
    
    .hero-text h1 {
        font-size: 1.8rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.95rem;
    }
}

/* Mobile Spacing Optimizations */
@media (max-width: 768px) {
    .hero,
    .microloan-info,
    .funding-options,
    .benefits-section,
    .requirements-section,
    .how-to-apply {
        padding: 2rem 0;
    }
    
    .stats-section {
        padding: 1.5rem 0;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem;
    }
    
    .mb-5 {
        margin-bottom: 2rem;
    }
    
    .mt-5 {
        margin-top: 2rem;
    }
}

/* Mobile Grid Adjustments */
@media (max-width: 768px) {
    .stats-grid {
        gap: 1rem;
    }
    
    .options-grid,
    .benefits-grid,
    .requirements-grid,
    .steps-grid {
        gap: 1.5rem;
    }
    
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .footer-links {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Mobile Image Optimizations */
@media (max-width: 768px) {
    .hero-img {
        max-width: 80%;
        margin: 0 auto;
    }
    
    .stat-icon,
    .benefit-icon,
    .option-icon {
        width: 60px;
        height: 60px;
    }
    
    .logo {
        width: 77px;
        height: 40px;
    }
    
    .footer-logo {
        height: 35px;
    }
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .hero-text,
    .stat-item,
    .benefit-item,
    .step-item {
        animation: none;
    }
    
    /* Simplify hover effects on mobile */
    .btn-primary:hover {
        transform: none;
    }
    
    .btn-primary:active {
        transform: scale(0.98);
        background: linear-gradient(135deg, #14644b, #198261);
    }
}

/* Mobile Accessibility */
@media (max-width: 768px) {
    /* Ensure text is readable on mobile */
    .text-white {
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }
    
    /* Better contrast for mobile */
    .option-card {
        background-color: rgba(255,255,255,0.15);
    }
    
    .feature-list li {
        color: rgba(255,255,255,0.95);
    }
}

/* Mobile Landscape Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .hero-text {
        text-align: left;
    }
    
    .hero-text h1 {
        font-size: 1.8rem;
    }
}

/* Very Small Screens (320px and below) */
@media (max-width: 320px) {
    .btn-line{
        width: 80% !important;
        text-align: center;
    }
    .container {
        padding: 0 8px;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        color: #fff !important;
        background: none !important;
        -webkit-text-fill-color: #fff !important;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .stat-item,
    .benefit-item,
    .step-item,
    .requirement-item {
        padding: 0.6rem;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .requirement-number {
        font-size: 1.4rem;
    }
    
    .form-container {
        margin: 0 5px;
    }
    
    .form-header,
    .form-section,
    .form-submit {
        padding: 1rem;
    }
}

/* Mobile Form Elements (for future apply page) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
        border-radius: 6px;
        border: 2px solid #ddd;
        width: 100%;
        box-sizing: border-box;
    }
    
    input:focus,
    select:focus,
    textarea:focus {
        outline: none;
        border-color: #14644b;
        box-shadow: 0 0 0 3px rgb(209, 225, 255);
    }
}

/* Mobile Loading States */
@media (max-width: 768px) {
    .btn.loading {
        position: relative;
        color: transparent;
    }
    
    .btn.loading::after {
        content: "";
        position: absolute;
        width: 20px;
        height: 20px;
        top: 50%;
        left: 50%;
        margin-left: -10px;
        margin-top: -10px;
        border: 2px solid #ffffff;
        border-radius: 50%;
        border-top-color: transparent;
        animation: spin 1s ease-in-out infinite;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Scroll Behavior */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Mobile Safe Areas (for newer phones with notches) */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .header {
            padding-top: max(env(safe-area-inset-top), 0px);
        }
        
        .footer {
            padding-bottom: max(env(safe-area-inset-bottom), 1rem);
        }
        
        .container {
            padding-left: max(env(safe-area-inset-left), 15px);
            padding-right: max(env(safe-area-inset-right), 15px);
        }
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .apply-hero {
        padding: 2.5rem 0;
    }
    
    .apply-hero-content h1 {
         font-size: 2.2rem;
         color: #fff !important;
         background: none !important;
         -webkit-text-fill-color: #fff !important;
     }
    
    .form-container {
        margin: 0 10px;
        border-radius: 15px;
    }
    
    .form-header {
        padding: 2rem;
    }
    
    .form-section {
        padding: 2rem;
    }
    
    .form-submit {
        padding: 2.5rem;
    }
}
/* --- 浮動 LINE 按鈕在窄屏的避讓（避免與底部固定 CTA 或底部內容重疊） --- */
@media (max-width: 480px) {
    .btn-line{
        width: 80% !important;
        text-align: center;
    }
  .floating-line-btn,
  .floating-line-window { /* 兼容舊類名，詳情頁暫時仍使用 .floating-line-window */
    bottom: 96px; /* 預留底部固定區域高度 + 間距，提升可點擊性 */
  }
}