* {
    box-sizing: border-box;
}

:root {
    --primary: #0B1BEA;
    --primary-dark: #0713b5;
    --primary-rgb: 11, 27, 234;
    --primary-dark-rgb: 7, 19, 181;
    --bg-primary: #0a0e1a;
    --bg-secondary: #111522;
    --bg-card: #1a1f2e;
    --bg-input: #1f2430;
    --input-border: rgba(255, 255, 255, 0.12);
    --input-focus-bg: #111522;
    --input-shadow: rgba(11, 27, 234, 0.18);
    --btn-primary-shadow: rgba(11, 27, 234, 0.35);
    --btn-secondary-border: rgba(255, 255, 255, 0.15);
    --btn-secondary-bg: rgba(255, 255, 255, 0.04);
    --toggle-bg: rgba(255, 255, 255, 0.04);
    --toggle-border: rgba(255, 255, 255, 0.08);
    --toggle-active-bg: rgba(11, 27, 234, 0.2);
    --nav-bg: rgba(15, 18, 27, 0.95);
    --nav-text: rgba(255, 255, 255, 0.6);
    --nav-active: #0B1BEA;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --title-color: #eef2ff;
    --profile-title-color: #d9e3ff;
    --border-radius: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-bonus: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #4facfe 100%);
    --bonus-card-image: url("card.svg");
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(var(--primary-rgb), 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(var(--primary-dark-rgb), 0.12) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    padding: 20px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-in;
}

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

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 4px;
}

.brand-logo {
    height: 46px;
    width: auto;
    display: block;
}

.refresh-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.refresh-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.refresh-btn:active {
    transform: translateY(0) scale(0.95);
}

.refresh-icon {
    font-size: 20px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.refresh-btn:active .refresh-icon {
    transform: rotate(180deg);
}

/* PAGES */
.page {
    display: none;
    animation: slideOut 0.3s ease-out;
}

.page.active {
    display: block;
    animation: slideIn 0.3s ease-in;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

.page-header {
    margin-bottom: 24px;
    padding: 0 4px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: 0.2px;
    color: #d9e3ff;
    text-shadow: 0 6px 20px rgba(11, 27, 234, 0.2);
}

#page-profile .page-header h2 {
    color: var(--profile-title-color);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* BONUS CARD */
.bonus-card {
    background-color: #0b0f1a;
    background-image: var(--bonus-card-image);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    padding: 32px 24px;
    border-radius: var(--border-radius);
    text-align: left;
    width: 100%;
    aspect-ratio: 16 / 9;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.bonus-card-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    margin-bottom: 0;
    text-align: left;
}

.bonus-user {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    backdrop-filter: none;
}

.bonus-user-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bonus-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    margin-top: 2px;
}

.bonus-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    margin-top: 10px;
}

.bonus-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bonus-title {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bonus-value {
    font-size: 64px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.bonus-value:hover {
    transform: scale(1.05);
}


.info-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 15px;
}

.info-icon {
    font-size: 24px;
}

/* PRODUCTS */
.products {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(11, 27, 234, 0.45);
}

.product-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.product-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-item.expanded .product-desc {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.product-price {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #ffffff;
    text-shadow: 0 6px 18px rgba(11, 27, 234, 0.25);
    margin: 6px 0 12px;
}

.product-more {
    font-size: 13px;
    font-weight: 600;
    color: #8ea0ff;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    margin: 2px 0 10px;
}

.product-img {
    width: 100%;
    border-radius: 12px;
    margin-top: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.product-slider-wrap {
    margin-top: 12px;
}

.product-slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.product-slider-track {
    display: flex;
    transition: transform 0.35s ease;
    width: 100%;
}

.product-slider .product-img {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 100%;
    width: 100%;
    height: auto;
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
}

.slider-dot.active {
    background: #0B1BEA;
    box-shadow: 0 0 8px rgba(11, 27, 234, 0.65);
}

.product-img:hover {
    transform: scale(1.02);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* PROFILE */
.profile-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.auth-card {
    margin-bottom: 16px;
}

.auth-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-toggle {
    display: flex;
    gap: 8px;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 16px;
}

.auth-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-toggle-btn.active {
    background: var(--toggle-active-bg);
    color: var(--text-primary);
}

.auth-toggle-btn:hover {
    color: var(--text-primary);
}

.field {
    margin-bottom: 20px;
}

.field label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.otp-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.otp-row input {
    flex: 1;
    min-width: 0;
    width: 100%;
}

#otpBtn,
#loginOtpBtn {
    white-space: nowrap;
    width: auto;
    margin-top: 0;
    padding: 12px 16px;
    font-size: 14px;
}

.field-icon {
    font-size: 18px;
}

.field input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 4px var(--input-shadow);
}

.field input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    margin-top: 8px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--btn-primary-shadow);
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--btn-primary-shadow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: 2px solid var(--btn-secondary-border);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 12px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-secondary:hover {
    border-color: var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.hidden {
    display: none;
}

.btn-icon {
    font-size: 20px;
}

.registered-status {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, rgba(30, 203, 156, 0.2) 0%, rgba(102, 126, 234, 0.2) 100%);
    border: 2px solid var(--primary);
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    margin-top: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(30, 203, 156, 0.3);
    animation: fadeIn 0.3s ease-in;
}

.status-icon {
    font-size: 20px;
}

.status-text {
    color: var(--primary);
}

/* BOTTOM NAV */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    font-family: inherit;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 40px;
    height: 3px;
    background: var(--nav-active);
    box-shadow: 0 0 10px rgba(11, 27, 234, 0.7);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s ease;
}

.nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.nav-icon {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active .nav-icon {
    transform: scale(1.2);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-label {
    font-weight: 500;
}

/* TOAST */
#toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 16px 24px;
    background: var(--gradient-primary);
    color: var(--text-primary);
    border-radius: 12px;
    display: none;
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    z-index: 2000;
    animation: toastSlideIn 0.3s ease-out forwards;
    max-width: 90%;
    text-align: center;
}

#toast.show {
    display: block;
    animation: toastSlideIn 0.3s ease-out forwards;
}

#toast.error {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* RESPONSIVE */
@media (max-width: 480px) {
    #app {
        padding: 16px;
    }

    .brand-logo {
        height: 34px;
    }

    header h1 {
        font-size: 20px;
    }

    .bonus-value {
        font-size: 56px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .nav-label {
        font-size: 12px;
    }

    .nav-icon {
        font-size: 22px;
    }
}

/* SMOOTH SCROLLING */
html {
    scroll-behavior: smooth;
}

/* SELECTION */
::selection {
    background: #0B1BEA;
    color: #ffffff;
}
