/**
 * Comm-Breakdown, LLC - Mobile Responsive Styles
 * Date: December 10, 2025
 * 
 * Comprehensive mobile-first responsive design for:
 * - iPhone (all sizes including iPhone 15 Pro Max)
 * - iPad (all sizes including iPad Pro)
 * - Android phones and tablets
 * - All screen sizes from 320px to 2560px+
 */

/* ============================================
   BASE MOBILE RESET & IMPROVEMENTS
   ============================================ */

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Improve touch targets */
a, button, input, select, textarea {
    min-height: 44px; /* Apple's recommended touch target */
    touch-action: manipulation;
}

/* Better font rendering on mobile */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Site protection - discourage copying (Comm-Breakdown, LLC) */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
input, textarea, select, [contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background: #1B9E4B;
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

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

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

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

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile navigation drawer */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: linear-gradient(180deg, #0a1a0f 0%, #050d08 100%);
    z-index: 1000;
    padding: 80px 30px 30px;
    transition: right 0.3s ease;
    overflow-y: auto;
    border-left: 2px solid #1B9E4B;
}

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

.mobile-nav a {
    display: block;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.2rem;
    padding: 15px 0;
    border-bottom: 1px solid rgba(27, 158, 75, 0.2);
    transition: all 0.3s ease;
}

.mobile-nav a:hover,
.mobile-nav a:active {
    color: #1B9E4B;
    padding-left: 10px;
}

.mobile-nav .btn-client {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #1B9E4B 0%, #0D7A35 100%);
    border-radius: 8px;
    border: none;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Extra Small Devices (phones, 320px - 480px) */
@media screen and (max-width: 480px) {
    /* Navigation */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .nav-links {
        display: none !important;
    }
    
    .nav-logo img {
        height: 40px;
    }
    
    .nav-logo-text {
        font-size: 1rem;
    }
    
    .nav-container {
        padding: 0 15px;
    }
    
    /* Hero Section */
    .hero {
        padding: 50px 15px;
    }
    
    .hero-logo img,
    .hero-logo video {
        max-width: 200px !important;
    }
    
    .hero-title {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        letter-spacing: 1px;
    }
    
    .hero-tagline {
        font-size: 1rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
        padding: 0 10px;
    }
    
    .cta-buttons {
        flex-direction: column;
        gap: 15px;
        margin-top: 30px;
    }
    
    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    /* Sections */
    .services, .why-choose, .contact {
        padding: 50px 15px;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 40px;
    }
    
    /* Service Cards */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .service-card {
        padding: 30px 20px;
    }
    
    .service-icon {
        font-size: 2.5rem;
    }
    
    .service-card h3 {
        font-size: 1.2rem;
    }
    
    .service-card p {
        font-size: 0.95rem;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .feature-item {
        padding: 25px 20px;
    }
    
    .feature-icon {
        font-size: 2.5rem;
    }
    
    /* Contact */
    .contact-details {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-item {
        padding: 30px 20px;
    }
    
    .hours-box {
        padding: 30px 20px;
    }
    
    .hours-box h3 {
        font-size: 1.4rem;
    }
    
    .emergency-notice {
        font-size: 1rem;
        padding: 20px 15px;
    }
    
    /* Footer */
    .footer {
        padding: 40px 15px;
    }
    
    .footer-logo img {
        height: 60px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

/* Small Devices (large phones, 481px - 767px) */
@media screen and (min-width: 481px) and (max-width: 767px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .nav-links {
        display: none !important;
    }
    
    .hero {
        padding: 60px 20px;
    }
    
    .hero-logo img,
    .hero-logo video {
        max-width: 250px !important;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-details {
        grid-template-columns: 1fr;
    }
}

/* Medium Devices (tablets, 768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-nav {
        display: block;
        width: 50%;
    }
    
    .nav-links {
        display: none !important;
    }
    
    .hero {
        padding: 80px 30px;
    }
    
    .hero-logo img,
    .hero-logo video {
        max-width: 300px !important;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Devices (desktops, 1025px+) */
@media screen and (min-width: 1025px) {
    .mobile-menu-toggle,
    .mobile-nav,
    .mobile-menu-overlay {
        display: none !important;
    }
    
    .nav-links {
        display: flex !important;
    }
}

/* ============================================
   PORTAL PAGE MOBILE STYLES
   ============================================ */

@media screen and (max-width: 768px) {
    /* Portal Header */
    .portal-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .portal-header h1 {
        font-size: 1.3rem;
    }
    
    /* Portal Navigation */
    .portal-nav {
        flex-wrap: wrap;
        gap: 8px;
        padding: 15px;
    }
    
    .portal-nav button {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
        padding: 12px 10px;
        font-size: 0.85rem;
    }
    
    /* Portal Content */
    .portal-content {
        padding: 15px;
    }
    
    /* Dashboard Stats */
    .stats-grid,
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Tables */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    /* Modals */
    .modal {
        width: 95% !important;
        max-width: none !important;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        padding: 14px;
    }
    
    .btn-sm {
        padding: 10px 15px;
        width: auto;
    }
}

/* ============================================
   ADMIN PANEL MOBILE STYLES
   ============================================ */

@media screen and (max-width: 1024px) {
    /* Hide sidebar on mobile */
    .sidebar {
        display: none;
        position: fixed;
        left: -280px;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        display: flex;
        left: 0;
    }
    
    /* Adjust main content */
    .main-content {
        margin-left: 0 !important;
    }
    
    /* Mobile admin header */
    .topbar {
        flex-wrap: wrap;
        padding: 15px;
    }
    
    .topbar-left {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .page-title {
        font-size: 1.1rem;
    }
    
    .search-box {
        width: 100%;
    }
    
    /* Admin mobile menu button */
    .admin-mobile-toggle {
        display: block;
        background: transparent;
        border: 2px solid #1B9E4B;
        color: #1B9E4B;
        padding: 8px 12px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 1.2rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Content padding */
    .content {
        padding: 15px;
    }
    
    /* Tables */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 700px;
    }
    
    th, td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .topbar-actions {
        width: 100%;
    }
}

/* ============================================
   iOS & ANDROID SPECIFIC FIXES
   ============================================ */

/* iOS Safari fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS momentum scrolling */
    .modal-body,
    .sidebar-nav,
    .mobile-nav {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix for iOS form zoom */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Fix for iOS safe areas (notch) */
    .navbar {
        padding-top: max(15px, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(50px, env(safe-area-inset-bottom));
    }
    
    .mobile-nav {
        padding-top: max(80px, calc(80px + env(safe-area-inset-top)));
    }
}

/* Android fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231B9E4B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 35px;
    }
}

/* ============================================
   TOUCH & HOVER STATES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .service-card:hover,
    .feature-item:hover,
    .contact-item:hover,
    .stat-card:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .service-card:active,
    .feature-item:active,
    .contact-item:active,
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 40px 20px;
    }
    
    .hero-logo img,
    .hero-logo video {
        max-width: 150px !important;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .mobile-nav {
        padding-top: 60px;
    }
    
    .modal {
        max-height: 95vh;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    .mobile-menu-toggle,
    .mobile-nav,
    .mobile-menu-overlay,
    .sidebar,
    .cta-buttons,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .hero,
    .services,
    .why-choose,
    .contact {
        padding: 30px 20px;
    }
}

