/* Mobile Responsive Styles for Bakery Management System */

/* ============ GLOBAL MOBILE FIXES ============ */
@media (max-width: 768px) {
    /* Headers */
    .dashboard-header,
    .header-gradient,
    .header-section,
    .page-header {
        padding: 1rem 0 !important;
    }

    .dashboard-header h1,
    .header-gradient h1,
    .header-section h1,
    .header-gradient .display-5 {
        font-size: 1.4rem !important;
    }

    .dashboard-header .display-4 {
        font-size: 1.6rem !important;
    }

    .dashboard-header .lead,
    .header-gradient .lead,
    .header-section p {
        font-size: 0.85rem !important;
    }

    /* Header details are hidden via d-none d-md-block classes in HTML */

    /* Header description text */
    .header-gradient .lead,
    .header-section .lead,
    .header-section p.mb-0 {
        font-size: 0.8rem !important;
    }

    .lao-text {
        font-size: 0.8rem !important;
    }

    /* Navbar */
    .navbar-brand {
        font-size: 0.95rem !important;
    }

    .navbar-text {
        display: none !important;
    }

    /* Container padding */
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* ============ CARDS ============ */
    .metric-card,
    .management-card,
    .action-card,
    .settings-card {
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .metric-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.3rem !important;
        margin-bottom: 0.5rem !important;
    }

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

    .metric-label {
        font-size: 0.8rem !important;
    }

    .management-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
        margin-top: 1rem !important;
    }

    .management-card {
        padding: 1rem !important;
    }

    .management-card h5 {
        font-size: 0.85rem !important;
    }

    .management-card p {
        font-size: 0.7rem !important;
        margin-bottom: 0 !important;
    }

    .management-icon {
        width: 55px !important;
        height: 55px !important;
        font-size: 1.5rem !important;
        margin-bottom: 0.8rem !important;
    }

    /* ============ SUMMARY STAT CARDS ============ */
    .col-md-3 > .card .card-body {
        padding: 0.75rem !important;
    }

    .col-md-3 > .card .card-body h4,
    .col-md-3 > .card .card-body .h5 {
        font-size: 1.1rem !important;
    }

    .col-md-3 > .card .card-body h6,
    .col-md-3 > .card .card-body .text-xs {
        font-size: 0.7rem !important;
    }

    .col-md-3 > .card .card-body .fa-2x {
        font-size: 1.2rem !important;
    }

    /* Two-column summary cards on mobile */
    .row > .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-bottom: 10px !important;
    }

    /* ============ TABLES ============ */
    .table {
        font-size: 0.75rem !important;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.3rem !important;
        white-space: nowrap;
    }

    .table .btn-sm {
        padding: 0.2rem 0.35rem !important;
        font-size: 0.7rem !important;
    }

    .table .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }

    .table .badge {
        font-size: 0.65rem !important;
        padding: 0.2em 0.4em !important;
    }

    /* Stock input in ingredients table */
    .table input[type="number"] {
        width: 65px !important;
        font-size: 0.75rem !important;
        padding: 0.2rem 0.3rem !important;
    }

    /* ============ CARD HEADERS / TOOLBARS ============ */
    .card-header {
        padding: 0.6rem 0.8rem !important;
    }

    .card-header.d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .card-header .d-flex.align-items-center.gap-3,
    .card-header .d-flex.gap-2 {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }

    .card-header .d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Search input in card headers */
    .card-header .input-group,
    .card-header input[type="text"],
    .card-header input[id="searchInput"] {
        width: 100% !important;
    }

    /* Category filter buttons - horizontal scroll */
    .card-header .btn-group[role="group"] {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        padding-bottom: 2px;
    }

    .card-header .btn-group[role="group"] .btn {
        flex-shrink: 0;
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Bulk actions */
    #bulkActions {
        width: 100%;
    }

    #bulkActions .btn {
        font-size: 0.75rem !important;
        flex: 1;
    }

    /* ============ FORMS ============ */
    .form-control,
    .form-select {
        font-size: 0.9rem !important;
        padding: 0.6rem 0.8rem !important;
    }

    .form-label {
        font-size: 0.85rem !important;
    }

    /* ============ BUTTONS ============ */
    .btn {
        font-size: 0.85rem !important;
    }

    .btn-sm {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.5rem !important;
    }

    /* Quick action buttons - 2 per row */
    .card-body .row.text-center > .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .card-body .row.text-center .btn .fa-2x {
        font-size: 1.2rem !important;
    }

    /* ============ MODALS ============ */
    .modal-dialog {
        margin: 0.5rem !important;
    }

    .modal-body {
        padding: 1rem !important;
    }

    /* ============ FLOATING ACTION BUTTON ============ */
    .floating-action {
        bottom: 15px !important;
        right: 15px !important;
    }

    .fab {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }

    /* ============ AUTH BUTTONS IN HEADER ============ */
    .dashboard-header .text-end .btn,
    .page-header .btn {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.6rem !important;
    }

    /* ============ CALCULATOR PAGES ============ */
    .ingredient-row {
        padding: 0.5rem !important;
    }

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

    .quantity-input {
        width: 80px !important;
        font-size: 0.85rem !important;
    }

    .quantity-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
    }

    .ingredient-cost {
        min-width: auto !important;
        font-size: 0.8rem !important;
    }

    .ingredient-controls {
        flex-wrap: wrap !important;
        gap: 0.3rem !important;
    }

    /* Calculator filter buttons */
    .ingredient-search-section .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
    }

    .ingredient-search-section .btn-group .btn {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    /* Cost summary sticky on mobile */
    .cost-summary {
        position: static !important;
    }

    /* ============ PRICE LIST ============ */
    .price-header {
        padding: 1rem !important;
    }

    .bakery-info .col-md-4 {
        text-align: center !important;
        margin-bottom: 0.5rem;
    }

    /* ============ EDIT PRODUCT RECIPE ============ */
    .ingredient-row .row > div {
        margin-bottom: 0.3rem;
    }

    /* ============ UTILITY CALCULATOR ============ */
    .method-tab {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
    }

    /* ============ LOGIN PAGE ============ */
    .login-card {
        padding: 1.5rem !important;
        margin: 0.5rem !important;
        border-radius: 15px !important;
    }

    .login-logo {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
    }

    .login-card h3 {
        font-size: 1.3rem !important;
    }

    /* ============ SETTINGS PAGE ============ */
    .settings-card {
        padding: 1.5rem !important;
    }

    .section-icon {
        width: 45px !important;
        height: 45px !important;
        font-size: 1.2rem !important;
    }

    /* ============ REPORTS ============ */
    .col-md-6 canvas {
        max-height: 250px !important;
    }

    /* ============ GENERAL SPACING ============ */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-5 {
        margin-bottom: 1.5rem !important;
    }

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

    .p-4 {
        padding: 1rem !important;
    }

    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Row gaps */
    .row.g-4 {
        --bs-gutter-y: 0.5rem !important;
        --bs-gutter-x: 0.5rem !important;
    }
}

/* ============ EXTRA SMALL SCREENS (< 400px) ============ */
@media (max-width: 400px) {
    .management-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .management-card {
        padding: 0.75rem !important;
    }

    .management-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
    }

    .management-card h5 {
        font-size: 0.75rem !important;
    }

    .row > .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .table {
        font-size: 0.7rem !important;
    }

    .dashboard-header .display-4 {
        font-size: 1.3rem !important;
    }
}