/* ============================================
   TOUCH-FRIENDLY POS SYSTEM STYLES
   Optimized for touch screen / tablet / mobile
   ============================================ */

/* --- BASE TOUCH TARGETS ---
   Apple recommends 44px minimum,
   Google recommends 48px minimum touch target */

:root {
    --touch-min-height: 48px;
    --touch-font-size: 16px;
    --touch-padding: 12px 16px;
    --touch-btn-radius: 8px;
    --touch-spacing: 8px;
    --touch-row-height: 52px;
}

/* Prevent zoom on double-tap & pinch on input focus (iOS) */
html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

/* Smooth scrolling for touch devices */
body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Prevent text selection on interactive elements during touch */
button,
.btn,
.nav-link,
.navbar-brand,
.list-group-item,
.dropdown-item,
#plist tr,
#item-list tr {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* =====================
   NAVIGATION BAR
   ===================== */

#topNavBar {
    padding: 8px 0;
}

#topNavBar .navbar-brand {
    font-size: 1.4rem;
    padding: 10px 16px;
    font-weight: 700;
}

#topNavBar .nav-link {
    min-height: var(--touch-min-height);
    display: flex;
    align-items: center;
    padding: 10px 16px !important;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--touch-btn-radius);
    margin: 2px 4px;
    transition: background-color 0.2s ease;
}

#topNavBar .nav-link:hover,
#topNavBar .nav-link:active,
#topNavBar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
}

#topNavBar .navbar-toggler {
    min-width: 48px;
    min-height: 48px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--touch-btn-radius);
}

/* Dropdown menu in navbar */
#topNavBar .dropdown-toggle {
    min-height: var(--touch-min-height);
    padding: 10px 16px;
    font-size: 1rem;
}

/* =====================
   BUTTONS - ALL 
   ===================== */

.btn {
    min-height: var(--touch-min-height);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--touch-btn-radius) !important;
    touch-action: manipulation;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Override btn-sm to still be touch-friendly */
.btn-sm {
    min-height: 42px;
    padding: 8px 16px;
    font-size: 0.95rem;
}

/* Active/pressed state feedback for touch */
.btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

/* Remove item (trash) button - make it larger */
#remove-item {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.2rem;
    padding: 10px 14px;
}

/* Transaction Save button */
#transaction-save-btn {
    min-height: 50px;
    padding: 10px 28px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* =====================
   FORM CONTROLS
   ===================== */

/* Prevent iOS zoom on input focus (requires >= 16px font) */
.form-control,
.form-select,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    min-height: var(--touch-min-height);
    font-size: var(--touch-font-size) !important;
    padding: 10px 14px;
    border-radius: var(--touch-btn-radius) !important;
    border: 2px solid #dee2e6;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Larger form control variants */
.form-control-lg {
    min-height: 56px;
    font-size: 1.2rem !important;
    padding: 12px 16px;
}

.form-control-sm {
    min-height: 44px;
    font-size: var(--touch-font-size) !important;
    padding: 8px 12px;
}

/* Search input in POS */
#search {
    min-height: 50px;
    font-size: 1.1rem !important;
    padding: 10px 16px;
    font-weight: 500;
}

/* Labels */
.control-label,
label,
.form-label {
    font-size: 1rem;
    font-weight: 600;
    padding: 6px 0;
    margin-bottom: 4px;
}

/* =====================
   TABLES - TOUCH ROWS
   ===================== */

/* Product list table rows (POS) */
#plist tbody tr {
    min-height: var(--touch-row-height);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#plist tbody tr:active {
    background-color: rgba(13, 110, 253, 0.15) !important;
}

#plist tbody tr td,
#plist thead th {
    padding: 10px 10px !important;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Item list table rows (cart) */
#item-list tbody tr {
    min-height: var(--touch-row-height);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#item-list tbody tr:active {
    background-color: rgba(13, 110, 253, 0.2) !important;
}

#item-list tbody tr td {
    padding: 8px 8px !important;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Quantity input inside cart */
#item-list input[type="number"] {
    min-height: 44px;
    font-size: 1.1rem !important;
    text-align: center;
    font-weight: 600;
    border: 2px solid #6c757d;
    border-radius: 6px !important;
    padding: 6px 4px;
}

/* General table touch improvements */
.table th {
    padding: 10px 10px !important;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table td {
    padding: 10px 10px !important;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Inventory table on home page */
#inventory td,
#inventory th {
    padding: 10px 10px !important;
}

/* Restock link - make it a touch-friendly button */
/* a.restock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 6px 14px;
    background-color: #ffc107;
    color: #212529;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

a.restock:active {
    transform: scale(0.95);
    background-color: #e0a800;
} */

/* =====================
   DROPDOWN MENUS
   ===================== */

.dropdown-menu {
    border-radius: var(--touch-btn-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 6px;
}

.dropdown-item {
    min-height: var(--touch-min-height);
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
}

.dropdown-item:active {
    background-color: #0d6efd;
    color: #fff;
}

/* Action dropdown in tables */
.btn-group .dropdown-toggle {
    min-height: 40px;
    padding: 6px 14px;
    font-size: 0.9rem;
}

/* =====================
   MODALS - TOUCH OPTIMIZED
   ===================== */

.modal-content {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 16px 20px !important;
    border-bottom: 2px solid #dee2e6;
}

.modal-header .modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-body {
    padding: 20px !important;
}

.modal-footer {
    padding: 12px 20px !important;
    gap: 10px;
    border-top: 2px solid #dee2e6;
}

.modal-footer .btn {
    min-height: 48px;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
}

/* Make modals near full-screen on small touch devices */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }

    .modal-dialog.large,
    .modal-dialog.mid-large {
        width: calc(100% - 20px) !important;
    }
}

/* =====================
   PAYMENT METHODS (tender_amount)
   ===================== */

#payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

#payment-methods button,
.btn-mm {
    min-width: 90px;
    min-height: 72px !important;
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    flex: 1 1 auto;
}

#payment-methods button i {
    font-size: 1.4rem;
}

#payment-methods button:active {
    transform: scale(0.94);
}

#payment-methods button.active,
#payment-methods button:focus {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.5);
}

/* Save/Close buttons in tender_amount */
#save_trans {
    min-height: 52px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 700;
}

/* =====================
   CARDS & DASHBOARD
   ===================== */

.card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
    padding: 14px 18px;
}

.card-body {
    padding: 16px 18px;
}

/* Dashboard stat cards */
.card-deck .card {
    cursor: default;
    transition: transform 0.15s ease;
}

.card-deck .card:active {
    transform: scale(0.98);
}

.card-deck .card .card-body {
    padding: 18px 20px;
}

.card-deck .card .fs-5 {
    font-size: 1.15rem !important;
}

.card-deck .card .fs-6 {
    font-size: 1.1rem !important;
}

.card-deck .card .fs-3 {
    font-size: 1.8rem !important;
}

/* =====================
   LIST GROUPS (Maintenance)
   ===================== */

.list-group-item {
    min-height: var(--touch-min-height);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    transition: background-color 0.15s ease;
}

.list-group-item .btn {
    min-height: 38px;
    min-width: 38px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

/* =====================
   ALERTS
   ===================== */

.alert {
    padding: 14px 18px;
    font-size: 1rem;
    border-radius: var(--touch-btn-radius);
}

.alert a {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* =====================
   BADGES
   ===================== */

.badge {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
}

/* =====================
   SCROLLBARS - TOUCH
   ===================== */

/* Make scrollbars wider for touch dragging */
::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 10px;
    min-height: 40px;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
    background: #6c757d;
}

/* =====================
   POS LAYOUT ADJUSTMENTS
   ===================== */

/* Sub-Total / Discount labels in POS */
.col-4.pe-2.fs-6.fw-bolder.text-light {
    font-size: 1.1rem !important;
}

/* Total display boxes */
#subTotal,
#t_discount,
#t_profit,
#total {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 12px;
    font-size: 1.15rem !important;
    font-weight: 700;
    border-radius: 6px;
}

/* "Items" header in POS cart */
.fs-5.fw-bolder.text-light {
    font-size: 1.2rem !important;
}

/* =====================
   DATATABLE OVERRIDES
   ===================== */

/* DataTables pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 42px;
    min-height: 42px;
    padding: 8px 14px !important;
    margin: 2px 3px !important;
    font-size: 0.95rem !important;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* DataTables search input */
.dataTables_wrapper .dataTables_filter input {
    min-height: 42px;
    font-size: var(--touch-font-size) !important;
    padding: 8px 14px;
    border-radius: var(--touch-btn-radius) !important;
}

/* DataTables length select */
.dataTables_wrapper .dataTables_length select {
    min-height: 42px;
    font-size: var(--touch-font-size) !important;
    padding: 6px 12px;
    border-radius: var(--touch-btn-radius) !important;
}

/* =====================
   CONFIRM MODAL
   ===================== */

#confirm_modal .modal-footer .btn {
    min-height: 50px;
    padding: 12px 28px;
    font-size: 1.05rem;
    font-weight: 600;
}

/* =====================
   FOOTER
   ===================== */

#sticky-footer {
    padding: 16px 0;
}

#sticky-footer small {
    font-size: 0.9rem;
}

/* =====================
   CLOCK DISPLAY
   ===================== */

#clock {
    font-size: 1rem !important;
    font-weight: 500;
    padding: 10px 16px !important;
}

/* =====================
   PRINT BUTTONS (Home/Sales Report)
   ===================== */

#print_data,
#print_data_s,
#print_data_tax,
#view_data,
#view_data_tax,
#move_data,
#pmove_data,
#filter {
    min-height: 46px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 4px 4px 4px 0;
}

/* =====================
   LOGIN PAGE TOUCH
   ===================== */

/* Login form card */
#login-form .form-control {
    min-height: 52px;
    font-size: 1.1rem !important;
    padding: 12px 16px;
}

#login-form .btn {
    min-height: 52px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 700;
}

#login-form label {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 6px;
}

/* =====================
   RESPONSIVE TOUCH - TABLET
   ===================== */

@media (max-width: 1024px) {
    /* Enlarge search bar on tablets */
    #search {
        min-height: 52px;
        font-size: 1.15rem !important;
    }

    /* Make stat cards stack better */
    .card-deck {
        margin-bottom: 8px;
    }
}

/* =====================
   RESPONSIVE TOUCH - MOBILE
   ===================== */

@media (max-width: 768px) {
    /* Stack POS columns */
    .row-cols-2 > .col-8 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .row-cols-2 > .col-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    /* Navigation items in hamburger */
    #navbarNav .nav-link {
        padding: 14px 20px !important;
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    /* Larger tap area for table rows */
    .table td {
        padding: 12px 10px !important;
    }

    /* Sales report filter */
    .form-group.col-md-2,
    .form-group.col-md-4 {
        margin-bottom: 10px;
    }

    /* Payment method buttons stack */
    #payment-methods button {
        min-width: 70px;
    }

    /* Table horizontal scroll */
    .table-responsive-touch {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =====================
   TOUCH VISUAL FEEDBACK
   ===================== */

/* Ripple-like press effect for interactive elements */
.btn:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}

/* Focus styles for accessibility on touch */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
a, button, input, select, textarea,
.nav-link, .dropdown-item, .list-group-item {
    transition: all 0.15s ease;
}

/* Prevent callout on long press (iOS) */
img, a, button {
    -webkit-touch-callout: none;
}

/* =====================
   QUANTITY +/- TOUCH CONTROLS
   ===================== */

/* Make number input steppers larger (where supported) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    width: 24px;
    height: 32px;
    opacity: 1;
    cursor: pointer;
}

/* =====================
   RECEIPT VIEW
   ===================== */

.modal .table td,
.modal .table th {
    padding: 8px 10px !important;
    font-size: 0.95rem;
}

/* =====================
   CONFIRMATION DIALOG
   ===================== */

#delete_content {
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 8px 0;
}
