:root {
    --primary-teal: #00A896;
    --primary-dark: #028090;
    --primary-light: #02C39A;
    --secondary-mint: #7DDFC3;
    --accent-gold: #F9C846;
    --accent-cream: #E8F6F3;
    --bg-light: #F0FAF8;
    --text-dark: #1A3A3A;
    --text-light: #5A7A7A;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(0, 168, 150, 0.2);
    --shadow-strong: 0 8px 30px rgba(0, 168, 150, 0.3);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--accent-cream) 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header / Publicidad */
.ad-section {
    height: 15%;
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ad-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c2 0 3.5 1.5 3.5 3.5S32 12 30 12s-3.5-1.5-3.5-3.5S28 5 30 5zm15 15c2 0 3.5 1.5 3.5 3.5S47 27 45 27s-3.5-1.5-3.5-3.5S43 20 45 20zm-30 0c2 0 3.5 1.5 3.5 3.5S17 27 15 27s-3.5-1.5-3.5-3.5S13 20 15 20zm15 20c2 0 3.5 1.5 3.5 3.5S32 47 30 47s-3.5-1.5-3.5-3.5S28 40 30 40z' fill='%23ffffff' fill-opacity='0.1'/%3E%3C/svg%3E") repeat;
    animation: movePattern 20s linear infinite;
}

@keyframes movePattern {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.ad-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--white);
}

.ad-content h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
}

.paw-icon {
    width: 50px;
    height: 50px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.ad-tagline {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-top: 5px;
    font-weight: 600;
}

.promo-banner {
    position: absolute;
    top: 12px;
    right: -25px;
    background: var(--white);
    color: var(--primary-teal);
    padding: 6px 40px;
    font-weight: 700;
    font-size: 0.85rem;
    transform: rotate(15deg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Main Content */
.main-content {
    height: 70%;
    position: relative;
    overflow: hidden;
}

.content-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-section.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Scanner Section */
.scanner-section {
    background: linear-gradient(180deg, transparent 0%, rgba(0,168,150,0.05) 100%);
}

.scanner-prompt {
    text-align: center;
    color: var(--text-dark);
}

.scanner-prompt h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    color: var(--primary-teal);
    margin-bottom: 20px;
}

.scanner-prompt p {
    font-size: 1.3rem;
    color: var(--text-light);
    max-width: 400px;
    line-height: 1.6;
}

.scanner-arrow {
    position: absolute;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: pointArrow 1.5s ease-in-out infinite;
}

@keyframes pointArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(15px); }
}

.arrow-text {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1rem;
    text-align: center;
    max-width: 180px;
    margin-bottom: 15px;
}

.arrow-icon {
    width: 80px;
    height: 80px;
    color: var(--primary-teal);
}

.barcode-visual {
    margin: 30px 0;
    padding: 20px 40px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.barcode-lines {
    display: flex;
    gap: 3px;
    height: 60px;
}

.barcode-line {
    width: 4px;
    background: var(--text-dark);
    border-radius: 2px;
    animation: scanPulse 2s ease-in-out infinite;
}

.barcode-line:nth-child(odd) { height: 60px; }
.barcode-line:nth-child(even) { height: 45px; align-self: center; }
.barcode-line:nth-child(1) { animation-delay: 0s; }
.barcode-line:nth-child(2) { animation-delay: 0.1s; }
.barcode-line:nth-child(3) { animation-delay: 0.2s; }
.barcode-line:nth-child(4) { animation-delay: 0.3s; }
.barcode-line:nth-child(5) { animation-delay: 0.4s; }
.barcode-line:nth-child(6) { animation-delay: 0.5s; }
.barcode-line:nth-child(7) { animation-delay: 0.6s; }
.barcode-line:nth-child(8) { animation-delay: 0.7s; }

@keyframes scanPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scan-status {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
}

.scan-status.scanning {
    color: var(--primary-light);
}

/* Product Card */
.product-card {
    display: none;
    background: var(--white);
    border-radius: 25px;
    padding: 30px;
    box-shadow: var(--shadow-strong);
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card.show {
    display: block;
}

.product-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--accent-cream) 0%, var(--bg-light) 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.product-image img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.product-category {
    display: inline-block;
    background: var(--accent-cream);
    color: var(--primary-teal);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-category:empty {
    display: none;
}

.product-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.product-description {
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 20px;
    font-size: 1rem;
}

.product-price {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    color: var(--primary-teal);
    font-weight: 700;
}

.product-price span {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

.scan-again-btn {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--primary-light);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scan-again-btn:hover {
    background: var(--primary-teal);
    transform: scale(1.05);
}

/* Cart Section */
.cart-section {
    padding: 20px !important;
}

.cart-iframe-container {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    background: var(--white);
}

.cart-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: var(--text-light);
    background: var(--white);
    z-index: 1;
}

.cart-placeholder.hidden {
    display: none;
}

.cart-placeholder svg {
    opacity: 0.4;
}

.cart-placeholder p {
    font-size: 1rem;
    text-align: center;
    max-width: 250px;
    line-height: 1.5;
}

.cart-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--white);
}

/* URL Modal */
.url-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.url-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.url-modal-content {
    background: var(--white);
    padding: 35px;
    border-radius: 25px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.url-modal-content h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.url-modal-content input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--accent-cream);
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: var(--text-dark);
    transition: border-color 0.3s ease;
    outline: none;
}

.url-modal-content input:focus {
    border-color: var(--primary-teal);
}

.url-modal-content input::placeholder {
    color: var(--text-light);
}

.url-modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.modal-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.cancel {
    background: var(--accent-cream);
    color: var(--text-light);
}

.modal-btn.cancel:hover {
    background: #d5e8e5;
}

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

.modal-btn.confirm:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Member Section */
.member-section {
    background: linear-gradient(180deg, transparent 0%, rgba(0,168,150,0.05) 100%);
}

.member-card {
    background: var(--white);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-strong);
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-teal), var(--primary-light));
}

.club-badge {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #FFBB33 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    box-shadow: 0 4px 15px rgba(249, 200, 70, 0.5);
}

.club-badge svg {
    width: 60px;
    height: 60px;
    color: var(--white);
}

.member-card h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.member-card h2 span {
    color: var(--primary-teal);
}

.member-subtitle {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.benefits-list {
    text-align: left;
    margin-bottom: 30px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.benefit-item:last-child {
    border-bottom: none;
}

.benefit-icon {
    width: 35px;
    height: 35px;
    background: var(--accent-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-teal);
    flex-shrink: 0;
}

.benefit-text {
    color: var(--text-dark);
    font-weight: 600;
}

.join-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 168, 150, 0.4);
}

.join-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 168, 150, 0.5);
}

.qr-hint {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Bottom Navigation */
.bottom-nav {
    height: 15%;
    background: var(--white);
    display: flex;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    position: relative;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: none;
    background: transparent;
    font-family: 'Nunito', sans-serif;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: var(--primary-teal);
    border-radius: 0 0 4px 4px;
    transition: width 0.3s ease;
}

.nav-item.active::before {
    width: 60%;
}

.nav-item.active .nav-icon {
    background: var(--primary-teal);
    color: var(--white);
    transform: scale(1.1);
}

.nav-item.active .nav-label {
    color: var(--primary-teal);
    font-weight: 700;
}

.nav-icon {
    width: 50px;
    height: 50px;
    background: var(--accent-cream);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-light);
}

.nav-icon svg {
    width: 26px;
    height: 26px;
}

.nav-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Input field for scanner (hidden) */
.scanner-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Loading state */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--accent-cream);
    border-top-color: var(--primary-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--text-light);
    font-weight: 600;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-dark);
    color: var(--white);
    padding: 15px 30px;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Logo area cursor hint for admin */
#logoArea {
    cursor: default;
    user-select: none;
}