@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #4c63d2;
    --secondary-color: #f093fb;
    --accent-color: #4facfe;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --border-radius: 0.75rem;
    --border-radius-sm: 0.5rem;
    --border-radius-lg: 1rem;
}
/* Auto-add success message */
.auto-add-message {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

.auto-add-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-add-content i {
    font-size: 1.2rem;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.empty-cart {
    text-align: center;
    padding: 2rem;
    color: var(--gray-600);
}

.empty-cart i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='53' cy='53' r='1'/%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--dark-color);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xl);
    position: sticky;
    top: 1.5rem;
    z-index: 100;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-container {
    position: relative;
    width: 350px;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    background: var(--white);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.no-results {
    padding: 2rem;
    text-align: center;
    color: var(--gray-600);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin: 0.5rem;
}

.no-results i {
    font-size: 2rem;
    color: var(--gray-400);
    margin-bottom: 0.5rem;
}

.no-results p {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}

.no-results small {
    color: var(--gray-500);
    font-size: 0.8rem;
}

.search-input::placeholder {
    color: var(--gray-600);
    font-weight: 400;
}

/* Enhanced Search Results */
.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
}

.search-result-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.search-result-item:hover,
.search-result-item.highlighted {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--white);
    transform: translateX(4px);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-item-info {
    flex: 1;
}

.search-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.search-item-details {
    font-size: 0.8rem;
    opacity: 0.8;
    color: var(--gray-600);
}

.search-result-item.highlighted .search-item-details {
    color: rgba(255, 255, 255, 0.8);
}

.search-item-price {
    font-weight: 700;
    color: var(--success-color);
    font-size: 1rem;
}

.search-result-item.highlighted .search-item-price {
    color: var(--white);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Payment Control Section */
.payment-control-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.payment-control-section h2 {
    margin-bottom: 2rem;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.payment-control-section h2::before {
    content: '💳';
    font-size: 1.5rem;
}

/* Quick Amounts */
.quick-amounts {
    margin-bottom: 2rem;
}

.quick-amounts h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-amounts h3::before {
    content: '💰';
    font-size: 1rem;
}

.amount-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.amount-btn {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    color: var(--dark-color);
    border: 2px solid var(--gray-200);
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.amount-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--success-color), #059669);
    transition: left 0.3s ease;
    z-index: -1;
}

.amount-btn:hover {
    color: var(--white);
    border-color: var(--success-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.amount-btn:hover::before {
    left: 0;
}

.amount-btn:active {
    transform: translateY(0);
}

/* Payment Input Section */
.payment-input-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-200);
}

.payment-input {
    margin-bottom: 1.5rem;
}

.payment-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.payment-input input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--white);
}

.payment-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.change-display, .credit-info {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.change-display {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.credit-info {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.complete-btn, .clear-btn {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.complete-btn {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: var(--white);
}

.complete-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #059669, #047857);
}

.clear-btn {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: var(--white);
}

.clear-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Cart Section */
.cart-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    height: fit-content;
    position: sticky;
    top: 7rem;
}

.cart-section h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-section h2::before {
    content: '🛍️';
    font-size: 1.5rem;
}

.cart-items {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    padding-right: 0.5rem;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.cart-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.cart-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.cart-item-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.remove-btn {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.cart-item-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    background: var(--gray-600);
    color: var(--white);
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: var(--gray-700);
    transform: scale(1.1);
}

.qty-input {
    width: 4rem;
    text-align: center;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.item-total {
    font-weight: 700;
    color: var(--success-color);
    font-size: 1.2rem;
}

/* Cart Summary */
.cart-summary {
    border-top: 2px solid var(--primary-color);
    padding-top: 1.5rem;
}

.total-amount {
    font-size: 1.8rem;
    text-align: center;
    color: var(--dark-color);
    font-weight: 700;
    padding: 1.5rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    border: 3px solid var(--primary-color);
}

/* Print Styles - Enhanced for Two-Line Layout */
.print-area {
    display: none;
}

/* ENHANCED THERMAL PRINTER STYLES - Two-Line Layout Optimized */
@media print {
    /* Reset everything to zero */
    *, *::before, *::after {
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* Hide everything except print area */
    body * {
        visibility: hidden;
    }

    .print-area, .print-area * {
        visibility: visible !important;
    }

    /* Set page with absolute zero margins */
    @page {
        size: 80mm auto;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact;
    }

    /* Remove all margins from html and body */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
    }

    /* Position print area to fill entire width */
    .print-area {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    /* Bill content - Enhanced for two-line layout */
    .bill-content {
        width: 100% !important;
        max-width: none !important;
        min-width: 100% !important;
        font-family: 'Segoe UI', 'Arial', 'Nirmala UI', sans-serif !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
        background: white !important;
        padding: 2px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Enhanced Bill Header */
    .bill-header {
        text-align: center !important;
        margin-bottom: 2mm !important;
        border-bottom: 1px dashed black !important;
        padding-bottom: 1mm !important;
        width: 100% !important;
    }

    .bill-header h2 {
        margin: 0 0 1mm 0 !important;
        font-size: 18px !important;
        font-weight: bold !important;
    }

    .bill-header p {
        margin: 0.5mm 0 !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
    }

    /* ENHANCED: Two-Line Item Layout for Print */
    .bill-items {
        margin-bottom: 3mm !important;
        width: 100% !important;
    }

    .bill-item {
        margin-bottom: 2.5mm !important;
        width: 100% !important;
        page-break-inside: avoid !important;
        display: block !important;
    }

    /* First line styles - Item name and Amount (LARGE fonts) */
    .bill-item > div:first-child {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 1mm !important;
        width: 100% !important;
    }

    .bill-item > div:first-child span:first-child {
        font-size: 15px !important;
        font-weight: bold !important;
        flex: 1 !important;
        text-align: left !important;
    }

    .bill-item > div:first-child span:last-child {
        font-size: 15px !important;
        font-weight: bold !important;
        text-align: right !important;
    }

    /* Second line styles - Price details (smaller, organized) */
    .bill-item > div:nth-child(2) {
        display: flex !important;
        justify-content: space-between !important;
        font-size: 9px !important;
        color: #333 !important;
        margin-bottom: 1mm !important;
        width: 100% !important;
    }

    .bill-item > div:nth-child(2) span:first-child {
        text-align: left !important;
    }

    .bill-item > div:nth-child(2) span:last-child {
        text-align: right !important;
    }

    /* Dotted separator lines between items */
    .bill-item > div:last-child[style*="border-bottom"] {
        border-bottom: 1px dotted #666 !important;
        margin: 1mm 0 !important;
        width: 100% !important;
        height: 1px !important;
    }

    /* Enhanced Bill Summary */
    .bill-summary {
        border-top: 2px solid black !important;
        padding-top: 2mm !important;
        margin-top: 3mm !important;
        text-align: right !important;
        font-size: 11px !important;
        width: 100% !important;
        margin-bottom: 2mm !important;
    }

    .bill-summary > div {
        margin-bottom: 0.5mm !important;
        font-size: 11px !important;
    }

    /* Total line emphasis */
    .bill-summary div[style*="font-size: 18px"] {
        font-size: 16px !important;
        font-weight: bold !important;
    }

    .bill-summary div[style*="font-size: 16px"] {
        font-size: 14px !important;
        font-weight: bold !important;
    }

    /* Enhanced Bill Footer */
    .bill-footer {
        text-align: center !important;
        margin-top: 3mm !important;
        border-top: 1px dashed black !important;
        padding-top: 2mm !important;
        font-size: 10px !important;
        width: 100% !important;
    }

    .bill-footer p {
        margin: 0.5mm 0 !important;
        font-size: 10px !important;
    }

    /* Credit notice enhancement */
    .bill-footer div[style*="border: 2px solid black"] {
        border: 2px solid black !important;
        padding: 2mm !important;
        margin: 2mm 0 !important;
        font-weight: bold !important;
        font-size: 9px !important;
        text-align: center !important;
        background: transparent !important;
        color: black !important;
    }

    /* Separator lines enhancement */
    div[style*="border-top: 2px solid black"] {
        border-top: 2px solid black !important;
        margin: 2mm 0 !important;
        width: 100% !important;
    }

    div[style*="border-top: 1px dashed black"] {
        border-top: 1px dashed black !important;
        margin: 2mm 0 !important;
        width: 100% !important;
    }

    div[style*="border-bottom: 1px dashed black"] {
        border-bottom: 1px dashed black !important;
        margin: 1mm 0 !important;
        width: 100% !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .cart-section {
        position: static;
        order: 2;
    }

    .payment-control-section {
        order: 1;
    }

    .amount-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
        position: static;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .search-container {
        width: 100%;
        max-width: 400px;
    }

    .payment-control-section, .cart-section {
        padding: 1.5rem;
    }

    .amount-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .amount-btn {
        padding: 0.8rem;
        font-size: 0.85rem;
    }

    .cart-items {
        max-height: 250px;
    }

    .total-amount {
        font-size: 1.5rem;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    .header, .payment-control-section, .cart-section {
        padding: 1rem;
    }

    .amount-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-input {
        padding: 0.75rem 1rem;
    }

    .cart-item {
        padding: 0.75rem;
    }

    .qty-btn {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .qty-input {
        width: 3rem;
    }
}

/* Animation Classes */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.container > * {
    animation: slideInUp 0.6s ease-out;
}

.search-results {
    animation: fadeIn 0.3s ease-out;
}

.cart-item {
    animation: slideInUp 0.4s ease-out;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --success-color: #008800;
        --danger-color: #cc0000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
