/* ===================================
   OnPoint Micro Credit - Responsive Styles
   Mobile-First Responsive Design
   =================================== */

/* Tablet - 768px and below */
@media screen and (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }

    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        padding: 80px 30px 30px;
        box-shadow: -5px 0 20px var(--shadow);
        transition: right 0.3s ease;
        z-index: 999;
        align-items: flex-start;
        gap: 20px;
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu a {
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu a::after {
        bottom: 0;
    }

    .mobile-menu-toggle {
        display: flex;
        z-index: 1000;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Top Bar */
    .top-bar {
        padding: 8px 0;
        font-size: 13px;
    }

    .top-bar-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .contact-info {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .contact-info span {
        margin-right: 0;
        font-size: 13px;
    }

    /* Logo */
    .logo img {
        height: 60px;
    }

    .nav-wrapper {
        padding: 10px 0;
    }

    /* Hero */
    .hero {
        min-height: 400px;
        padding: 60px 20px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
    }

    /* Sections */
    section {
        padding: 50px 0;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .section-header p {
        font-size: 1rem;
        padding: 0 10px;
    }

    /* Grids */
    .services-grid,
    .features-grid,
    .branches-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-bottom-links a {
        margin: 0 10px;
    }

    /* Service Card */
    .service-card {
        padding: 30px 20px;
    }

    /* Loan Details */
    .loan-features {
        grid-template-columns: 1fr;
    }

    .requirements-grid {
        grid-template-columns: 1fr;
    }

    /* Contact Page */
    .contact-content {
        grid-template-columns: 1fr;
    }

    .contact-section > div > div {
        grid-template-columns: 1fr !important;
    }

    /* Team Grid */
    .team-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* CTA Section */
    .cta {
        padding: 40px 20px !important;
    }

    .cta h2 {
        font-size: 1.75rem !important;
    }

    .cta p {
        font-size: 1rem !important;
    }

    .cta > div > div {
        flex-direction: column;
        gap: 15px !important;
    }

    .cta .btn {
        width: 100%;
        max-width: 300px;
    }

    /* About Intro Section */
    .about-intro h2 {
        font-size: 1.75rem !important;
    }

    .about-intro p {
        font-size: 1rem !important;
    }
}

/* Mobile - 480px and below */
@media screen and (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 15px;
    }

    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }

    body {
        font-size: 15px;
    }

    /* Logo */
    .logo img {
        height: 50px;
    }

    /* Navigation */
    .nav-menu {
        width: 100%;
        right: -100%;
    }

    .mobile-menu-toggle {
        padding: 8px;
    }

    /* Hero */
    .hero {
        min-height: 350px;
        padding: 40px 15px;
    }

    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-content p {
        font-size: 1rem;
        padding: 0 5px;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 15px;
    }

    /* Section Header */
    .section-header h2 {
        font-size: 1.5rem;
    }

    .section-header p {
        font-size: 0.95rem;
    }

    /* Sections */
    section {
        padding: 40px 0;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .stat-item h3 {
        font-size: 2.5rem;
    }

    .stat-item p {
        font-size: 1rem;
    }

    /* Service Icon */
    .service-icon {
        font-size: 2.5rem;
    }

    .service-card {
        padding: 25px 15px;
    }

    .service-card h3 {
        font-size: 1.1rem;
    }

    .service-card p {
        font-size: 0.95rem;
    }

    /* Feature Item */
    .feature-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .feature-icon {
        margin: 0 auto;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .feature-content h4 {
        font-size: 1rem;
    }

    .feature-content p {
        font-size: 0.9rem;
    }

    /* Branch Card */
    .branch-card {
        padding: 20px 15px;
    }

    .branch-card h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .branch-card p {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .branch-card i {
        font-size: 0.9rem;
    }

    /* Footer */
    .footer-main {
        padding: 40px 0 20px;
    }

    .footer-logo img {
        height: 50px;
    }

    .footer-col h3 {
        font-size: 1.1rem;
    }

    .footer-links li,
    .footer-contact li {
        font-size: 0.9rem;
    }

    /* Social Links */
    .social-links {
        display: flex;
        gap: 10px;
        justify-content: center;
    }

    .social-links a {
        margin-left: 0;
    }

    /* Top Bar */
    .top-bar {
        font-size: 12px;
    }

    .contact-info span {
        font-size: 12px;
    }

    /* Back to Top */
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 1.2rem;
    }

    /* About Intro */
    .about-intro {
        padding: 40px 0 !important;
    }

    .about-intro h2 {
        font-size: 1.5rem !important;
    }

    .about-intro p {
        font-size: 0.95rem !important;
    }

    /* CTA Section */
    .cta h2 {
        font-size: 1.5rem !important;
    }

    .cta p {
        font-size: 0.95rem !important;
    }

    /* Contact Form */
    .form-group label {
        font-size: 0.9rem;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 15px;
    }

    /* Loan Product Cards - Mobile Optimization */
    .loan-products-overview > div > div {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Large Desktop - 1440px and above */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }

    .hero-content p {
        font-size: 1.4rem;
    }
}

/* Print Styles */
@media print {
    .top-bar,
    .main-nav,
    .site-footer,
    .btn,
    .hero-buttons {
        display: none;
    }

    body {
        font-size: 12pt;
        color: #000;
    }

    .container {
        max-width: 100%;
    }
}

/* Landscape Mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 300px;
    }

    .hero-slider {
        height: 60vh;
        min-height: 400px;
    }

    .nav-menu {
        padding: 60px 30px 20px;
    }
}

/* Touch Device Optimization */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-menu a,
    .footer-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Increase touch targets */
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }

    .social-links a,
    .footer-social a {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Medium Tablets - 992px and below */
@media screen and (max-width: 992px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmin(250px, 1fr));
    }
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Accessibility improvements for mobile */
@media screen and (max-width: 768px) {
    /* Ensure readable text */
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* Better tap target spacing */
    .nav-menu li {
        margin: 5px 0;
    }

    /* Improve form usability on mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* Extra small devices - 360px and below */
@media screen and (max-width: 360px) {
    .container {
        padding: 0 10px;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .service-card,
    .branch-card {
        padding: 20px 12px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }

    .stat-item h3 {
        font-size: 2rem;
    }

    .logo img {
        height: 45px;
    }

    .top-bar {
        font-size: 11px;
    }
}

/* ===================================
   GENERAL MOBILE OPTIMIZATIONS
   =================================== */

/* Prevent horizontal scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Better word wrapping for mobile */
@media screen and (max-width: 768px) {
    p, li, td, span, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Prevent long URLs from breaking layout */
    a {
        word-break: break-word;
    }

    /* Make tables responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Better handling of inline styles on mobile */
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Ensure videos and iframes are responsive */
    iframe,
    video,
    embed {
        max-width: 100%;
        height: auto;
    }

    /* Better spacing for stacked content */
    * + * {
        margin-top: 0;
    }

    /* Improve readability */
    .hero-content,
    .section-header,
    .service-card,
    .branch-card,
    .feature-item {
        text-align: center;
    }

    /* Better button stacking */
    .btn + .btn {
        margin-top: 10px;
    }

    /* Optimize images for mobile */
    .hero-slide,
    .hero {
        background-size: cover;
        background-position: center;
        background-attachment: scroll !important; /* Better performance on mobile */
    }
}
