/* SmartCalcs - Final Mobile Fixes and Optimizations */

/* Fix any remaining mobile issues */
@media (max-width: 768px) {
    /* Ensure proper body spacing */
    body {
        padding-top: 70px !important;
        font-size: 16px !important;
        line-height: 1.6;
        -webkit-text-size-adjust: 100%;
        margin: 0;
        overflow-x: hidden;
    }
    
    /* Navigation mobile fixes */
    .navbar {
        position: fixed !important;
        top: 0 !important;
        width: 100% !important;
        z-index: 1000 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        height: 70px !important;
    }
    
    .nav-container {
        padding: 12px 16px !important;
        height: 70px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .nav-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 48px !important;
        min-height: 48px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        border-radius: 8px !important;
        transition: background 0.3s ease !important;
    }
    
    .nav-toggle:hover {
        background: rgba(255, 153, 102, 0.1) !important;
    }
    
    .nav-links {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        transform: translateY(-100vh) !important;
        transition: transform 0.3s ease !important;
        padding: 20px !important;
        flex-direction: column !important;
        gap: 12px !important;
        max-height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
        border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    }
    
    .nav-links.active {
        transform: translateY(0) !important;
    }
    
    .nav-link {
        width: 100% !important;
        padding: 16px !important;
        text-align: center !important;
        border-radius: 12px !important;
        font-size: 16px !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s ease !important;
    }
    
    .nav-link:hover {
        background: rgba(255, 153, 102, 0.1) !important;
        color: #ff9966 !important;
    }
    
    /* Dropdown mobile fixes */
    .dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        margin-top: 8px !important;
        display: none !important;
    }
    
    .dropdown.active .dropdown-menu {
        display: block !important;
    }
    
    /* Containers mobile fixes */
    .container, .section-container, .gst-container, .sip-container, 
    .emi-container, .converter-container, .rvb-container, .compound-container,
    .invoice-container, .faq-container, .contact-container {
        padding: 0 16px !important;
        margin: 0 auto !important;
        max-width: 100% !important;
    }
    
    /* Cards mobile optimization */
    .card, .tool-card, .stat-item {
        padding: 16px !important;
        margin-bottom: 16px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Form elements mobile optimization */
    .form-group input, .form-group select, .form-group textarea {
        padding: 16px !important;
        font-size: 16px !important;
        min-height: 48px !important;
        border-radius: 12px !important;
        border: 2px solid rgba(0, 0, 0, 0.1) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
        border-color: #ff9966 !important;
        box-shadow: 0 0 0 4px rgba(255, 153, 102, 0.1) !important;
        outline: none !important;
    }
    
    /* Button mobile optimization */
    .btn, .tool-btn, .mode-btn, .rate-btn, .hero-cta, .action-btn {
        padding: 16px 20px !important;
        font-size: 16px !important;
        min-height: 48px !important;
        border-radius: 12px !important;
        width: 100% !important;
        margin: 4px 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        text-decoration: none !important;
        background: linear-gradient(135deg, #ff9966, #ffb84d) !important;
        color: white !important;
        font-weight: 600 !important;
        box-shadow: 0 4px 15px rgba(255, 153, 102, 0.3) !important;
    }
    
    .btn:hover, .tool-btn:hover, .mode-btn:hover, .rate-btn:hover, 
    .hero-cta:hover, .action-btn:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(255, 153, 102, 0.4) !important;
    }
    
    /* Grid mobile optimization */
    .calculator-grid, .tools-grid {
        display: block !important;
        grid-template-columns: none !important;
    }
    
    .calculator-grid > *, .tools-grid > * {
        margin-bottom: 20px !important;
    }
    
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
    
    /* Typography mobile fixes */
    h1 {
        font-size: 28px !important;
        line-height: 1.3 !important;
        margin-bottom: 16px !important;
        text-align: center !important;
    }
    
    h2 {
        font-size: 24px !important;
        line-height: 1.3 !important;
        margin-bottom: 12px !important;
    }
    
    h3 {
        font-size: 20px !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }
    
    p {
        font-size: 16px !important;
        line-height: 1.6 !important;
        margin-bottom: 16px !important;
    }
    
    /* Mode selector mobile fixes */
    .mode-selector {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .mode-btn {
        padding: 20px !important;
        text-align: center !important;
        flex-direction: column !important;
    }
    
    /* Rate buttons mobile fixes */
    .rate-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .rate-btn {
        padding: 12px !important;
        flex-direction: column !important;
        min-width: auto !important;
    }
    
    /* Results mobile optimization */
    .result-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 16px 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    
    .result-value {
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #ff9966 !important;
    }
    
    /* Hero section mobile fixes */
    .hero-section, .hero-container {
        padding: 40px 16px !important;
        text-align: center !important;
    }
    
    .hero-title {
        font-size: 32px !important;
        line-height: 1.2 !important;
        margin-bottom: 16px !important;
    }
    
    .hero-subtitle {
        font-size: 18px !important;
        line-height: 1.5 !important;
        margin-bottom: 24px !important;
    }
    
    /* Chart containers mobile */
    .chart-container {
        width: 100% !important;
        height: 300px !important;
        margin: 20px 0 !important;
    }
    
    /* Table responsive */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    table {
        min-width: 100% !important;
        font-size: 14px !important;
    }
    
    th, td {
        padding: 8px !important;
        white-space: nowrap !important;
    }
    
    /* Prevent zoom on input focus iOS */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Hide horizontal scrollbar */
    .no-scroll {
        overflow-x: hidden !important;
    }
    
    /* Touch optimization */
    * {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }
    
    /* Safe area insets for notched devices */
    @supports(padding: max(0px)) {
        .navbar {
            padding-left: max(16px, env(safe-area-inset-left)) !important;
            padding-right: max(16px, env(safe-area-inset-right)) !important;
        }
        
        .container, .section-container {
            padding-left: max(16px, env(safe-area-inset-left)) !important;
            padding-right: max(16px, env(safe-area-inset-right)) !important;
        }
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .rate-buttons {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    .card, .tool-card {
        padding: 12px !important;
    }
    
    .btn, .tool-btn {
        padding: 14px 16px !important;
        font-size: 15px !important;
    }
}

/* Landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-links {
        max-height: 60vh !important;
    }
    
    .hero-section {
        padding: 20px 16px !important;
    }
    
    .card, .tool-card {
        padding: 12px !important;
    }
}