:root {
    --primary-color: #DA291C;
    /* Mercadão Red */
    --secondary-color: #000000;
    --text-color: #333333;
    --background-color: #F4F4F4;
    --white: #FFFFFF;
    --gray-light: #E0E0E0;
    --success: #28a745;
    --error: #dc3545;
    --font-family: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    background: var(--white);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: var(--secondary-color);
    color: var(--white);
    background-image: url('/assets/img/bg-header.jpg');
    padding: 10px;
    text-align: center;
    border-bottom: 4px solid var(--primary-color);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo {
    max-height: 100px;
    width: auto;
}

/* Main Content */
main {
    padding: 20px;
    flex: 1;
    padding-bottom: 90px;
    /* Space for bottom nav */
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
}

input[type="text"],
input[type="tel"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn ion-icon {
    font-size: 1.3rem;
    vertical-align: middle;
}

/* Views (SPA switching) */
.view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard */
.card {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 5px solid var(--primary-color);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

.referral-list {
    margin-top: 3rem;
}

.referral-list h3 {
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
    display: inline-block;
}

.referral-item {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status {
    font-size: 0.6rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
}

.status.pending {
    background: #ffeeba;
    color: #856404;
}

.status.used {
    background: #d4edda;
    color: #155724;
}

/* QR Code */
#qrcode {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* Validation Page */
.validation-result {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

.validation-result.valid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.validation-result.invalid {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Helpers */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.icon1 {
    width: 2rem;
    margin-bottom: -0.5rem;
}

/* Dashboard Tabs */
.dashboard-tab {
    display: none;
    animation: fadeIn 0.3s ease;
}

.dashboard-tab.active {
    display: block;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #000000;
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #888888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
    font-family: inherit;
    flex: 1;
}

.nav-btn.active {
    color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    font-size: 2rem;
    margin-bottom: 4px;
    --ionicon-stroke-width: 40px;
}

/* Menu List */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    text-transform: uppercase;
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--text-color);
}

.mb-10 {
    margin-bottom: 10px;
}

.mt-30 {
    margin-top: 30px;
}

.text-center {
    text-align: center;
}

.menu-logo {
    max-width: 230px;
    margin-top: 50px;
}

/* Custom UI Alerts */
#alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ui-alert {
    background: var(--white);
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    animation: slideDown 0.3s ease-out forwards;
    position: relative;
    overflow: hidden;
}

.ui-alert.success {
    border-left-color: var(--success);
}

.ui-alert .close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    margin-left: 10px;
    transition: color 0.2s;
}

.ui-alert .close-btn:hover {
    color: var(--text-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Searchable Select */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.store-search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-family: var(--font-family);
    font-size: 0.95rem;
}

.store-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.store-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.store-dropdown .store-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.store-dropdown .store-option:last-child {
    border-bottom: none;
}

.store-dropdown .store-option:hover,
.store-dropdown .store-option.active {
    background-color: #f5f5f5;
    color: var(--primary-color);
}

.store-dropdown .store-no-results {
    padding: 10px 12px;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
}
/* Login Welcome */
.login-welcome {
    text-align: center;
    padding: 30px 10px 25px;
}

.welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.login-welcome h2 {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.login-welcome p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

/* Install Banner */
.install-banner {
    margin-top: auto;
    padding: 18px;
    background: linear-gradient(135deg, #fff8f8, #fff);
    border: 1px solid #f0d0d0;
    border-radius: 12px;
    margin-top: 30px;
}

.install-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.install-banner-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.install-banner-text strong {
    font-size: 0.95rem;
    color: var(--secondary-color);
}

.install-banner-text span {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.4;
}

.btn-install {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    font-family: var(--font-family);
    transition: background-color 0.3s, transform 0.1s;
}

.btn-install:active {
    transform: scale(0.98);
}

/* Login view layout */
#view-login.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 240px);
}

#view-login .install-banner {
    margin-top: auto;
}

.btn-whatsapp {
    display: flex;
    padding: 6px 12px;
    background-color: #25D366;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    align-items: center;
    gap: 7px;
}

.btn-whatsapp ion-icon {
    font-size: 1.1rem;
}