/* ========================================
   ADMIN PORTAL - RESPONSIVE STYLES
   ======================================== */

/* Mobile First Approach */

/* Base Styles - Already mobile-friendly */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    .content {
        padding-top: 1.5rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 991px) {
    /* Container adjustments */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Card header adjustments */
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Row adjustments for filters and actions */
    .row.mb-3 > .col-md-4,
    .row.mb-3 > .col-md-3,
    .row.mb-3 > .col-md-2 {
        margin-bottom: 0.75rem;
    }

    /* Stats cards in rows */
    .row.mb-4 > .col-xl-3,
    .row.mb-4 > .col-md-6 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 767px) {
    /* Typography */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Tables */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }

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

    .card-body {
        padding: 1rem;
    }

    /* Buttons */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .btn-group .btn {
        margin-bottom: 0.25rem;
    }

    /* Forms */
    .form-control {
        font-size: 1rem;
    }

    .form-label {
        font-size: 0.875rem;
    }

    /* Dropdowns */
    .dropdown-menu {
        position: fixed !important;
        left: 50% !important;
        transform: translateX(-50%);
        width: 90%;
        max-width: 300px;
    }

    /* Content padding */
    .content {
        padding: 1rem !important;
    }

    /* Container fluid padding */
    .container-fluid.px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

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

    .modal-dialog.modal-xl,
    .modal-dialog.modal-lg {
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Nav tabs in modals */
    .nav-tabs {
        flex-wrap: wrap;
    }

    .nav-tabs .nav-item {
        flex: 1 1 auto;
        min-width: 0;
    }

    .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-item {
        margin-bottom: 0.25rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.875rem;
    }

    /* Stats cards */
    .stats-card {
        padding: 1rem !important;
    }

    .stats-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.25rem !important;
    }

    .stats-value {
        font-size: 1.5rem !important;
    }

    /* Action buttons row */
    .row .col-md-3 .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 575px) {
    /* Typography */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Content padding */
    .content {
        padding: 0.75rem !important;
    }

    .container-fluid.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Cards */
    .card-body {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-header {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Buttons */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-group .btn {
        width: auto;
        flex: 1;
    }

    .btn-group-vertical .btn {
        width: 100%;
    }

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

    .input-group {
        flex-wrap: wrap;
    }

    .input-group > * {
        flex: 1 1 100%;
    }

    /* Tables - Stack on mobile */
    .table thead {
        display: none;
    }

    .table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 0.75rem;
    }

    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .table td:last-child {
        border-bottom: none;
    }

    .table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--secondary-color);
        margin-right: 1rem;
        text-align: left;
    }

    /* Images in tables */
    .table img {
        max-width: 50px;
        max-height: 50px;
    }

    /* Notification adjustments */
    .notification-placeholder {
        font-size: 1.2rem;
    }

    /* Stats cards */
    .stats-card {
        padding: 0.75rem !important;
    }

    .stats-icon {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
    }

    .stats-value {
        font-size: 1.25rem !important;
    }

    .stats-label {
        font-size: 0.75rem !important;
    }

    /* Filter rows */
    .row.mb-3 > div {
        margin-bottom: 0.5rem;
    }

    /* Action buttons in cards */
    .card-header .d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    .card-header .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .dropdown,
    .notification-placeholder {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content {
        padding: 0 !important;
    }

    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Landscape orientation for mobile devices */
@media (max-width: 767px) and (orientation: landscape) {
    .sidebar {
        width: 200px;
    }

    .content {
        padding: 0.5rem !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .card {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}
