/* Modern POS Styling - Loyverse Inspired */

/* ===== MODERN HEADER STYLING ===== */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    border-bottom: none;
}

/* Prevent header expand/collapse animations */
.main-header .navbar-collapse {
    transition: none !important;
    height: auto !important;
    max-height: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
}

.main-header .navbar-nav {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
}

/* Disable all navbar collapse animations */
.navbar-collapse.collapsing,
.navbar-collapse.collapse.in,
.navbar-collapse.collapse {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
}

/* Disable navbar toggle animations */
.navbar-toggle {
    transition: none !important;
}

.navbar-toggle.collapsed {
    transition: none !important;
}

/* Force no animations on all collapse elements */
.collapsing,
.collapse,
.collapse.in,
.collapse.show {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
    animation-duration: 0s !important;
    -webkit-animation-duration: 0s !important;
}

/* Prevent all animations on navbar during page load */
#navbar-collapse,
.navbar-collapse {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
}

.main-header .navbar-brand {
    color: white !important;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    padding: 15px 20px;
}

.main-header .navbar-nav > li > a {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    padding: 15px 12px;
    transition: all 0.3s ease;
}

.main-header .navbar-nav > li > a:hover,
.main-header .navbar-nav > li > a:focus {
    background: rgba(255,255,255,0.1);
    color: white !important;
    border-radius: 5px;
}

.main-header .navbar-nav > li > a i {
    margin-right: 8px;
    font-size: 16px;
}

/* Header icons - make them vibrant */
.main-header .text-yellow {
    color: #ffd700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.main-header .text-white {
    color: white !important;
}

.main-header .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: none;
    margin-top: 5px;
}

/* Header dropdown user menu */
.main-header .user-menu {
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    margin: 0 5px;
    padding: 5px 10px;
}

.main-header .user-menu:hover {
    background: rgba(255,255,255,0.15);
}

.main-header .label-danger {
    background: #ff6b6b !important;
    box-shadow: 0 2px 6px rgba(255,107,107,0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Fullscreen button */
#fullscreen a {
    color: white !important;
    font-size: 18px;
    transition: transform 0.3s ease;
}

#fullscreen a:hover {
    transform: scale(1.1);
}

/* ===== MOBILE/TABLET RESPONSIVE LAYOUT ===== */
@media (max-width: 991px) {
    /* Hide desktop layout on mobile */
    .content-wrapper {
        padding: 0 !important;
    }
    
    /* Fix Header - Sticky */
    .main-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001 !important;
    }
    
    /* Tab Navigation - Fixed Below Header */
    .pos-mobile-tabs {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        background: white;
        z-index: 1000;
  display: flex;
        border-bottom: 3px solid #337ab7;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        height: 50px;
    }
    
    /* Initially hide both columns on mobile - but show cart by default */
    #products-section {
        display: none;
    }
    
    /* Show cart section by default on mobile */
    #cart-section {
        display: block;
    }
    
    .pos-mobile-tabs button {
        flex: 1;
        padding: 15px;
        border: none;
        background: white;
        color: #666;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        border-bottom: 3px solid transparent;
    }
    
    .pos-mobile-tabs button.active {
        color: #337ab7;
        background: #f0f8ff;
        border-bottom-color: #337ab7;
    }
    
    .pos-mobile-tabs button:active {
        background: #e6f3ff;
    }
    
    /* Main Content Area */
    .content {
        margin-top: 100px;
        padding: 10px;
        height: calc(100vh - 100px);
        overflow: auto;
    }
    
    /* Make cart section scrollable on mobile */
    #cart-section {
        height: 100%;
        overflow-y: auto;
        padding-bottom: 80px; /* Space for fixed footer buttons */
    }
    
    #cart-section .box {
        margin-bottom: 0;
    }
    
    /* Products section should fill available height and be scrollable */
    #products-section {
        height: 100%;
        overflow-y: auto;
        padding-bottom: 10px;
    }
    
    #products-section .box {
        margin-bottom: 10px;
    }
    
    #products-section .box-body {
        padding: 10px;
    }
    
    /* Remove any gaps in products section */
    #products-section .box-body .row {
        margin-bottom: 10px;
    }
    
    #products-section .box-body .row:last-child {
        margin-bottom: 0;
        flex: 1;
  display: flex;
        flex-direction: column;
        min-height: 0;
    }
    
    /* Search div should fill available space and be scrollable */
    #products-section .search_div {
        max-height: none !important;
        overflow-y: visible;
        min-height: 300px;
        padding: 5px;
    }
    
    /* Fix spacing after search fields */
    #products-section .box-body > .row:nth-last-child(2) {
        margin-bottom: 0 !important;
    }
    
    /* Ensure product grid fills remaining height */
    #products-section .box-body > .row:last-child > .col-md-12 {
        flex: 1;
  display: flex;
  flex-direction: column;
}

    #products-section .box-body > .row:last-child > .col-md-12 > .search_div {
  flex: 1;
    }
    
    /* On mobile, hide desktop columns initially */
    .col-md-7,
    .col-md-5 {
        display: block; /* Desktop normal display */
    }
    
    /* Create mobile sections from desktop content */
    .col-md-7 {
        position: relative;
    }
    
    .col-md-5 {
        position: relative;
    }
    
    /* Make sections full width on mobile */
    @media (max-width: 991px) {
        .col-md-7,
        .col-md-5 {
            width: 100%;
            max-width: 100%;
        }
    }
    
    /* Make sure cart items and products are in separate full-width sections */
    .pos-section .box {
        margin-bottom: 10px;
    }
    
    /* Products Section */
    .pos-products-section {
        padding-bottom: 70px; /* Space for fixed bottom buttons */
    }
    
    /* Cart Section */
    .pos-cart-section {
        padding-bottom: 70px;
    }
    
    /* Desktop action buttons styling - already provided by the footer */
    
    /* Item Grid for Mobile */
    .search_div .col-md-3,
    .search_div .col-xs-6 {
        padding: 5px;
    }
    
    /* Search Bar Improvements for Mobile */
    #item_search {
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 20px;
        padding: 12px 20px;
    }
    
    /* Cart Table for Mobile */
    .items_table {
        font-size: 13px;
    }
    
    .items_table thead th {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .items_table tbody td {
        padding: 10px 5px;
    }
    
    /* Customer Section for Mobile */
    .col-md-5 {
        position: relative;
    }
    
    /* Payment Panel - Full Width on Mobile */
    .col-md-5 {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Adjust Box Headers */
    .box-header {
        padding: 10px 15px;
    }
    
    .box-header h3 {
        font-size: 16px;
    }
    
    /* Keep desktop action buttons visible on mobile - just make them responsive */
    #cart-section .box-footer.bg-gray {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: white;
        padding: 8px 10px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    }
    
    /* Improve totals summary */
    #totals-summary {
        padding: 8px 0;
        margin-bottom: 5px;
    }
    
    #totals-summary label {
        font-size: 11px !important;
        color: #666;
    }
    
    /* Make buttons responsive on mobile */
    #cart-section .box-footer .btn {
        padding: 8px 4px;
        font-size: 11px;
        min-height: 55px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    #cart-section .box-footer .btn i {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    #cart-section .box-footer .btn div {
        font-size: 10px !important;
        line-height: 1.3;
        font-weight: 600;
    }
    
    /* Ensure buttons don't shrink when clicked */
    #cart-section .box-footer .btn:active,
    #cart-section .box-footer .btn:focus,
    #cart-section .box-footer .btn:hover {
        min-height: 55px !important;
        font-size: 11px !important;
    }
    
    #action-buttons-row {
        margin: 0;
    }
    
    /* Ensure cart items table is visible and properly sized on mobile */
    #cart-items-table {
        display: block !important;
        height: auto !important;
        max-height: 400px;
        font-size: 12px;
    }
    
    /* Hide mobile cart alert in cart section (only show in products section) */
    #cart-section #mobile-cart-alert {
        display: none !important;
    }
    
    /* Ensure products section shows the alert */
    #products-section #mobile-cart-alert {
        display: block !important;
    }
    
    /* Hide Print/Email buttons on mobile */
    #print-btn, #email-btn {
        display: none;
    }
    
    /* Remove gaps and unnecessary spacing in mobile sections */
    #products-section .box-body > .row > .col-md-12 > .row {
        margin: 0;
    }
    
    #products-section .box-body > .row > .col-md-12 .content.sec_div {
        padding: 0;
        margin: 0;
    }
    
    /* Reduce gap in products section */
    #products-section .box-header,
    #products-section .box-body .row:first-child {
        margin-bottom: 5px;
    }
    
    /* Better spacing for Send Message and T&C alignment */
    #cart-section .box-body .row:last-child {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    #cart-section .checkbox {
        margin: 0;
        padding: 0;
    }
    
    #cart-section .checkbox label {
        margin: 0;
        padding: 0;
        font-size: 13px;
    }
}

    /* Desktop - Show All Side by Side */
@media (min-width: 992px) {
    .pos-mobile-tabs {
        display: none !important;
    }
    
    /* Show desktop columns normally */
    #cart-section,
    #products-section {
        display: block !important;
    }
    
    /* Make both sections equal height on desktop */
    #cart-section,
    #products-section {
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }
    
    #cart-section {
        display: flex;
        flex-direction: column;
        overflow: hidden;
  position: relative;
    }
    
    #products-section {
  display: flex;
        flex-direction: column;
  overflow: hidden;
}

    #cart-section .box {
        height: 100%;
        display: flex;
        flex-direction: column;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        position: relative;
    }
    
    #products-section .box {
        height: 100%;
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    #cart-section .box-header {
        flex-shrink: 0;
        margin-bottom: 0 !important;
    }
    
    #cart-section .box-body {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        margin-bottom: 0 !important;
        padding-bottom: 120px !important; /* Space for checkbox/T&C + footer so buttons stay visible */
        display: flex;
        flex-direction: column;
    }
    
    /* Make cart items table expand to fill space - increase height */
    #cart-section #pos-form-tbody,
    #cart-section #cart-items-table {
        flex: 1;
        min-height: 500px !important;
        height: 100%;
    }
    
    /* Ensure checkbox and T&C are at the bottom of box-body, right above totals summary with minimal gap */
    #cart-section .box-body > .row:last-child {
        margin-top: auto;
        margin-bottom: 0 !important;
        padding: 5px 15px !important;
        background-color: #f4f4f4;
        border-bottom: 1px solid #ddd;
    }
    
    #products-section .box-body {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Push footer to absolute bottom - stick to bottom, always visible */
    #cart-section .box-footer {
        margin-top: auto;
        flex-shrink: 0;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-top: 5px !important;
        background-color: #f4f4f4 !important;
        z-index: 100 !important;
    }
    
    /* Remove any margin/padding on rows inside footer */
    #cart-section .box-footer .row {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #cart-section .box-footer .row:first-child {
        padding: 2px 15px !important;
        margin: 0 !important;
    }
    
    #cart-section .box-footer .row:last-child {
        padding: 5px 15px 5px 15px !important;
        margin: 0 !important;
    }
    
    /* Remove any extra margins/padding that create gaps */
    #cart-section .row,
    #products-section .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Make header sticky on desktop */
    .main-header {
        position: fixed !important;
  top: 0;
        left: 0;
        right: 0;
        z-index: 1001 !important;
        width: 100%;
    }
    
    /* Add padding to content to account for fixed header */
    .content-wrapper {
        padding-top: 60px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 0;
    }
    
    /* Ensure content area doesn't create extra space */
    .content {
        padding: 0;
        margin: 0;
        height: calc(100vh - 60px);
    }
    
    /* Hide icons on desktop action buttons - show text only */
    #cart-section .box-footer .btn i {
        display: none;
    }
    
    #cart-section .box-footer .btn div {
        font-size: 14px !important;
        margin-top: 0;
    }
    
    /* Prevent button resizing on tap/click for desktop */
    #cart-section .box-footer .btn {
        min-height: auto !important;
        font-size: 14px !important;
        padding: 10px 15px;
    }
    
    #cart-section .box-footer .btn:active,
    #cart-section .box-footer .btn:focus,
    #cart-section .box-footer .btn:hover {
        min-height: auto !important;
        font-size: 14px !important;
        transform: none !important;
    }
}

/* Tablet Specific */
@media (min-width: 768px) and (max-width: 991px) {
    /* Two column layout on tablet */
    .pos-mobile-tabs {
        font-size: 18px;
        padding: 5px;
    }
    
    .pos-mobile-tabs button {
        padding: 12px;
    }
}

/* Item Card Hover Effects */
.item_box {
    transition: all 0.2s ease;
    border: 1px solid #e1e8ed !important;
}

.item_box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    border-color: #cbd6e0 !important;
}

/* Disabled/OOS items */
.item_box[style*="background-color:#9d9999"] {
    opacity: 0.6;
}

.item_box[style*="background-color:#9d9999"]:hover {
    transform: none;
    box-shadow: none !important;
}

/* In Stock Items - Green background */
.item_box[style*="background-color:#dbf4cd"] {
    border: 2px solid #28a745 !important;
}

.item_box[style*="background-color:#dbf4cd"]:hover {
    border-color: #1e7e34 !important;
}

/* Item Image Styling */
.item_image {
    border-radius: 5px;
    transition: transform 0.2s ease;
}

.item_box:hover .item_image {
    transform: scale(1.05);
}

/* Price Styling - More Prominent */
.item_box .box-body span[style*="font-size:150%"] {
    font-weight: 700 !important;
    letter-spacing: -0.5px;
}

/* Quantity Badge */
.label.label-danger.push-right {
    border-radius: 15px;
    padding: 3px 8px;
    font-size: 11px;
    background-color: #dc3545 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Service Badge */
.label.label-danger:contains('Service') {
    background-color: #28a745 !important;
}

/* Search Bar Improvements */
#search_it {
    border-radius: 25px;
    border: 2px solid #e1e8ed;
    transition: all 0.2s ease;
}

#search_it:focus {
    border-color: #2c7be5;
    box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

/* Category/Payment Buttons */
.btn-flat {
    border-radius: 5px !important;
    transition: all 0.2s ease;
}

.btn-flat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Cart Table Improvements */
.items_table {
    border-radius: 5px;
  overflow: hidden;
}

.items_table thead {
    background: linear-gradient(to bottom, #667eea 0%, #764ba2 100%);
  color: white;
    font-weight: 600;
}

.items_table tbody tr {
    transition: background-color 0.15s ease;
}

.items_table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Quantity Input */
.items_table input[type="number"] {
    border-radius: 5px;
    border: 2px solid #e1e8ed;
    transition: all 0.2s ease;
}

.items_table input[type="number"]:focus {
    border-color: #2c7be5;
    box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

/* Total Section */
.panel {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.panel.panel-primary {
    border-color: #2c7be5;
}

/* Payment Modal */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px 10px 0 0;
}

.modal-header h4 {
  font-weight: 600;
}

/* Round Buttons */
.btn-round {
    border-radius: 50px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-round:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Connection Status Badge */
#connection-status-badge {
    transition: all 0.3s ease;
}

#connection-status-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4) !important;
}

/* Responsive Grid */
.search_div .col-md-3,
.search_div .col-xs-6 {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Batch Ribbon Animation */
.item_box:hover [style*="BATCH"] {
    animation: pulse-badge 0.5s ease;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: translateY(-50%) rotate(90deg) scale(1);
    }
    50% {
        transform: translateY(-50%) rotate(90deg) scale(1.05);
    }
}

/* Load More Button */
.load-more-btn {
    border-radius: 25px;
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
  color: white;
    border: none;
    padding: 10px 30px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Scrollbar Styling */
.search_div::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

.search_div::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.search_div::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Print Button Styling */
#print-btn, #email-btn, #hold-btn {
    border-radius: 50px !important;
  font-weight: 600;
    padding: 10px 25px;
    transition: all 0.2s ease;
}

#print-btn:hover, #email-btn:hover, #hold-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

    /* Batch Disabled Overlay */
    .batch-disabled-overlay {
        background: rgba(255, 255, 255, 0.7) !important;
        backdrop-filter: blur(2px);
    }
    
    /* Make batch ribbon narrower on mobile/tablet */
    @media (max-width: 991px) {
        [style*="BATCH"] {
            right: -20px !important;
            font-size: 7px !important;
            padding: 3px 8px !important;
            box-shadow: 1px 1px 3px rgba(0,0,0,0.2) !important;
        }
    }

/* Add to Cart Sound Effect Area */
.item_box:active {
    transform: scale(0.98);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Toastr Positioning - Use default top-right position, no override needed */

/* Search Result Animation */
.search_item {
    transition: color 0.2s ease;
}

.item_box:hover .search_item {
    color: #2c7be5 !important;
}
