/**
 * Extra phone + iPad polish on top of style.css
 * Breakpoints: phone ≤575 / large phone+iPad portrait ≤767 / tablet ≤991 / iPad landscape ≤1199
 */

/* ----- iPad portrait / large phones: stack header like phone ----- */
@media (max-width: 767.98px) {
    .app-main {
        padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
    }

    .app-header {
        padding-top: max(0.65rem, env(safe-area-inset-top));
        gap: 0.55rem;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
    }

    .header-start {
        grid-column: 1;
        grid-row: 1;
        gap: 0.55rem;
    }

    .header-end {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .header-center {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .header-title h1 {
        font-size: 1.05rem;
    }

    .header-rate-code {
        display: none;
    }

    /* POS: icon-only actions earlier (iPad portrait + phones) */
    .posx-btn span {
        display: none;
    }

    .posx-btn {
        width: 42px;
        height: 42px;
        justify-content: center;
        padding: 0;
    }

    .posx-topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .pos-credit-inputs,
    .pos-credit-summary {
        grid-template-columns: 1fr !important;
    }
}

/* ----- Phone: prevent accidental horizontal page scroll ----- */
@media (max-width: 575.98px) {
    .app-content,
    .app-main,
    .content-card {
        max-width: 100%;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .home-menu-meta {
        width: 100%;
        justify-content: stretch;
    }

    .home-menu-meta-chip,
    .home-menu-user {
        flex: 1 1 auto;
    }
}

/* ----- Orders mobile / tablet cards ----- */
.orders-cards {
    display: grid;
    gap: 0.75rem;
    padding: 0.85rem;
}

.orders-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.orders-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.orders-card-number {
    font-weight: 800;
    color: #1d4ed8;
    text-decoration: none;
    word-break: break-word;
}

.orders-card-number:hover {
    text-decoration: underline;
}

.orders-card-total {
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.orders-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    color: #64748b;
    font-size: 0.82rem;
    margin-bottom: 0.55rem;
}

.orders-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.orders-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.orders-card-actions {
    display: flex;
    gap: 0.5rem;
}

.orders-card-actions .btn {
    flex: 1 1 auto;
}

@media (max-width: 575.98px) {
    .orders-cards {
        padding: 0.65rem;
        gap: 0.65rem;
    }

    .orders-card-actions {
        flex-direction: column;
    }
}

[data-theme="dark"] .orders-card,
[data-bs-theme="dark"] .orders-card {
    background: #0f172a;
    border-color: #1e293b;
}

[data-theme="dark"] .orders-card-total,
[data-bs-theme="dark"] .orders-card-total {
    color: #f8fafc;
}

[data-theme="dark"] .orders-card-number,
[data-bs-theme="dark"] .orders-card-number {
    color: #93c5fd;
}
