/* SmartCalcs - Mobile Enhancement & Performance Fix */

/* MOBILE LAYOUT SPACING FIXES */
@media (max-width: 768px) {
    /* Container improvements */
    .container, .main-container, .calculator-container {
        padding: 16px !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    
    /* Card spacing fixes */
    .card, .tool-card, .calculator-section {
        margin-bottom: 20px !important;
        padding: 20px !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    
    /* Button improvements */
    .btn, button, .tool-btn, .calculator-btn, .action-btn {
        width: 100% !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        padding: 16px 20px !important;
        min-height: 52px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.3s ease !important;
    }
    
    /* Form improvements */
    input, select, textarea {
        font-size: 16px !important;
        padding: 16px !important;
        min-height: 52px !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: 2px solid #e2e8f0 !important;
        margin-bottom: 16px !important;
    }
    
    /* Navigation improvements */
    .navbar {
        padding: 12px 16px !important;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    }
    
    .nav-container {
        padding: 0 !important;
    }
    
    /* Tool grid improvements */
    .tools-grid, .calculator-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 !important;
    }
    
    /* Text improvements */
    h1, h2, h3, h4, h5, h6 {
        margin-bottom: 16px !important;
        line-height: 1.3 !important;
    }
    
    p, li, div {
        line-height: 1.6 !important;
        margin-bottom: 12px !important;
    }
}

/* CALCULATOR SPECIFIC MOBILE FIXES */
@media (max-width: 768px) {
    .calculator-form {
        padding: 0 !important;
    }
    
    .form-group {
        margin-bottom: 24px !important;
    }
    
    .form-group label {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1a202c !important;
        margin-bottom: 8px !important;
        display: block !important;
    }
    
    .calculator-result {
        background: #f7fafc !important;
        padding: 24px !important;
        border-radius: 16px !important;
        margin: 24px 0 !important;
        text-align: center !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    
    .result-value {
        font-size: 32px !important;
        font-weight: 800 !important;
        color: #ff6b35 !important;
        margin-bottom: 8px !important;
    }
    
    .result-label {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #4a5568 !important;
    }
}

/* GST CALCULATOR MOBILE FIXES */
@media (max-width: 768px) {
    .gst-container {
        padding: 16px !important;
    }
    
    .gst-form {
        padding: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .gst-results {
        padding: 20px !important;
        background: white !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    
    .gst-breakdown {
        padding: 16px !important;
        margin: 16px 0 !important;
        background: #f7fafc !important;
        border-radius: 12px !important;
    }
    
    .breakdown-item {
        display: flex !important;
        justify-content: space-between !important;
        padding: 12px 0 !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    
    .breakdown-label {
        font-weight: 600 !important;
        color: #4a5568 !important;
    }
    
    .breakdown-value {
        font-weight: 700 !important;
        color: #1a202c !important;
    }
}

/* EMI CALCULATOR MOBILE FIXES */
@media (max-width: 768px) {
    .emi-container {
        padding: 16px !important;
    }
    
    .emi-chart-container {
        height: 300px !important;
        margin: 24px 0 !important;
        padding: 16px !important;
        background: white !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    
    .emi-summary {
        padding: 20px !important;
        background: white !important;
        border-radius: 16px !important;
        margin: 20px 0 !important;
    }
    
    .summary-item {
        padding: 16px 0 !important;
        border-bottom: 1px solid #e2e8f0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
}

/* SIP CALCULATOR MOBILE FIXES */
@media (max-width: 768px) {
    .sip-container {
        padding: 16px !important;
    }
    
    .sip-chart {
        height: 300px !important;
        margin: 24px 0 !important;
        padding: 16px !important;
        background: white !important;
        border-radius: 16px !important;
    }
    
    .sip-projection {
        padding: 20px !important;
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
        border-radius: 16px !important;
        margin: 20px 0 !important;
    }
}

/* INVOICE MOBILE FIXES */
@media (max-width: 768px) {
    .invoice-container {
        padding: 16px !important;
    }
    
    .invoice-form {
        padding: 20px !important;
        background: white !important;
        border-radius: 16px !important;
        margin-bottom: 20px !important;
    }
    
    .invoice-preview {
        padding: 20px !important;
        background: white !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    
    .form-row {
        display: block !important;
    }
    
    .form-col {
        width: 100% !important;
        margin-bottom: 20px !important;
    }
    
    .item-row {
        padding: 16px !important;
        margin-bottom: 16px !important;
        background: #f7fafc !important;
        border-radius: 12px !important;
    }
}

/* TABLE MOBILE IMPROVEMENTS */
@media (max-width: 768px) {
    table {
        font-size: 14px !important;
        width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
        white-space: nowrap !important;
    }
    
    thead, tbody, tr {
        display: block !important;
    }
    
    th, td {
        padding: 12px 8px !important;
        text-align: left !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    
    th {
        background: #f7fafc !important;
        font-weight: 700 !important;
        color: #1a202c !important;
    }
    
    td {
        font-weight: 500 !important;
        color: #1a202c !important;
    }
}

/* MOBILE NAVIGATION ENHANCEMENTS */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex !important;
        background: none !important;
        border: none !important;
        font-size: 24px !important;
        color: #1a202c !important;
        padding: 12px !important;
        cursor: pointer !important;
        z-index: 1001 !important;
        position: relative !important;
        align-items: center !important;
        justify-content: center !important;
        width: 48px !important;
        height: 48px !important;
        border-radius: 8px !important;
        transition: all 0.3s ease !important;
    }
    
    .nav-toggle:hover {
        background: rgba(255, 107, 53, 0.1) !important;
        transform: scale(1.1) !important;
    }
    
    .hamburger-icon {
        font-size: 28px !important;
        font-weight: 400 !important;
        color: #1a202c !important;
        line-height: 1 !important;
        transition: all 0.3s ease !important;
    }
    
    .nav-toggle.active .hamburger-icon {
        transform: rotate(90deg) !important;
        color: #ff6b35 !important;
    }
    
    .nav-links {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
        transform: translateY(-100%) !important;
        transition: all 0.3s ease !important;
        z-index: 999 !important;
        flex-direction: column !important;
        padding: 0 !important;
        border-radius: 0 0 16px 16px !important;
    }
    
    .nav-links.active {
        transform: translateY(0) !important;
    }
    
    .nav-link {
        padding: 16px 24px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1a202c !important;
        text-decoration: none !important;
        border-bottom: 1px solid #f7fafc !important;
        transition: all 0.3s ease !important;
    }
    
    .nav-link:hover {
        background: rgba(255, 107, 53, 0.1) !important;
        color: #ff6b35 !important;
    }
    
    .dropdown {
        position: relative !important;
    }
    
    .dropdown-menu {
        position: static !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: none !important;
        background: #f7fafc !important;
        padding: 0 !important;
    }
    
    .dropdown-menu a {
        padding: 12px 24px 12px 48px !important;
        font-size: 14px !important;
        color: #4a5568 !important;
    }
}

/* PERFORMANCE OPTIMIZATIONS */
* {
    box-sizing: border-box !important;
}

img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* MOBILE SCROLLING IMPROVEMENTS */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .container {
        overflow-x: hidden !important;
    }
}

/* MOBILE TOUCH IMPROVEMENTS */
@media (max-width: 768px) {
    a, button, .btn, .tool-btn {
        -webkit-tap-highlight-color: rgba(255, 107, 53, 0.2) !important;
        touch-action: manipulation !important;
    }
    
    input, select, textarea {
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
    
    select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
        background-repeat: no-repeat !important;
        background-position: right 12px center !important;
        background-size: 16px !important;
        padding-right: 40px !important;
    }
}