:root {
    --primary: #00D9FF;
    /* Cyan */
    --primary-dark: #00A8CC;
    --primary-light: #66E6FF;
    --secondary: #7B2FFF;
    /* Purple */
    --secondary-dark: #5A1FB3;
    --accent: #FF006E;
    /* Pink */
    --success: #00D084;
    --danger: #FF5252;
    --warning: #FFC107;
    --bg-dark: #0A0E27;
    --bg-darker: #05080F;
    --surface-dark: #131829;
    --surface-light: #1A2341;
    --text-main: #FFFFFF;
    --text-secondary: #B8C1EC;
    --text-muted: #8892B0;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 16px;
    --shadow-soft: 0 8px 32px rgba(0, 217, 255, 0.15);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.4);
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media print {
    body {
        overflow: visible;
        background: white;
        height: auto;
    }

    .app-container,
    .close-modal,
    .receipt-download-area {
        display: none !important;
    }

    #receipt-modal {
        position: static;
        display: block !important;
        background: white;
        height: auto;
    }

    .modal-content {
        box-shadow: none;
        max-width: 100%;
        padding: 0;
        animation: none;
        overflow: visible;
    }

    #receipt-preview {
        border: none;
        background: transparent;
    }

    .receipt-container {
        page-break-after: always;
        padding-bottom: 20px;
        margin-bottom: 20px;
        box-shadow: none;
    }

    .receipt-wrapper {
        margin-bottom: 0;
    }
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-dark);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Header */
.app-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #00D9FF 0%, #7B2FFF 50%, #FF006E 100%);
    color: white;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.3);
    z-index: 10;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.clock {
    font-family: monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 100px;
    /* Space for bottom bar */
}

/* Inputs */
.input-card {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 10px;
}

input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--surface-light);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-main);
}

input::placeholder {
    color: var(--text-muted);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-light);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.2);
}

.btn-mini {
    background: var(--surface-dark);
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    width: 48px;
    height: 48px;
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.btn-mini:hover {
    background: rgba(0, 217, 255, 0.1);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 217, 255, 0.3);
}

.btn-mini:active {
    background: var(--primary-light);
    transform: scale(0.95);
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.btn {
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn:hover {
    filter: brightness(0.95);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 8px 28px rgba(0, 217, 255, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    box-shadow: var(--shadow-card);
}

.btn-secondary:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--primary);
}

.full-width {
    width: 100%;
}

/* Cart */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cart-header h2 {
    font-size: 1.1rem;
    color: var(--accent);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.cart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.cart-item {
    background: var(--surface-dark);
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.cart-item:hover {
    box-shadow: var(--shadow-elevated);
    transform: translateY(-2px);
}

.cart-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.item-info h4 {
    font-size: 1rem;
    font-weight: 600;
}

.item-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-price {
    font-weight: 700;
    color: var(--accent);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--danger);
    padding: 8px 12px;
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border-radius: 8px;
}

.btn-delete:hover {
    opacity: 1;
    background: rgba(255, 82, 82, 0.1);
}

.btn-delete:active {
    transform: scale(0.9);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

.empty-state span {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.2;
}

.cart-total {
    margin-top: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.4);
    transition: var(--transition);
}

.cart-total:hover {
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.5);
    transform: translateY(-2px);
}

/* Bottom Nav */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--surface-dark), var(--bg-dark));
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 5px 25px 5px;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
    z-index: 50;
    border-top: 1px solid var(--border-color);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.nav-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    gap: 2px;
    font-size: 0.6rem;
    cursor: pointer;
    min-width: 52px;
    flex-shrink: 1;
    transition: var(--transition);
    padding: 8px 6px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.nav-item:hover {
    color: #fff;
    transform: translateY(-3px) scale(1.03);
    background: rgba(0, 217, 255, 0.2);
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.25);
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-item span {
    font-size: 20px;
}

.nav-item span:last-child {
    font-size: 0.6rem;
    line-height: 1.2;
}


/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: flex-end;
    animation: fadeIn 0.2s;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-dark);
    width: 100%;
    max-width: 600px;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 40px 25px 25px;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
}

.close-modal {
    position: absolute;
    top: 28px;
    right: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    transition: all 0.2s;
    border: 1.5px solid rgba(255,255,255,0.3);
    line-height: 1;
    text-align: center;
    padding: 0;
}

.close-modal:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    transform: scale(1.12);
}

.close-modal:active {
    transform: scale(0.9);
}

/* Receipt Style - Generic black on white */
#receipt-modal {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0 20px;
}

#receipt-modal .modal-content {
    max-height: none;
    width: 100%;
    animation: fadeIn 0.2s;
    overflow: visible;
    position: relative;
}

.receipt-paper {
    background: transparent;
    padding: 20px 16px 12px;
}

.receipt-paper .close-modal {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    font-size: 14px;
}

#receipt-preview {
    border: none;
    padding: 4px 8px 8px;
    margin-bottom: 16px;
    background: transparent;
    position: relative;
}

.receipt-wrapper:first-child {
    margin-top: 0;
}

.receipt-wrapper {
    margin-bottom: 30px;
    background: transparent;
}

.receipt-logo {
    width: 56px;
    height: auto;
    display: block;
    margin: 0 auto 10px;
}

.receipt-download-area {
    margin-top: 20px;
    text-align: center;
}

.receipt-account {
    font-weight: 700;
}

.btn-download-receipt {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 22px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Settings modal */
.settings-group {
    margin-bottom: 16px;
}
.settings-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.settings-group input, .settings-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font-main);
}
.settings-group input:focus, .settings-group textarea:focus {
    border-color: var(--primary);
}
.settings-select {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font-main);
    cursor: pointer;
    min-width: 140px;
}
.settings-select:focus {
    border-color: var(--primary);
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.history-item {
    padding: 15px;
    background: var(--surface-light);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.history-item:hover {
    background: rgba(0, 217, 255, 0.1);
    transform: translateX(4px);
    box-shadow: var(--shadow-card);
    border-color: var(--primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Desktop / Web Version Layout */
@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .app-container {
        max-width: 1000px;
        width: 95%;
        height: 90vh;
        border-radius: 24px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        margin: 0;
    }

    .app-header {
        border-radius: 0;
        padding: 20px 40px;
    }

    /* Horizontal Input Form */
    .input-card {
        display: grid;
        grid-template-columns: 2fr 2fr 1fr auto;
        gap: 20px;
        align-items: end;
        padding: 25px 30px;
    }

    .form-group {
        margin-bottom: 0;
    }

    .input-group,
    input {
        width: 100%;
    }

    .action-grid {
        display: flex;
        gap: 10px;
        margin-top: 0;
        grid-column: span 1;
    }

    .btn {
        height: 46px;
    }

    /* Adjust Bottom Bar for Desktop */
    .bottom-bar {
        position: absolute;
        padding: 15px 20px;
        justify-content: center;
        gap: 15px;
        border-radius: 0;
        border-top: 1px solid var(--border-color);
        flex-wrap: wrap;
    }

    .nav-item {
        flex-direction: row;
        width: auto;
        gap: 8px;
        padding: 10px 16px;
        border-radius: 12px;
        transition: all 0.2s;
        background-color: var(--surface-light);
        color: var(--primary);
        border: 1px solid var(--primary);
        box-shadow: 0 2px 10px rgba(0, 217, 255, 0.1);
    }

    .nav-item:hover {
        background-color: rgba(0, 217, 255, 0.15);
        color: var(--primary);
        transform: translateY(-2px);
    }

    .nav-item span {
        font-size: 20px;
    }

    .nav-item span:last-child {
        font-size: 0.9rem;
        font-weight: 600;
        display: inline-block;
    }

    .nav-group {
        gap: 15px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        padding: 30px 40px;
        padding-bottom: 100px;
    }

    .cart-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 15px;
    }
}