/**
 * GELIS Mobile Optimization CSS
 * Responsive design for mobile devices
 */

/* Extra Small Devices (phones) */
@media (max-width: 575.98px) {
    :root {
        --sidebar-width: 100%;
        --navbar-height: 60px;
    }

    /* Body adjustments */
    body {
        font-size: 14px;
    }

    /* Navbar adjustments */
    .navbar-custom {
        height: var(--navbar-height);
        padding: 0 1rem;
    }

    .navbar-brand-custom {
        font-size: 1.25rem;
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    /* Sidebar adjustments */
    .sidebar-custom {
        top: var(--navbar-height);
        height: calc(100vh - var(--navbar-height));
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        z-index: 1050;
    }

    .sidebar-custom.show {
        transform: translateX(0);
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar-user {
        padding: 1rem;
    }

    .sidebar-user img {
        width: 50px;
        height: 50px;
    }

    .sidebar-item {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Main content adjustments */
    .main-content {
        margin-left: 0;
        margin-top: var(--navbar-height);
        padding: 1rem;
    }

    /* Statistics cards */
    .stat-card {
        padding: 1rem;
        min-height: 100px;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card i {
        font-size: 2rem;
        right: 1rem;
    }

    /* Cards */
    .card-modern {
        margin-bottom: 1rem;
    }

    .card-header-modern {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Tables */
    .table-modern {
        font-size: 0.875rem;
    }

    .table-modern thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .table-modern td {
        padding: 0.75rem 0.5rem;
    }

    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .btn-primary-custom {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .btn-group-sm .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Forms */
    .form-control, .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }

    /* Charts */
    .apexcharts-canvas {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    /* Dropdowns */
    .dropdown-menu {
        min-width: 200px;
        font-size: 0.875rem;
    }

    .dropdown-menu-lg {
        min-width: 250px;
        max-width: 90vw;
    }

    /* Badges */
    .badge {
        font-size: 0.65rem;
        padding: 0.35rem 0.5rem;
    }

    /* Alerts */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    /* Tooltips */
    .tooltip-inner {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }

    /* Loading overlay */
    .loading-overlay p {
        font-size: 0.875rem;
    }

    /* Specific mobile adjustments */
    .d-none-mobile {
        display: none !important;
    }

    .d-block-mobile {
        display: block !important;
    }

    .text-center-mobile {
        text-align: center !important;
    }

    .w-100-mobile {
        width: 100% !important;
    }

    .flex-column-mobile {
        flex-direction: column !important;
    }

    /* Hide certain elements on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Search bar adjustments */
    .navbar-custom .form-control {
        width: 150px !important;
        font-size: 0.875rem;
    }

    /* Notification badge adjustments */
    .navbar-custom .badge {
        font-size: 0.6rem;
        padding: 0.25rem 0.35rem;
        top: -5px;
        right: -5px;
    }

    /* Quick actions mobile */
    .d-grid .btn {
        padding: 0.75rem;
        font-size: 0.9rem;
        text-align: left;
    }

    /* Pagination mobile */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pagination .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
        min-width: 36px;
    }

    /* List groups mobile */
    .list-group-item {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    /* Footer adjustments */
    .footer {
        padding: 1rem;
        font-size: 0.875rem;
    }

    /* Print optimization for mobile */
    @media print and (max-width: 575.98px) {
        .container-fluid {
            padding: 0.5rem;
        }

        .card {
            margin-bottom: 0.5rem;
            page-break-inside: avoid;
        }

        .table {
            font-size: 0.7rem;
        }

        .no-print-mobile {
            display: none !important;
        }
    }
}

/* Small Devices (landscape phones) */
@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar-custom {
        height: 50px;
    }

    .main-content {
        margin-top: 50px;
        padding: 0.75rem;
    }

    .stat-card {
        padding: 0.75rem;
        min-height: 80px;
    }

    .stat-card h3 {
        font-size: 1.25rem;
    }

    .sidebar-custom {
        top: 50px;
        height: calc(100vh - 50px);
    }
}

/* Medium Devices (tablets) */
@media (min-width: 576px) and (max-width: 991.98px) {
    .stat-card {
        padding: 1.25rem;
    }

    .sidebar-custom {
        width: 250px;
    }

    .main-content {
        margin-left: 250px;
    }

    .sidebar-custom.collapsed ~ .main-content {
        margin-left: 0;
    }

    /* Responsive tables for tablets */
    .table-responsive {
        overflow-x: auto;
    }

    /* Adjust modal sizes */
    .modal-dialog {
        max-width: 600px;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }

    .sidebar-item {
        padding: 1rem 1.5rem;
        min-height: 44px;
    }

    .form-control, .form-select {
        min-height: 44px;
    }

    /* Add touch feedback */
    .btn:active,
    .sidebar-item:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* Remove hover effects */
    .sidebar-item:hover {
        background-color: inherit;
    }

    .btn:hover {
        transform: none;
        box-shadow: none;
    }
}

/* High resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar-user img,
    .navbar-custom img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) and (max-width: 575.98px) {
    .main-content {
        background-color: #1a202c;
        color: #e2e8f0;
    }

    .card-modern {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    .table-modern {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    .form-control,
    .form-select {
        background-color: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .sidebar-custom,
    .main-content,
    .btn,
    .card-modern,
    .stat-card {
        transition: none;
        animation: none;
    }

    .animate-slide-up,
    .animate-fade-in {
        animation: none;
        opacity: 1;
    }
}