/**
 * Omilette Grocery POS - Main Stylesheet
 * Brand color palette: Terracotta orange (#d84326), Warm Cream (#fff8f5), Charcoal (#212529)
 */

:root {
    --brand-primary: #d84326;
    --brand-primary-hover: #be351b;
    --brand-secondary: #f4793b;
    --brand-dark: #1f2428;
    --brand-light: #fefcfb;
    --brand-surface: #f4f6f8;
    --brand-border: #e2e8f0;
    --brand-accent: #28a745;
    --brand-warning: #f39c12;
    --brand-danger: #dc3545;
}

body {
    background-color: var(--brand-surface);
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2d3748;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Brand Navbar */
.navbar-brand-custom {
    background-color: #ffffff;
    border-bottom: 2px solid #f1f3f5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.brand-logo-img {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.brand-logo-img:hover {
    transform: scale(1.03);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0;
}

.brand-badge {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom Buttons */
.btn-brand {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
    font-weight: 600;
}

.btn-brand:hover, .btn-brand:focus, .btn-brand:active {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: #ffffff;
}

.btn-outline-brand {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    font-weight: 600;
}

.btn-outline-brand:hover {
    background-color: var(--brand-primary);
    color: #ffffff;
}

/* Dashboard Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Numeric Touch Keypad for Staff PIN Login */
.keypad-container {
    max-width: 380px;
    margin: 0 auto;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.keypad-btn {
    height: 64px;
    font-size: 1.6rem;
    font-weight: 700;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    background-color: #ffffff;
    color: #212529;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.keypad-btn:active {
    background-color: #e9ecef;
    transform: scale(0.96);
}

.keypad-btn.action-btn {
    font-size: 1.1rem;
    font-weight: 600;
}

.pin-display {
    font-size: 2rem;
    letter-spacing: 12px;
    height: 60px;
    text-align: center;
    border: 2px solid #ced4da;
    border-radius: 12px;
    background: #ffffff;
    font-family: monospace;
}

.pin-display:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(216, 67, 38, 0.25);
}

/* POS Screen Styles */
.pos-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pos-cart-container {
    height: calc(100vh - 280px);
    min-height: 380px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.pos-table th {
    background-color: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 2px solid #e2e8f0;
}

.pos-total-box {
    background: #1f2428;
    color: #ffffff;
    border-radius: 10px;
    padding: 16px 20px;
}

.pos-total-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: #4ade80;
    font-family: monospace;
}

/* Fast action buttons */
.quick-cash-btn {
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.95rem;
    padding: 10px 14px;
}

/* Touch Product Grid on POS */
.pos-catalog-container {
    height: calc(100vh - 240px);
    min-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.pos-product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 110px;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.pos-product-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(216, 67, 38, 0.12);
}

.pos-product-card:active {
    transform: scale(0.96);
    background-color: #fdf5f2;
}

.pos-product-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
    color: #212529;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pos-product-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand-primary);
}

.pos-product-meta {
    font-size: 0.72rem;
    color: #6c757d;
}

.category-pill-btn {
    white-space: nowrap;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 14px;
}

/* Mobile & Tablet Optimizations */
@media (max-width: 991.98px) {
    .brand-logo-img {
        height: 34px;
    }
    .pos-cart-container {
        height: 340px;
    }
    .pos-total-amount {
        font-size: 1.8rem;
    }
}

@media (max-width: 575.98px) {
    .brand-title {
        font-size: 1.05rem;
    }
    .keypad-btn {
        height: 56px;
        font-size: 1.4rem;
    }
    .pos-cart-container {
        height: 280px;
    }
}

/* Smooth Desktop Dropdown Hover */
@media (min-width: 992px) {
    .navbar .dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
        animation: fadeInDown 0.15s ease-in-out;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================== */
/* TABLET & MOBILE LANDSCAPE POS OPTIMIZATIONS (PWA MODE)              */
/* =================================================================== */

/* Landscape Mode (Phones & Tablets in Cashier Position) */
@media (orientation: landscape) and (max-height: 900px) {
    /* Ultra-compact sticky navbar */
    .navbar-brand-custom {
        padding-top: 3px !important;
        padding-bottom: 3px !important;
    }
    .brand-logo-img {
        height: 28px !important;
    }
    .brand-title {
        font-size: 1.05rem !important;
    }
    .navbar .nav-link {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
        font-size: 0.85rem !important;
    }

    /* Keep side-by-side split in landscape even on phones / small tablets */
    .pos-wrapper .row.g-3.flex-grow-1 {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
    }
    .pos-wrapper .col-lg-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
    }

    /* Compact Top Action Bar */
    .pos-wrapper .row.g-2.mb-3 {
        margin-bottom: 6px !important;
    }
    #barcode-scanner {
        font-size: 0.95rem !important;
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }
    .pos-wrapper .btn {
        padding: 4px 8px !important;
        font-size: 0.8rem !important;
    }

    /* Responsive heights for landscape screens */
    .pos-catalog-container {
        height: calc(100vh - 210px) !important;
        min-height: 220px !important;
    }
    .pos-cart-container {
        height: calc(100vh - 365px) !important;
        min-height: 140px !important;
    }

    /* Compact Product Grid in Landscape */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important;
        gap: 6px !important;
    }
    .pos-product-card {
        height: 94px !important;
        padding: 6px 8px !important;
    }
    .pos-product-title {
        font-size: 0.76rem !important;
        line-height: 1.2 !important;
        -webkit-line-clamp: 2 !important;
    }
    .pos-product-price {
        font-size: 0.88rem !important;
    }
    .pos-product-meta {
        font-size: 0.68rem !important;
    }

    /* Category Filter Pills */
    .category-pill-btn {
        font-size: 0.75rem !important;
        padding: 3px 10px !important;
    }

    /* Totals & Quick Cash */
    .pos-total-box {
        padding: 6px 12px !important;
        margin-bottom: 6px !important;
    }
    .pos-total-amount {
        font-size: 1.5rem !important;
    }
    .quick-cash-btn {
        padding: 4px 6px !important;
        font-size: 0.78rem !important;
    }
    #btn-process-checkout {
        padding: 8px !important;
        font-size: 1.1rem !important;
    }

    /* Hide orientation hint when already in landscape */
    .orientation-hint {
        display: none !important;
    }
}

/* Standalone PWA adjustments (installed app on tablet/mobile) */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    /* Hide browser-specific elements in standalone */
    #btn-pwa-install {
        display: none !important;
    }
}

