/* ===========================================
   easyPOS Modern UI - Pastel Theme
   =========================================== */

/* CSS Custom Properties - Pastel Color Palette */
:root {
    /* Primary Pastel Colors */
    --pastel-lavender: #E8E0F0;
    --pastel-mint: #D4EDDA;
    --pastel-peach: #FFECD2;
    --pastel-sky: #D6EAF8;
    --pastel-rose: #FADBD8;
    --pastel-cream: #FFF9E6;

    /* Accent Colors */
    --accent-primary: #7C9EB2;
    --accent-success: #81C784;
    --accent-warning: #FFB74D;
    --accent-danger: #E57373;
    --accent-info: #64B5F6;

    /* Neutral Colors */
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #EEEEEE;
    --neutral-300: #E0E0E0;
    --neutral-400: #BDBDBD;
    --neutral-500: #9E9E9E;
    --neutral-600: #757575;
    --neutral-700: #616161;
    --neutral-800: #424242;
    --neutral-900: #212121;

    /* Functional Colors */
    --bg-main: linear-gradient(145deg, #F8F9FA 0%, #E8ECF0 100%);
    --bg-card: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --text-muted: #A0AEC0;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.08), 0 10px 10px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-main);
    min-height: 100vh;
    color: var(--text-primary);
    padding-bottom: 160px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================================
   Header Section
   =========================================== */
.header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #6B8A9E 100%);
    color: white;
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

/* ===========================================
   Container & Layout
   =========================================== */
.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    padding: var(--space-md);
    padding-bottom: 170px;
    overflow: visible;
}

/* ===========================================
   Search / Barcode Input
   =========================================== */
.input-group {
    position: relative;
    margin-bottom: var(--space-md);
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    background: var(--bg-card);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-right: none;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    height: auto;
}

.input-group .form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(124, 158, 178, 0.15);
    z-index: 1;
}

.input-group .form-control::placeholder {
    color: var(--text-muted);
}

/* Command Dropdown Button */
.input-group-append {
    display: flex;
}

.input-group-append .btn-secondary {
    background: linear-gradient(135deg, var(--pastel-lavender) 0%, var(--pastel-sky) 100%);
    border: 2px solid var(--neutral-200);
    border-left: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: var(--text-primary);
    font-weight: 500;
    padding: 12px 16px;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.input-group-append .btn-secondary:hover,
.input-group-append .btn-secondary:focus {
    background: linear-gradient(135deg, var(--pastel-sky) 0%, var(--accent-info) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Dropdown Menu */
.dropdown-menu {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: var(--space-sm);
    margin-top: var(--space-sm);
    overflow: hidden;
}

.dropdown-item {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.dropdown-item:hover {
    background: var(--pastel-sky);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    transform: translateX(4px);
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--neutral-100);
}

/* ===========================================
   Cart Section
   =========================================== */
#cart {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) transparent;
    max-height: calc(100vh - 280px);
    min-height: 200px;
}

#cart::-webkit-scrollbar {
    width: 6px;
}

#cart::-webkit-scrollbar-track {
    background: transparent;
}

#cart::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: var(--radius-full);
}

/* Cart Item Card */
.cart-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.cart-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #81C784 0%, #4CAF50 100%);
    border-radius: 16px 0 0 16px;
}

/* Cart Item Row */
.cart-item > .row {
    margin-left: 0;
    margin-right: 0;
}

.cart-item .col-4,
.cart-item .col-8,
.cart-item .col-12 {
    padding-left: 6px;
    padding-right: 6px;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}

.cart-item:last-child {
    margin-bottom: 20px;
}

/* Cart Item Description */
.cart-item .descr {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a202c;
    margin-bottom: 12px;
    padding-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

/* Cart Item Form Elements */
.cart-item .form-group {
    margin-bottom: 0;
}

.cart-item .form-group label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    display: block;
}

.cart-item .form-group input {
    height: 42px;
    padding: 8px 12px;
    text-align: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: #334155;
    background: #ffffff;
    transition: all 0.15s ease;
    width: 100%;
}

.cart-item .form-group input:focus {
    outline: none;
    border-color: #7C9EB2;
    background: white;
    box-shadow: 0 0 0 3px rgba(124, 158, 178, 0.12);
}

/* Cart Item Total */
.cart-item .total {
    font-size: 1rem;
    font-weight: 700;
    color: #0d9488;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 10px;
    letter-spacing: -0.3px;
}

/* Remove Button */
.remove-btn {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.remove-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    transform: scale(1.05);
}

.remove-btn i {
    font-size: 14px;
}

/* ===========================================
   Checkout Bar (Footer)
   =========================================== */
.checkout-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    z-index: 1000;
}

.checkout-bar::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--neutral-300);
    border-radius: var(--radius-full);
}

/* Payment Button Group */
.button-group {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    padding-top: var(--space-sm);
}

/* Icon Buttons */
.btn-icon {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

/* Cash Button */
.btn-icon:nth-child(1) {
    background: linear-gradient(145deg, var(--pastel-mint) 0%, #B8E0C0 100%);
    color: #2E7D32;
}

.btn-icon:nth-child(1):hover {
    background: linear-gradient(145deg, var(--accent-success) 0%, #66BB6A 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(129, 199, 132, 0.4);
}

/* Card Button */
.btn-icon:nth-child(2) {
    background: linear-gradient(145deg, var(--pastel-sky) 0%, #B8D4E8 100%);
    color: #1565C0;
}

.btn-icon:nth-child(2):hover {
    background: linear-gradient(145deg, var(--accent-info) 0%, #42A5F5 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(100, 181, 246, 0.4);
}

/* Discount Button */
.btn-icon:nth-child(3) {
    background: linear-gradient(145deg, var(--pastel-peach) 0%, #FFD9B3 100%);
    color: #EF6C00;
}

.btn-icon:nth-child(3):hover {
    background: linear-gradient(145deg, var(--accent-warning) 0%, #FFA726 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 183, 77, 0.4);
}

/* Active/Pressed State */
.btn-icon:active {
    transform: translateY(0) scale(0.95);
}

/* Total Display */
.total-display {
    width: 100%;
}

.btn-total {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #5A8097 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-total:hover {
    background: linear-gradient(135deg, #5A8097 0%, var(--accent-primary) 100%);
    box-shadow: var(--shadow-lg);
}

.btn-total span {
    font-size: 1.4rem;
    font-weight: 700;
}

/* ===========================================
   Modals
   =========================================== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #5A8097 100%);
    color: white;
    border-bottom: none;
    padding: var(--space-lg);
}

.modal-title {
    font-weight: 600;
}

.modal-header .close,
.modal-header .btn-close {
    color: white;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.modal-header .close:hover,
.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: var(--space-lg);
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--neutral-100);
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-sm);
}

.modal-footer .btn-secondary {
    background: var(--neutral-200);
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-lg);
    transition: all var(--transition-fast);
}

.modal-footer .btn-secondary:hover {
    background: var(--neutral-300);
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--accent-success) 0%, #66BB6A 100%);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #66BB6A 0%, var(--accent-success) 100%);
    box-shadow: var(--shadow-md);
}

.modal-footer .btn-danger {
    background: linear-gradient(135deg, var(--accent-danger) 0%, #EF5350 100%);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
}

/* ===========================================
   Form Controls
   =========================================== */
.form-control {
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 158, 178, 0.15);
}

.is-invalid {
    border-color: var(--accent-danger) !important;
    box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.15) !important;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ===========================================
   Search Results Dropdown
   =========================================== */
#searchResults {
    position: fixed;
    top: 120px;
    left: 16px;
    right: 16px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 12px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

#searchResults:empty {
    display: none !important;
}

#searchResults .dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    color: #333;
    background-color: #fff;
    transition: background-color 0.2s;
    display: block;
    text-decoration: none;
}

#searchResults .dropdown-item:hover {
    background-color: #D4EDDA;
    color: #333;
}

#searchResults .dropdown-item:not(:last-child) {
    border-bottom: 1px solid #eee;
}

#searchResults .dropdown-item div:first-child {
    font-weight: bold;
    margin-bottom: 2px;
}

#searchResults .dropdown-item div:last-child {
    font-size: 0.9em;
    color: #666;
}

/* ===========================================
   Utility Classes
   =========================================== */
.col-4 {
    padding: var(--space-sm);
}

/* Overlay */
#overlay {
    backdrop-filter: blur(4px);
}

/* ===========================================
   Products Grid (for Sale view)
   =========================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-lg);
    padding: var(--space-md);
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--neutral-100);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    min-height: 220px;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.product-card img {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Category Buttons */
.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding: 0 var(--space-md);
}

.category-button {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: var(--pastel-lavender);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.category-button:hover,
.category-button.active {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

/* ===========================================
   Animations
   =========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.cart-item {
    animation: fadeIn 0.3s ease-out;
}

/* ===========================================
   Responsive Adjustments
   =========================================== */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .btn-icon {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }

    .btn-total {
        font-size: 1rem;
        padding: var(--space-sm) var(--space-md);
    }

    .btn-total span {
        font-size: 1.2rem;
    }

    .checkout-bar {
        padding: var(--space-sm) var(--space-md);
    }

    .cart-item {
        padding: var(--space-sm);
    }
}

/* Touch Optimizations */
@media (hover: none) {
    .btn-icon:hover {
        transform: none;
        box-shadow: none;
    }

    .btn-icon:active {
        transform: scale(0.95);
    }

    .cart-item:hover {
        transform: none;
    }
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    .checkout-bar,
    .header,
    .input-group {
        display: none;
    }

    body {
        padding-bottom: 0;
    }
}
