/* Mobile-First Responsive Design */
:root {
    --mobile-breakpoint: 768px;
    --tablet-breakpoint: 1024px;
    --bottom-nav-height: 60px;
}

/* Base Mobile Styles */
* {
    box-sizing: border-box;
}

body {
    font-size: 14px;
    line-height: 1.4;
    padding-bottom: var(--bottom-nav-height);
}

.container {
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

/* Mobile Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    height: 60px;
}

.logo {
    width: 120px;
}

.logo img {
    width: 100%;
    height: auto;
}

/* Mobile Navigation */
#nav-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

#nav-menu.show {
    display: flex;
}

#nav-menu li {
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
}

#nav-menu li:last-child {
    border-bottom: none;
}

#nav-menu a {
    display: block;
    padding: 15px 10px;
    font-size: 16px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    z-index: 1000;
    display: flex;
    padding: 5px 0;
}

.mobile-nav-container {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    padding: 8px 5px;
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 3px;
}

.mobile-nav-label {
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.2;
}

/* Mobile User Dropdown */
.mobile-user-dropdown {
    position: relative;
}

.mobile-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.mobile-user-dropdown-content {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1001;
}

.mobile-user-dropdown-content.show {
    display: block;
}

.mobile-user-info {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

.mobile-user-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 auto 10px;
}

.mobile-user-dropdown-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f8f8f8;
    transition: background 0.3s ease;
}

.mobile-user-dropdown-item:last-child {
    border-bottom: none;
}

.mobile-user-dropdown-item:hover {
    background: #f8f9fa;
}

.mobile-user-dropdown-icon {
    width: 20px;
    margin-right: 15px;
    text-align: center;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.mobile-nav-overlay.show {
    display: block;
}

/* Responsive Grid Systems */
.services-grid,
.features-grid,
.blog-grid,
.events-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.emergency-grid {
    grid-template-columns: 1fr;
}

/* Hero Section Mobile */
.hero-slide {
    height: 60vh;
    min-height: 400px;
}

.hero-slide-content {
    padding: 20px;
    text-align: center;
}

.hero-slide-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

/* Modal Mobile Styles */
.modal-content {
    width: 95%;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Tablet Styles */
@media (min-width: 768px) {
    body {
        font-size: 16px;
        padding-bottom: 0;
    }
    
    .mobile-bottom-nav {
        display: none;
    }
    
    #nav-menu {
        display: flex;
        position: static;
        flex-direction: row;
        background: none;
        box-shadow: none;
        padding: 0;
        max-height: none;
        overflow-y: visible;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-grid,
    .events-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .emergency-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 720px;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .container {
        max-width: 1140px;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .blog-grid,
    .events-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .emergency-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Touch-friendly buttons */
.btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 16px;
}

/* Improved form elements for mobile */
.form-group input,
.form-group select,
.form-group textarea {
    font-size: 16px;
    min-height: 44px;
}

/* Safe area support for notched phones */
@supports(padding: max(0px)) {
    body {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(var(--bottom-nav-height), env(safe-area-inset-bottom));
    }
    
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}