* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background: #2D1B4E;
    color: #FFFFFF;
}

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #261545;
    padding: 30px;
    border-radius: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
}

.login-card h1 {
    font-size: 1.8rem;
    margin: 10px 0;
}

.login-card p {
    color: #C4B5FD;
    margin-bottom: 20px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    background: #1F0F3C;
    border: none;
    border-radius: 40px;
    color: white;
    font-size: 1rem;
}

.login-card button {
    background: #8B5CF6;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    margin-top: 10px;
    cursor: pointer;
}

.error-message {
    color: #EF4444;
    margin-top: 12px;
}

/* ===== HEADER ===== */
.header {
    background: #3D2568;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-header {
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    font-size: 0.8rem;
    background: #2D1B4E;
    padding: 6px 12px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-logout {
    background: #6B7280;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    gap: 12px;
}

.products-panel {
    flex: 2;
    min-width: 250px;
    background: #261545;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.cart-panel {
    flex: 1.2;
    min-width: 280px;
    background: #261545;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: #1F0F3C;
    border: 1px solid #4C3375;
    border-radius: 40px;
    color: white;
    font-size: 1rem;
    outline: none;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.product-card {
    background: #1F0F3C;
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #4C3375;
    transition: transform 0.1s;
}

.product-card:active {
    transform: scale(0.97);
    background: #3D2568;
}

.product-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 6px;
}

.product-price {
    color: #F59E0B;
    font-size: 1.2rem;
    font-weight: bold;
}

.product-stock {
    font-size: 0.7rem;
    color: #C4B5FD;
    margin-top: 4px;
}

.cart-items {
    flex: 1;
    max-height: 45vh;
    overflow-y: auto;
    margin-bottom: 8px;
}

.cart-item {
    background: #1F0F3C;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cart-item-info {
    flex: 2;
}

.cart-item-name {
    font-weight: bold;
}

.cart-item-price {
    font-size: 0.8rem;
    color: #F59E0B;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    background: #8B5CF6;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 30px;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
}

.qty-btn:active {
    background: #6D28D9;
}

.cart-item-total {
    font-weight: bold;
    min-width: 70px;
    text-align: right;
}

.remove-item {
    background: #EF4444;
    border: none;
    padding: 6px 10px;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    font-size: 0.7rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.4rem;
    font-weight: bold;
    margin: 8px 0;
}

.discount-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.discount-input {
    flex: 2;
    background: #1F0F3C;
    border: 1px solid #4C3375;
    padding: 10px;
    border-radius: 30px;
    color: white;
    text-align: center;
}

.btn-finalize {
    background: #10B981;
    border: none;
    padding: 14px;
    border-radius: 40px;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    margin-top: 8px;
}

.btn-clear {
    background: #6B7280;
}

.btn-payment {
    background: #F59E0B;
    padding: 10px 16px;
    border-radius: 40px;
    border: none;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

.loading, .empty-cart {
    text-align: center;
    padding: 20px;
    color: #C4B5FD;
}

footer {
    text-align: center;
    padding: 16px;
    font-size: 0.7rem;
    color: #8B7AB8;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 700px) {
    .main-container {
        flex-direction: column;
    }
    .products-grid {
        max-height: 45vh;
    }
    .cart-items {
        max-height: 35vh;
    }
    .login-card {
        padding: 20px;
    }
}