/**
 * Aplikasi Kasir - Custom Styles
 * Poppins Font + TailwindCSS + Custom Components
 */

/* Base Styles */
body {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

* {
    font-family: 'Poppins', sans-serif;
}

/* Sidebar */
.sidebar-item {
    transition: all 0.2s ease;
}

.sidebar-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.sidebar-item.active {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    color: white;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Input Fields */
.input-field {
    border: 2px solid #e5e7eb;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Toast Notifications */
.toast {
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Modal */
.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* POS Items */
.pos-item {
    transition: all 0.2s;
}

.pos-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Tabs */
.tab-btn.active {
    border-bottom: 3px solid #3b82f6;
    color: #3b82f6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* View Transitions */
@view-transition {
    navigation: auto;
}

/* Payment Method Cards */
.payment-method-card:has(input:checked) {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.2);
}

.payment-method-card:has(input:checked) .check-icon {
    display: block !important;
}

/* Quick Amount Buttons */
.quick-amount-btn.selected {
    border-color: #3b82f6;
    background-color: #dbeafe;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Chart Responsive */
canvas {
    max-width: 100%;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    #receiptContent,
    #receiptContent * {
        visibility: visible;
    }

    #receiptContent {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* Compact Sidebar */
#sidebar {
    transition: none;
    overflow: hidden;
    white-space: nowrap;
}

#sidebar.compact {
    width: 6rem;
}

#sidebar.compact .sidebar-text {
    display: none;
}

#sidebar.compact .sidebar-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#sidebar.compact .sidebar-item i {
    font-size: 1.5rem;
    /* Slightly larger icon in compact mode */
    margin: 0;
}

/* ==========================================
   TABLET RESPONSIVE STYLES (768px - 1279px)
   Matches TailwindCSS xl breakpoint (1280px)
   ========================================== */

/* Tablet/Small Laptop: Auto-hide sidebar (under xl breakpoint) */
@media (min-width: 768px) and (max-width: 1279px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.show-tablet {
        transform: translateX(0);
    }
    
    /* Show overlay on tablet when sidebar is open */
    #sidebarOverlay {
        display: block;
    }
}

/* Modal improvements for tablet and mobile (under xl) */
@media (max-width: 1279px) {
    /* Better modal sizing */
    .modal-overlay > div {
        max-height: 90vh !important;
        margin: 1rem;
        display: flex;
        flex-direction: column;
    }
    
    /* Scrollable content area with visible buttons */
    .modal-overlay > div > div:nth-child(2) {
        flex: 1;
        overflow-y: auto;
        max-height: calc(90vh - 180px) !important;
    }
    
    /* Action buttons always visible */
    .modal-overlay > div > div:last-child {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;
        padding: 1rem 1.5rem;
        margin-top: auto;
    }
    
    /* Full-width modal buttons on small tablets */
    .modal-overlay .btn-primary,
    .modal-overlay button[onclick*="closeModal"] {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Small tablet / large mobile adjustments (under 900px) */
@media (max-width: 900px) {
    /* Stack modal buttons if needed */
    .modal-overlay > div > div:last-child {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .modal-overlay > div > div:last-child button {
        width: 100%;
    }
    
    /* Better grid for products on tablet */
    #posProducts {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Adjust POS cart on tablet */
    .lg\\:w-96 {
        width: 100% !important;
    }
}

/* Ensure action buttons in tables are visible (under xl) */
@media (max-width: 1279px) {
    /* Table responsive scroll */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Action buttons in table rows */
    td button, 
    td .flex.gap-2 {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Smaller action buttons on tablet */
    td button {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Form grids stack on tablet */
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Keep payment grid 2 columns */
    .payment-method-card {
        padding: 0.75rem !important;
    }
}

/* Settings page form improvements (under xl) */
@media (max-width: 1279px) {
    /* Settings form layout */
    .lg\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Card padding reduced on tablet */
    .card {
        padding: 1rem;
    }
    
    .p-6 {
        padding: 1rem !important;
    }
    
    .lg\\:p-6 {
        padding: 1rem !important;
    }
}