:root {
    --primary: #f06292;
    /* Pink Soft Lunara */
    --primary-light: #fdf2f8;
    --secondary: #fce4ec;
    /* Soft pink background */
    --background: #f7f9fa;
    /* Very soft gray */
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --accent: #ff9800;
    --success: #10b981;
    --border: #eaedf2;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header/Top Bar */
header {
    background-color: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);

    /* Full-bleed hack but keep rounded corners */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -1.5rem;
    margin-bottom: 2rem;
}

.brand {
    font-size: 1.5rem;
    letter-spacing: 1px;
    font-weight: 800;
}

.user-profile {
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Main Content Wrapper */
main {
    flex: 1;
    padding: 1.5rem;
    padding-bottom: 5rem;
    /* Space for bottom nav */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.2rem;
    margin-top: 0;
}

.feature-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--primary-light);
    background: var(--secondary);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

/* Feature Cards with specific colors */
.feature-card[data-feature="pos"] i {
    color: #ff5722;
}

.feature-card[data-feature="products"] i {
    color: #4caf50;
}

.feature-card[data-feature="customers"] i {
    color: #2196f3;
}

.feature-card[data-feature="future"] i {
    color: #ff9800;
}

.feature-card[data-feature="debt"] i {
    color: #e91e63;
}

.feature-card[data-feature="history"] i {
    color: #673ab7;
}

.feature-card[data-feature="expenses"] i {
    color: #795548;
}

.feature-card[data-feature="stock"] i {
    color: #00bcd4;
}

.feature-card[data-feature="reports"] i {
    color: #8bc34a;
}

.feature-card[data-feature="security"] i {
    color: #607d8b;
}

.feature-card[data-feature="settings"] i {
    color: #9c27b0;
}

.feature-card i {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    /* transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); */
}

.feature-card span {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Statistics Bar */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.stats-card {
    background: lightgoldenrodyellow;
    background: #e9f5d1;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.store-card {
    background: #f1f3f9;
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

/* Bottom Nav */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 450px;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* POS Styles */
.cat-chip {
    padding: 0.5rem 1.2rem;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.cat-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-product-card {
    cursor: pointer;
    transition: transform 0.1s;
}

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

/* Form Styles */
.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
}

.pay-method-btn {
    padding: 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white;
    font-weight: 600;
    cursor: pointer;
}

.pay-method-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* Quick Access */
.quick-access-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.quick-access-btn:hover .quick-icon {
    background: var(--primary-light);
}

/* Toast */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    z-index: 10000;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Login Page */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 2rem;
    color: white;
}

.login-card {
    background: white;
    color: var(--text-main);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-card h2 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.login-card p {
    color: #888;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.login-input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.login-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-left: 3rem;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(240, 98, 146, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(240, 98, 146, 0.4);
}

/* Modal Enhancements */
.hidden {
    display: none !important;
}

/* Receipt Printing */
@media print {
    body {
        margin: 0;
        padding: 0;
        background: transparent !important;
    }

    /* Hide UI */
    #app,
    .modal-overlay,
    #bottom-nav,
    .toast,
    .btn,
    .nav-item {
        display: none !important;
    }

    #printable-receipt {
        display: block !important;
        visibility: visible !important;
        margin: 0;
        padding: 0;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    .receipt {
        width: 48mm !important;
        max-width: 48mm !important;
        margin: 0;
        padding: 0;
        font-family: monospace !important;
        font-size: 12px !important;
        line-height: normal !important;
        color: #000 !important;
        white-space: pre !important;
        transform: none !important;
        -webkit-font-smoothing: none !important;
        font-weight: normal !important;
    }

    @page {
        size: 58mm auto;
        margin: 0;
    }
}

.receipt-preview {
    font-family: 'Courier New', Courier, monospace;
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #333;
    border: 1px dashed #ccc;
    max-width: 300px;
    margin: 0 auto;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1rem;
}

.receipt-sep {
    border-top: 1px dashed #ccc;
    margin: 0.5rem 0;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
}

.receipt-total-row {
    font-weight: bold;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.receipt-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-full {
    width: 100%;
}

/* Modal Cart List */
.checkout-item-list {
    max-height: 40vh;
    overflow-y: auto;
    margin: 1rem 0;
    padding: 0.8rem;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: var(--radius-md);
}

.checkout-item-list::-webkit-scrollbar {
    width: 6px;
}

.checkout-item-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: white;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.checkout-item:last-child {
    margin-bottom: 0;
}

.modal-qty-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #f1f3f9;
    padding: 0.3rem 0.5rem;
    border-radius: 30px;
}

.modal-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.modal-qty-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* Landscape Modal Layout */
.modal-content.modal-lg {
    max-width: 1000px;
    width: 95vw;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2.5rem;
    margin-top: 1.5rem;
}

.checkout-left {
    border-right: 2px solid #f1f3f9;
    padding-right: 2.5rem;
}

.checkout-right {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

@media (max-width: 1024px) {
    .modal-content.modal-lg {
        max-width: 90%;
    }

    .checkout-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .modal-content.modal-lg {
        max-width: 450px;
        height: auto;
        overflow-y: auto;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        overflow: visible;
    }

    .checkout-left {
        border-right: none;
        padding-right: 0;
        border-bottom: 2px solid #f1f3f9;
        padding-bottom: 1rem;
        overflow: visible;
    }

    .checkout-item-list {
        max-height: 250px;
    }
}

/* --- Mobile Responsiveness Form Grids --- */
@media (max-width: 768px) {

    .responsive-grid-2,
    .responsive-grid-barcode {
        grid-template-columns: 1fr !important;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    header {
        padding: 1rem;
    }
}

/* Custom PIN Modal */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
    background: transparent;
    transition: all 0.2s ease;
}

.pin-dot.filled {
    background: #4b5563;
    border-color: #4b5563;
    transform: scale(1.1);
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0 1.5rem;
    justify-items: center;
}

.num-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    padding: 0;
    line-height: 1;
}

.num-btn:active {
    background: #f3f4f6;
    transform: scale(0.95);
    border-color: #d1d5db;
}

.num-main {
    font-size: 1.75rem;
    font-weight: 300;
    color: #111827;
    margin-bottom: 2px;
}

.num-sub {
    font-size: 0.6rem;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.num-btn-del {
    color: #6b7280;
    border: none;
    background: transparent;
}

.num-btn-del:active {
    background: transparent;
    color: #111827;
}

.pin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}