﻿/* Base & reset – modern, clean */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Import Inter font (optional, but looks modern) */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap');

/* Main container */
.ecr-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
}

/* Header – elevated, subtle */
.ecr-header {
    background: #ffffff;
    backdrop-filter: blur(0px);
    padding: 0.9rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-radius: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.03);
    margin-bottom: 1.5rem;
    border: 1px solid #eef2f8;
}

.ecr-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 28px;
    width: auto;
    transition: opacity 0.2s;
}

.title-text {
    font-size: 1.15rem;
    font-weight: 600;
    background: linear-gradient(135deg, #1e293b, #2d3a4f);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.2px;
}

.demo-badge {
    background: #eef2ff;
    color: #2563eb;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 2rem;
    letter-spacing: 0.3px;
    border: 1px solid #dbeafe;
}

.device-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.status-text {
    font-size: 0.8rem;
    background: #f8fafc;
    padding: 0.4rem 0.9rem;
    border-radius: 2rem;
    color: #1e293b;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

/* Buttons in header */
.btn-detect,
.btn-restart {
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.btn-detect {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

    .btn-detect:hover {
        background: #dbeafe;
        transform: translateY(-1px);
    }

.btn-restart:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

/* Main body – fluid grid */
.ecr-body {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ecr-left,
.ecr-right {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -2px rgb(0 0 0 / 0.05), 0 10px 15px -3px rgb(0 0 0 / 0.04);
    padding: 1.5rem;
    transition: box-shadow 0.2s;
    border: 1px solid #eef2f8;
}

.ecr-left {
    flex: 1.6;
    min-width: 280px;
}

.ecr-right {
    flex: 1;
    min-width: 280px;
}

/* Add items bar – tighter, more compact */
.add-items-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

    .add-items-bar .field {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        flex: 1;
        min-width: 110px;
    }

    .add-items-bar label {
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #5b6e8c;
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }

    .add-items-bar select,
    .add-items-bar input {
        padding: 0.55rem 0.8rem;
        border: 1.5px solid #e2e8f0;
        border-radius: 0.9rem;
        font-size: 0.85rem;
        background: white;
        transition: all 0.2s;
        font-family: inherit;
    }

        .add-items-bar select:focus,
        .add-items-bar input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
        }

.btn-add {
    background: #2563eb;
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.55rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-add:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(37,99,235,0.2);
    }

/* Bill number chip */
.bill-no {
    font-size: 0.75rem;
    color: #475569;
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 1rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

/* Cart table */
.table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 1rem;
    border: 1px solid #edf2f7;
    background: white;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 480px;
}

    .cart-table th {
        text-align: left;
        padding: 0.8rem 0.8rem;
        background: #f9fafb;
        font-weight: 600;
        color: #1e293b;
        border-bottom: 1px solid #eef2f8;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .cart-table td {
        padding: 0.7rem 0.8rem;
        border-bottom: 1px solid #f1f5f9;
        color: #0f172a;
    }

    .cart-table tbody tr:hover td {
        background: #fafcff;
    }

.empty-cart {
    text-align: center;
    padding: 2.5rem !important;
    color: #94a3b8;
    font-weight: 500;
}

/* Total bar */
.total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid #edf2f7;
}

.total-amount-box {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
}

.total-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
}

.total-amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: -0.5px;
}

.btn-reset {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-reset:hover {
        background: #fee2e2;
        border-color: #fecaca;
        color: #dc2626;
    }

/* Payment section */
.payment-section {
    margin-top: 1rem;
}

.btn-cash {
    background: #0f172a;
    border: none;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    border-radius: 3rem;
    width: 100%;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

    .btn-cash:hover {
        background: #1e293b;
        transform: scale(0.98);
    }

.payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

    .payment-methods button {
        flex: 1;
        min-width: 90px;
        background: white;
        border: 1.5px solid #e2e8f0;
        padding: 0.7rem 0.5rem;
        border-radius: 2rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

        .payment-methods button img {
            height: 22px;
            width: auto;
        }

.btn-card:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

.btn-fonepay {
    border-color: #f97316;
    color: #f97316;
}

    .btn-fonepay:hover {
        background: #fff7ed;
        border-color: #f97316;
        transform: translateY(-2px);
    }

.btn-nepalpay {
    border-color: #0891b2;
    color: #0891b2;
}

    .btn-nepalpay:hover {
        background: #ecfeff;
        border-color: #0891b2;
        transform: translateY(-2px);
    }

/* Right panel components */
.output-panel,
.txn-panel,
.verify-panel {
    margin-bottom: 1.8rem;
}

.panel-title {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5b6e8c;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.log-textarea {
    width: 100%;
    height: 180px;
    min-height: 180px;
    background: #fefefe;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    resize: vertical;
    color: #0f172a;
    line-height: 1.5;
}

    .log-textarea:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
    }

.txn-status {
    padding: 0.6rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f1f5f9;
    color: #1e293b;
    width: 100%;
}

.status-success {
    background: #dcfce7;
    color: #15803d;
    border-left: 4px solid #22c55e;
}

.status-pending {
    background: #fef9c3;
    color: #a16207;
    border-left: 4px solid #eab308;
}

.status-error {
    background: #fee2e2;
    color: #b91c1c;
    border-left: 4px solid #ef4444;
}

.status-accepted {
    background: #e0f2fe;
    color: #0369a1;
    border-left: 4px solid #0ea5e9;
}

.verify-input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

    .verify-input-group input {
        flex: 2;
        min-width: 150px;
        padding: 0.65rem 1rem;
        border: 1.5px solid #e2e8f0;
        border-radius: 2rem;
        font-size: 0.85rem;
        transition: all 0.2s;
    }

        .verify-input-group input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
        }

.btn-verify {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.65rem 1.5rem;
    border-radius: 2rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-verify:hover {
        background: #e2e8f0;
        transform: translateY(-1px);
    }

/* Responsive breakpoints */
@media (max-width: 768px) {
    .ecr-container {
        padding: 0.75rem;
    }

    .ecr-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 0.85rem 1rem;
        gap: 0.75rem;
        border-radius: 1rem;
    }

    .ecr-title {
        justify-content: center;
    }

    .device-status {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Stack left and right panels vertically */
    .ecr-body {
        flex-direction: column;
    }

    .ecr-left,
    .ecr-right {
        flex: none;
        width: 100%;
        min-width: unset;
        padding: 1rem;
        border-radius: 1rem;
    }

    .add-items-bar {
        flex-direction: column;
        align-items: stretch;
    }

        .add-items-bar .field {
            width: 100%;
        }

    .btn-add {
        width: 100%;
        justify-content: center;
    }

    .payment-methods {
        flex-direction: column;
    }

        .payment-methods button {
            width: 100%;
        }

    .total-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .total-amount-box {
        justify-content: center;
    }

    .verify-input-group {
        flex-direction: column;
    }

        .verify-input-group input,
        .verify-input-group button {
            width: 100%;
        }
}

@media (max-width: 480px) {
    .ecr-container {
        padding: 0.5rem;
    }

    .brand-logo {
        height: 22px;
    }

    .title-text {
        font-size: 0.95rem;
    }

    .total-amount {
        font-size: 1.3rem;
    }

    .cart-table th,
    .cart-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    /* Compact header on very small screens */
    .ecr-header {
        padding: 0.7rem 0.75rem;
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
    }

    /* Status badge smaller */
    .status-badge {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}

/* Loading spinner (optional, used in component) */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
