/* Mobile-First Responsive Design for GustMoore */

/* Mobile Text Contrast Fix - Critical for visibility */
@media (max-width: 768px) {
    /* Override all white text on mobile with proper contrast */
    body {
        color: var(--text-dark) !important;
        background: var(--bg-primary) !important;
    }
    
    /* Fix white text in cards and content areas */
    .card, .card-body, .card-footer, .container, .row, .col-* {
        color: var(--text-dark) !important;
    }
    
    /* Feature cards and main content */
    .feature-card, .feature-card p, .feature-card h3 {
        color: var(--text-dark) !important;
    }
    
    /* Navigation text (keep white on dark backgrounds only) */
    .navbar-brand, .nav-link {
        color: var(--text-dark) !important;
    }
    
    /* Forms and inputs */
    .form-control, .form-label, .form-text {
        color: var(--text-dark) !important;
    }
    
    /* Tables */
    .table td, .table-responsive {
        color: var(--text-dark) !important;
    }
    
    /* Alerts with light backgrounds */
    .alert:not(.alert-danger):not(.alert-warning) {
        color: var(--text-dark) !important;
    }
    
    /* Admin content */
    .admin-container, .admin-content {
        color: var(--text-dark) !important;
    }
    
    /* General text elements */
    p, h1, h2, h3, h4, h5, h6, span, div, li {
        color: var(--text-dark) !important;
    }
    
    /* Lead text and descriptions */
    .lead, .text-muted:not(.bg-primary):not(.bg-dark) {
        color: var(--text-light) !important;
    }
}

/* Base mobile styles (applies to all screen sizes) */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly interactions */
.btn, .nav-link, .dropdown-item, .form-control, .form-select {
    min-height: 44px;
    min-width: 44px;
}

/* Improved spacing for mobile */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Navigation improvements */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.95);
        border-radius: 12px;
        margin-top: 1rem;
        padding: 1rem;
        backdrop-filter: blur(10px);
    }
    
    .navbar-nav .nav-link {
        color: var(--text-dark) !important;
        padding: 0.75rem 1rem;
        border-radius: 8px;
        margin: 0.25rem 0;
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background: var(--primary-blue);
        color: white !important;
    }
    
    .navbar-toggler {
        border: none;
        padding: 0.5rem;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
}

/* Mobile-optimized forms */
@media (max-width: 768px) {
    .form-group, .mb-3 {
        margin-bottom: 1.5rem;
    }
    
    .form-control, .form-select {
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
        border: 2px solid var(--border-light);
        transition: all 0.3s ease;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: var(--primary-blue);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }
    
    .form-label {
        font-weight: 600;
        color: var(--text-dark);
        margin-bottom: 0.75rem;
        font-size: 1rem;
    }
    
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group .form-control {
        min-width: 0;
    }
}

/* Mobile tables */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
        box-shadow: none;
    }
    
    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
    
    .table th {
        background: var(--primary-blue);
        color: white;
        font-weight: 600;
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .table td {
        padding: 1rem 0.75rem;
        vertical-align: middle;
        border-color: var(--border-light);
    }
    
    /* Stack table actions vertically */
    .btn-group-vertical {
        width: 100%;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
        border-radius: 6px !important;
    }
}

/* Mobile cards and components */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1.5rem;
        border-radius: 16px;
        overflow: hidden;
    }
    
    .card-header {
        padding: 1.25rem;
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .card-footer {
        padding: 1rem 1.25rem;
    }
    
    /* Stat cards */
    .stat-card {
        text-align: center;
        padding: 2rem 1rem;
        margin-bottom: 1rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
        font-weight: 600;
    }
}

/* Mobile modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
        height: calc(100vh - 1rem);
        display: flex;
        align-items: center;
    }
    
    .modal-content {
        border-radius: 16px;
        border: none;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 1.5rem;
        border-bottom: 1px solid var(--border-light);
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem;
        border-top: 1px solid var(--border-light);
    }
    
    .modal-title {
        font-size: 1.2rem;
        font-weight: 600;
    }
}

/* Mobile alerts and notifications */
@media (max-width: 768px) {
    .alert {
        padding: 1rem;
        border-radius: 12px;
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 1rem;
    }
    
    .weather-notification-bar {
        font-size: 0.9rem;
        padding: 1rem;
    }
    
    .weather-notification-content {
        padding: 0.5rem 1rem;
    }
}

/* Mobile admin interface */
@media (max-width: 768px) {
    .admin-container {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .admin-header {
        padding: 1.5rem;
        text-align: center;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }
    
    .admin-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .admin-actions {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .btn-admin-action {
        width: 100%;
        margin-bottom: 0.75rem;
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .breadcrumb {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
}

/* Mobile profile and user pages */
@media (max-width: 768px) {
    .profile-header {
        text-align: center;
        padding: 2rem 1rem;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
        margin: 0 auto 1rem;
    }
    
    .profile-info h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Small mobile devices (phones in portrait) */
@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
    }
    
    .card-header, .card-body {
        padding: 1rem;
    }
    
    .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    .table th, .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .admin-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* Landscape phone optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 2rem 1rem;
        min-height: 50vh;
    }
    
    .modal-dialog {
        height: calc(100vh - 0.5rem);
    }
    
    .navbar-collapse {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Touch and hover optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover, .card:hover, .nav-link:hover {
        transform: none;
    }
    
    .feature-card:hover {
        transform: none;
        box-shadow: 0 8px 32px rgba(37, 99, 235, 0.1);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card, .btn, .form-control {
        border-width: 0.5px;
    }
}