/* ============================================
   GLOBAL RESPONSIVE STYLES FOR ALL PAGES
   ============================================ */

/* Ensure all pages have proper responsive behavior */
html {
    font-size: 16px;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* Container Responsive Adjustments */
.container-xxl,
.container-xl,
.container-lg,
.container-md,
.container-sm,
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Layout Wrapper Responsive */
.layout-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.layout-container {
    flex: 1;
    display: flex;
    width: 100%;
}

.layout-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

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

.card-body {
    padding: 1.5rem;
}

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

/* Form Responsive */
.form-control,
.form-select {
    width: 100%;
    max-width: 100%;
}

/* Button Responsive */
.btn {
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Extra Small Devices (Portrait Phones, less than 576px) */
@media (max-width: 575.98px) {
    html {
        font-size: 14px;
    }

    .container-xxl,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        padding-right: 10px;
        padding-left: 10px;
    }

    .card-body {
        padding: 1rem;
    }

    /* Stack columns on mobile */
    .row>[class*="col-"] {
        margin-bottom: 1rem;
    }

    /* Make tables scroll horizontally */
    .table {
        font-size: 0.85rem;
    }

    /* Adjust headings */
    h1,
    .h1 {
        font-size: 1.75rem;
    }

    h2,
    .h2 {
        font-size: 1.5rem;
    }

    h3,
    .h3 {
        font-size: 1.25rem;
    }

    h4,
    .h4 {
        font-size: 1.1rem;
    }

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

    .btn-group {
        flex-direction: column;
    }

    .btn-group>.btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Small Devices (Landscape Phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    html {
        font-size: 15px;
    }

    .container-sm,
    .container {
        max-width: 540px;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Medium Devices (Tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    html {
        font-size: 15px;
    }

    .container-md,
    .container-sm,
    .container {
        max-width: 720px;
    }

    .card-body {
        padding: 1.5rem;
    }
}

/* Large Devices (Desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    html {
        font-size: 16px;
    }

    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 960px;
    }
}

/* Extra Large Devices (Large Desktops, 1200px and up) */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    html {
        font-size: 16px;
    }

    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 1140px;
    }
}

/* XXL Devices (Extra Large Desktops, 1400px and up) */
@media (min-width: 1400px) {
    html {
        font-size: 16px;
    }

    .container-xxl,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container {
        max-width: 1440px;
    }
}

/* Very Small Height Screens (Landscape Mobile) */
@media (max-height: 600px) {
    .content-wrapper {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .card {
        margin-bottom: 1rem;
    }

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

/* Small Height Screens */
@media (min-height: 601px) and (max-height: 800px) {
    .content-wrapper {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* ============================================
   DASHBOARD SPECIFIC RESPONSIVE STYLES
   ============================================ */

/* Dashboard Cards */
.card-dashboard {
    border: 0;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Border Left Variants */
.border-left-primary {
    border-left: 4px solid #5a8dee !important;
}

.border-left-success {
    border-left: 4px solid #39da8a !important;
}

.border-left-info {
    border-left: 4px solid #00cfdd !important;
}

.border-left-warning {
    border-left: 4px solid #fdac41 !important;
}

.border-left-danger {
    border-left: 4px solid #ff5b5c !important;
}

/* Dashboard Responsive Adjustments */
@media (max-width: 767.98px) {

    /* Stack dashboard cards on mobile */
    .col-xl-3,
    .col-md-6 {
        margin-bottom: 1rem;
    }

    /* Reduce card padding on mobile */
    .card-dashboard .card-body {
        padding: 1rem;
    }

    /* Adjust font sizes */
    .card-dashboard .h5 {
        font-size: 1.25rem;
    }

    .card-dashboard .text-xs {
        font-size: 0.75rem;
    }
}

/* ============================================
   FORM PAGE RESPONSIVE STYLES
   ============================================ */

/* Form Layouts */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Responsive Form Columns */
@media (max-width: 767.98px) {

    /* Stack form columns on mobile */
    .row .col-md-6,
    .row .col-md-4,
    .row .col-md-3 {
        margin-bottom: 1rem;
    }

    /* Full width buttons on mobile */
    .btn-group-responsive .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   TABLE PAGE RESPONSIVE STYLES
   ============================================ */

/* DataTables Responsive */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

.dataTable {
    width: 100% !important;
}

@media (max-width: 767.98px) {

    /* Adjust table font size on mobile */
    .dataTable {
        font-size: 0.85rem;
    }

    .dataTable thead th,
    .dataTable tbody td {
        padding: 0.5rem;
    }

    /* Stack action buttons in tables */
    .dataTable .btn-group {
        display: flex;
        flex-direction: column;
    }

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

/* ============================================
   NAVIGATION RESPONSIVE STYLES
   ============================================ */

/* Sidebar Menu Responsive */
@media (max-width: 1199.98px) {

    /* Collapse menu on smaller screens */
    .layout-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .layout-menu.show {
        transform: translateX(0);
    }
}

/* Navbar Responsive */
.navbar {
    padding: 0.5rem 1rem;
}

@media (max-width: 767.98px) {
    .navbar {
        padding: 0.5rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

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

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

/* Responsive Spacing */
@media (max-width: 767.98px) {
    .mb-sm-3 {
        margin-bottom: 1rem !important;
    }

    .mt-sm-3 {
        margin-top: 1rem !important;
    }

    .p-sm-2 {
        padding: 0.5rem !important;
    }
}

/* Responsive Display */
@media (max-width: 767.98px) {
    .d-sm-block {
        display: block !important;
    }

    .d-sm-none {
        display: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {

    .layout-menu,
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .layout-page {
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}