/* WemAkili Mobile Responsive Styles */

/* Base Mobile Optimizations */
@media (max-width: 767.98px) {
    /* Typography adjustments for mobile */
    h1 {
        font-size: 1.75rem !important;
    }
    h2 {
        font-size: 1.5rem !important;
    }
    h3 {
        font-size: 1.25rem !important;
    }
    h4 {
        font-size: 1.1rem !important;
    }
    h5 {
        font-size: 1rem !important;
    }

    /* Container padding */
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Card spacing */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Form elements */
    .form-control,
    .form-select {
        font-size: 1rem;
    }

    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
    }

    /* Table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 1rem;
    }

    /* Navbar mobile optimizations */
    .navbar-brand img {
        max-height: 40px !important;
    }

    .navbar-nav {
        padding-top: 1rem;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Dashboard cards */
    .dashboard-card {
        margin-bottom: 1rem;
    }

    .stat-card {
        margin-bottom: 1rem;
        text-align: center;
    }

    /* Chart containers */
    .chart-container {
        position: relative;
        height: 250px;
        margin-bottom: 1.5rem;
    }

    /* Assessment question containers */
    .question-container {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .assessment-option {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Action buttons stack on mobile */
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* Spacing utilities */
    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }
    .mt-mobile-3 {
        margin-top: 1rem !important;
    }
    .py-mobile-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Hide elements on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }

    /* Dropdown menu improvements */
    .dropdown-menu {
        font-size: 0.9rem;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.65em;
    }

    /* Alert adjustments */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Pagination */
    .pagination {
        font-size: 0.85rem;
    }

    .page-link {
        padding: 0.375rem 0.75rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.5rem 0;
    }

    /* Progress bars */
    .progress {
        height: 1.5rem;
        font-size: 0.85rem;
    }

    /* List groups */
    .list-group-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Grid adjustments */
    .row {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }

    .row > * {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Tablet adjustments (768px - 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    h1 {
        font-size: 2rem !important;
    }
    h2 {
        font-size: 1.75rem !important;
    }

    .card-body {
        padding: 1.5rem;
    }

    table {
        font-size: 0.9rem;
    }
}

/* Small mobile devices (max-width: 575.98px) */
@media (max-width: 575.98px) {
    /* Extra compact for very small screens */
    body {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    /* Stack columns on very small screens */
    .col-6,
    .col-sm-6 {
        width: 100%;
    }

    /* Button groups stack */
    .btn-group {
        display: flex;
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: 0.25rem !important;
        margin-bottom: 0.25rem;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }

    .navbar-brand img {
        max-height: 35px !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .nav-link,
    .dropdown-item,
    .page-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover states on touch devices */
    .card:hover,
    .btn:hover {
        transform: none;
    }

    /* Better spacing for touch */
    .list-group-item,
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
}

/* Admin panel specific responsive styles */
@media (max-width: 991.98px) {
    /* Sidebar adjustments for admin */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1040;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Admin stats cards */
    .admin-stat-card {
        margin-bottom: 1rem;
    }

    /* Admin table actions */
    .admin-table-actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .admin-table-actions .btn {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.375rem;
    }
}

/* User dashboard specific styles */
@media (max-width: 767.98px) {
    /* Assessment cards */
    .assessment-card {
        margin-bottom: 1rem;
    }

    .assessment-card .card-body {
        padding: 1rem;
    }

    /* Progress tracker */
    .progress-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Resource cards */
    .resource-card {
        margin-bottom: 1rem;
    }

    .resource-card img {
        max-height: 150px;
        object-fit: cover;
    }

    /* Story cards */
    .story-card {
        margin-bottom: 1rem;
    }

    /* Appointment cards */
    .appointment-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .appointment-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }
}

/* Print media adjustments */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }

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

    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
    /* Placeholder for dark mode styles */
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .btn,
    .card,
    .form-control {
        border-width: 2px;
    }
}

/* Fix for iOS Safari bottom bar */
@supports (-webkit-touch-callout: none) {
    .min-vh-100 {
        min-height: -webkit-fill-available;
    }
}

/* Utility classes for responsive visibility */
.d-mobile-none {
    display: block;
}
.d-mobile-block {
    display: none;
}

@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none !important;
    }
    .d-mobile-block {
        display: block !important;
    }
    .d-mobile-flex {
        display: flex !important;
    }
    .d-mobile-inline {
        display: inline !important;
    }
    .d-mobile-inline-block {
        display: inline-block !important;
    }
}

/* Responsive flex utilities */
@media (max-width: 767.98px) {
    .flex-mobile-column {
        flex-direction: column !important;
    }

    .flex-mobile-row {
        flex-direction: row !important;
    }

    .justify-content-mobile-center {
        justify-content: center !important;
    }

    .align-items-mobile-center {
        align-items: center !important;
    }
}

/* Responsive text alignment */
@media (max-width: 767.98px) {
    .text-mobile-center {
        text-align: center !important;
    }

    .text-mobile-left {
        text-align: left !important;
    }

    .text-mobile-right {
        text-align: right !important;
    }
}

/* Responsive width utilities */
@media (max-width: 767.98px) {
    .w-mobile-100 {
        width: 100% !important;
    }

    .w-mobile-auto {
        width: auto !important;
    }
}

/* Fix for overflow issues on mobile */
body {
    overflow-x: hidden;
}

.row {
    overflow-x: hidden;
}

/* Improve input fields on iOS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0.25rem;
}

/* Fix for select dropdowns on mobile */
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='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}
