/* Mobile Responsive Styles */
/* Extra small devices (phones, 576px and below) */
@media (max-width: 576px) {
    * {
        margin: 0;
        padding: 0;
    }

    body {
        font-size: 14px;
        line-height: 1.5;
    }

    .container {
        padding: 0.5rem;
        max-width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Navbar */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-menu {
        position: fixed;
        left: 0;
        top: 60px;
        width: 100%;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 100;
    }

    .navbar-menu.hidden {
        display: none;
    }

    .navbar-item {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid #eee;
    }

    /* Sidebar (hidden on mobile) */
    .admin-sidebar {
        display: none;
    }

    .admin-container {
        flex-direction: column;
    }

    .admin-content {
        width: 100%;
    }

    /* Grid layouts */
    .grid-2 {
        grid-template-columns: 1fr !important;
    }

    .grid-3 {
        grid-template-columns: 1fr !important;
    }

    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    /* Buttons */
    .btn {
        width: 100%;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Forms */
    input,
    textarea,
    select {
        width: 100%;
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    label {
        display: block;
        margin-bottom: 0.25rem;
        font-weight: 600;
    }

    /* Tables */
    table {
        font-size: 0.85rem;
        width: 100%;
        overflow-x: auto;
        display: block;
    }

    thead {
        display: none;
    }

    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 0.5rem;
    }

    td {
        text-align: left;
        padding: 0.5rem 0;
    }

    td:before {
        content: attr(data-label);
        font-weight: bold;
        width: 100%;
        display: block;
        margin-bottom: 0.5rem;
    }

    /* Modal */
    .modal {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        display: none;
        z-index: 1000;
    }

    .modal.active {
        display: flex;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 8px;
    }

    /* Dropdowns */
    .dropdown-menu {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto;
    }

    /* Search */
    .search-form {
        flex-direction: column;
    }

    .search-input-group {
        flex-direction: column;
    }

    .search-input-group input,
    .search-input-group button {
        width: 100%;
    }

    /* Footer */
    .footer {
        padding: 1.5rem 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    /* Pagination */
    .pagination {
        gap: 0.25rem;
    }

    .pagination a,
    .pagination span {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Alerts */
    .alert {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    /* Spacing */
    .mt-1 { margin-top: 0.25rem; }
    .mt-2 { margin-top: 0.5rem; }
    .mt-3 { margin-top: 1rem; }
    .mb-1 { margin-bottom: 0.25rem; }
    .mb-2 { margin-bottom: 0.5rem; }
    .mb-3 { margin-bottom: 1rem; }

    /* Visibility */
    .d-none-mobile {
        display: none !important;
    }

    .d-block-mobile {
        display: block !important;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-4 {
        grid-template-columns: 1fr 1fr;
    }

    h1 {
        font-size: 1.75rem;
    }

    /* Sidebar on tablets */
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
    }

    .admin-nav-menu {
        flex-direction: row;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 1rem;
    }

    .admin-nav {
        flex-shrink: 0;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .d-none-mobile {
        display: block !important;
    }

    .d-block-mobile {
        display: none !important;
    }

    .admin-container {
        flex-direction: row !important;
    }

    .admin-sidebar {
        width: 260px !important;
        display: block !important;
        min-height: 100vh;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    .clickable {
        min-height: 44px; /* Apple's recommendation */
        min-width: 44px;
        padding: 0.75rem;
    }

    /* Remove hover effects on touch */
    a:hover,
    button:hover,
    .card:hover {
        transform: none;
    }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 600px) {
    .navbar {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .container {
        padding-top: 0;
        padding-bottom: 0;
    }

    h1,
    h2,
    h3 {
        margin: 0.5rem 0;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .sidebar,
    .admin-nav-menu,
    button,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .container {
        padding: 0;
        margin: 0;
    }

    a {
        text-decoration: underline;
    }
}
