/* =============================================
   Clinic Management System - Responsive Styles (RTL Optimized)
   ============================================= */

/* Big Tablets & Small Laptops */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets Breakpoint */
@media (max-width: 1024px) {

    .grid-3-1,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 1.25rem;
    }
}

/* Mobile Navigation & Layout */
@media (max-width: 768px) {
    .sidebar {
        transform: none;
        /* Disable translate, use right instead */
        width: 280px;
        right: -280px;
        /* Hide off-screen to the right */
        left: auto;
        visibility: hidden;
    }

    .sidebar.active {
        right: 0;
        visibility: visible;
    }

    .main-content {
        margin-right: 0 !important;
        /* Force reset margin on mobile */
        margin-left: 0 !important;
    }

    .menu-toggle {
        display: flex;
        /* Show toggle button */
    }

    .header {
        padding: 0 1rem;
    }

    .search-box {
        display: none;
        /* Hide global search on mobile header to save space */
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header .quick-actions {
        width: 100%;
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .page-content {
        padding: 1rem;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .table-search {
        width: 100%;
    }

    .table-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .table-actions .btn {
        flex: 1;
    }

    .data-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        width: calc(100% - 2rem);
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        overflow-x: auto;
    }

    .calendar-day {
        min-height: 80px;
        min-width: 100px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .btn-sm {
        width: 100%;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .header-right {
        gap: 0.5rem;
    }

    .header-icon {
        width: 36px;
        height: 36px;
    }

    .user-profile {
        padding: 4px;
        background: transparent;
    }

    .user-info {
        display: none;
        /* Hide user name on very small screens */
    }

    .breadcrumb {
        display: none;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .table-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
    }
}

/* Sidebar Toggle Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Print Styles */
@media print {

    .sidebar,
    .header,
    .btn,
    .table-actions,
    .pagination,
    .sidebar-overlay,
    .quick-actions {
        display: none !important;
    }

    .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    .data-table {
        display: table !important;
    }
}