/* Mobile Responsiveness Fixes for Maternal Health AI Platform */

/* Base mobile styles */
@media (max-width: 767.98px) {
    /* Fix body padding for mobile */
    body {
        padding-top: 56px !important;
    }
    
    /* Dashboard container mobile fixes */
    .dashboard-container {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Hide sidebar on mobile by default */
    .side-nav {
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        z-index: 1050 !important;
        width: 280px !important;
        position: fixed !important;
    }
    
    /* Show sidebar when active */
    .side-nav.show {
        transform: translateX(0) !important;
    }
    
    /* Main content mobile adjustments */
    .main-content {
        padding: 1rem !important;
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Welcome message mobile */
    .welcome-message {
        font-size: 1.5rem !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
    }
    
    /* Quick actions mobile layout */
    .quick-actions-container {
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    .quick-action-btn {
        width: 100% !important;
        padding: 1rem !important;
        font-size: 0.9rem !important;
        justify-content: center !important;
    }
    
    /* Statistics cards mobile */
    .row .col-md-3,
    .row .col-md-4,
    .row .col-md-6 {
        margin-bottom: 1rem !important;
    }
    
    /* Card mobile adjustments */
    .card {
        margin-bottom: 1rem !important;
        border-radius: 8px !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    /* Form elements mobile */
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
    }
    
    /* Button mobile adjustments */
    .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }
    
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    /* Table mobile responsiveness */
    .table-responsive {
        border: none !important;
    }
    
    .table {
        font-size: 0.85rem !important;
    }
    
    .table th,
    .table td {
        padding: 0.5rem !important;
        white-space: nowrap !important;
    }
    
    /* Navigation mobile fixes */
    .navbar {
        padding: 0.5rem 1rem !important;
    }
    
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    /* Modal mobile adjustments */
    .modal-dialog {
        margin: 1rem !important;
        max-width: calc(100% - 2rem) !important;
    }
    
    .modal-content {
        border-radius: 8px !important;
    }
    
    /* Alert mobile */
    .alert {
        margin-bottom: 1rem !important;
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Sidebar toggle button mobile */
    .sidebar-toggle {
        display: block !important;
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        z-index: 1060 !important;
        background: #667eea !important;
        color: white !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 0.5rem !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
    }
    
    /* Hide desktop elements on mobile */
    .d-none-mobile {
        display: none !important;
    }
    
    /* Action dropdown mobile */
    .action-dropdown {
        position: relative !important;
        width: 100% !important;
    }
    
    .action-dropdown-menu {
        position: static !important;
        display: block !important;
        width: 100% !important;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        margin-top: 0.5rem !important;
    }
    
    /* Chart mobile adjustments */
    .chart-container {
        overflow-x: auto !important;
        padding-bottom: 1rem !important;
    }
    
    /* Text mobile adjustments */
    .text-muted {
        font-size: 0.85rem !important;
        text-align: center !important;
    }
    
    /* Grid system mobile overrides */
    .row {
        margin: 0 !important;
    }
    
    .col-md-7,
    .col-md-5 {
        padding: 0.5rem !important;
    }
    
    /* Metric cards mobile */
    .metric-card {
        padding: 1rem !important;
        text-align: center !important;
    }
    
    .metric-value {
        font-size: 1.8rem !important;
    }
    
    .metric-label {
        font-size: 0.85rem !important;
    }
    
    /* Floating elements mobile */
    .floating-button {
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
    }
    
    /* Assessment section mobile */
    .assessment-section {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .assessment-section-header {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Form group mobile spacing */
    .form-group,
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    /* Input group mobile */
    .input-group {
        flex-direction: column !important;
    }
    
    .input-group-text {
        border-radius: 8px 8px 0 0 !important;
    }
    
    .input-group .form-control {
        border-radius: 0 0 8px 8px !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .main-content {
        padding: 1.5rem !important;
    }
    
    .quick-actions-container {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    
    .quick-action-btn {
        flex: 1 1 calc(50% - 0.5rem) !important;
        max-width: 200px !important;
    }
}

/* Extra small devices */
@media (max-width: 575.98px) {
    .container,
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .welcome-message {
        font-size: 1.25rem !important;
    }
    
    .card-title {
        font-size: 1rem !important;
    }
    
    .btn {
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
    }
    
    /* Ensure offline link is visible on small screens */
    .text-muted a {
        display: block !important;
        margin-top: 0.5rem !important;
        font-weight: bold !important;
        color: #059669 !important;
        font-size: 1rem !important;
    }
}

/* Landscape phone adjustments */
@media (max-width: 767.98px) and (orientation: landscape) {
    .main-content {
        padding: 0.75rem !important;
    }
    
    .welcome-message {
        font-size: 1.3rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .quick-actions-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    
    .quick-action-btn {
        flex: 1 1 calc(33.33% - 0.5rem) !important;
        width: auto !important;
        font-size: 0.8rem !important;
        padding: 0.6rem !important;
    }
}

/* Fix for Bootstrap conflicts */
@media (max-width: 767.98px) {
    .col-12.col-lg-10.offset-lg-2 {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .col-lg-2 {
        display: none !important;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 767.98px) {
    /* Ensure touch targets are at least 44px */
    .nav-link,
    .btn,
    .quick-action-btn,
    .sidebar-toggle {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Improve text readability */
    body {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
    
    /* Better contrast for mobile */
    .text-muted {
        color: #666 !important;
    }
}