/* ======= CSS RESET & VARIABLES ======= */
:root {
    /* Telegram Theme Colors Fallbacks */
    --bg-color: var(--tg-theme-bg-color, #0a1f18);
    --text-color: var(--tg-theme-text-color, #ffffff);
    --hint-color: var(--tg-theme-hint-color, #8e9ea5);
    --button-color: var(--tg-theme-button-color, #00c98e);
    --button-text-color: var(--tg-theme-button-text-color, #ffffff);
    --secondary-bg-color: var(--tg-theme-secondary-bg-color, #132b23);
    
    /* App Specific Colors */
    --primary-green: #00c98e;
    --dark-green: #0a1f18;
    --card-bg: rgba(255, 255, 255, 0.05);
    --nav-bg: #141c22;
    --white: #ffffff;
    --off-white: #f5f5f5;
    --blue-btn: #51a4f0; /* iOS light blue button */
    
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 12px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    background: radial-gradient(circle at 50% 30%, #153c30 0%, var(--bg-color) 70%);
    background-attachment: fixed;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ======= LAYOUT & UTILITIES ======= */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 90px;
}

.content-area::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.page {
    display: none;
    padding: 24px 20px;
    animation: fadeIn 0.4s ease;
    min-height: 100%;
    flex-direction: column;
}

.page.active {
    display: flex;
}

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

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.03);
}

.text-center {
    text-align: center;
}

/* ======= TYPOGRAPHY ======= */
h1, h2, h3, h4 { color: var(--white); font-weight: 600; }
h2 { font-size: 24px; margin-bottom: 8px; }
h3 { font-size: 18px; margin-bottom: 4px; }
h4 { font-size: 16px; margin-bottom: 2px; }
p { color: var(--hint-color); font-size: 14px; line-height: 1.4; }

/* ======= BOTTOM NAVIGATION ======= */
.bottom-nav {
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 80px;
    padding: 10px 20px 20px;
    background-color: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    text-decoration: none;
    color: var(--hint-color);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    transition: var(--transition);
}

.nav-icon-bg {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: var(--transition);
}

.nav-item ion-icon {
    font-size: 24px;
}

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

.nav-item.active .nav-icon-bg {
    background-color: var(--primary-green);
    color: var(--bg-color);
    box-shadow: 0 4px 12px rgba(0, 201, 142, 0.3);
}

/* Hide bottom nav on specific pages */
.hide-nav .bottom-nav {
    display: none;
}
.hide-nav .content-area {
    padding-bottom: 20px;
}

/* ======= BUTTONS ======= */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--border-radius-lg);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

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

.btn-primary {
    background-color: var(--primary-green);
    color: var(--bg-color);
}

.btn-secondary {
    background-color: var(--white);
    color: #000;
}

.btn-dark {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    backdrop-filter: blur(10px);
}

.btn-blue {
    background-color: var(--blue-btn);
    color: #fff;
}

.btn .btn-icon {
    margin-right: 12px;
    font-size: 20px;
    display: flex;
}

.btn .btn-right-icon {
    margin-left: auto;
    font-size: 20px;
    display: flex;
}

.btn .btn-price {
    margin-left: auto;
    font-weight: 500;
    opacity: 0.9;
}

.icon-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:active {
    background: rgba(255,255,255,0.2);
}

.icon-btn-transparent {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    color: var(--white);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
}
.icon-btn-transparent ion-icon {
    font-size: 24px;
    margin-right: 4px;
}

/* ======= PAGE 1: HOME ======= */
.logo-shield-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 40px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rings {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ring-1 { width: 100%; height: 100%; animation: pulse 4s infinite linear; }
.ring-2 { width: 160%; height: 160%; border-color: rgba(255,255,255,0.05); animation: pulse 4s infinite linear 1s; }
.ring-3 { width: 220%; height: 220%; border-color: rgba(255,255,255,0.02); animation: pulse 4s infinite linear 2s; }

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
}

.shield-icon {
    font-size: 80px;
    color: var(--white);
    z-index: 10;
    filter: drop-shadow(0 0 20px rgba(0, 201, 142, 0.4));
}

.status-info {
    position: relative;
    margin-top: 20px;
    margin-bottom: 40px;
}

.status-date {
    font-size: 28px;
    font-weight: 700;
}

.status-details {
    display: flex;
    align-items: center;
    margin-top: 4px;
    color: var(--primary-green);
    font-size: 16px;
    font-weight: 500;
}

.status-dot {
    margin: 0 8px;
}

.badge-expired {
    position: absolute;
    right: 0;
    top: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--hint-color);
    border: 1px solid rgba(255,255,255,0.1);
}

.main-actions {
    margin-top: auto;
}

/* ======= PAGE 2: INSTALL ======= */
.page-header {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
}

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

.plug-icon-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 40px auto 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.plug-icon {
    font-size: 64px;
    color: var(--white);
    transform: rotate(45deg);
    z-index: 10;
}

/* ======= PAGE 3: PROFILE ======= */
.profile-header {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 16px;
    border: 2px solid var(--primary-green);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
}

.user-id {
    color: var(--primary-green);
    font-family: monospace;
    font-size: 13px;
    margin-top: 2px;
}

.menu-group {
    margin-bottom: 24px;
}

.menu-group-title {
    color: var(--hint-color);
    font-size: 14px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.menu-list {
    padding: 8px 16px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition);
}

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

.menu-item:active {
    opacity: 0.7;
}

.menu-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: rgba(255,255,255,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 16px;
    font-size: 20px;
    color: var(--white);
}

.menu-content h4 {
    font-size: 16px;
    font-weight: 600;
}

.menu-content p {
    font-size: 13px;
    margin-top: 2px;
}

.floating-toast {
    position: relative;
    margin-top: 16px;
    background-color: var(--white);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.floating-toast h4 {
    color: #000;
    font-family: monospace;
    font-size: 14px;
}

.floating-toast p {
    color: #666;
    margin-top: 4px;
}

.floating-toast .icon-btn {
    background-color: rgba(0,0,0,0.05);
    color: #000;
}

/* ======= PAGE 4: SUPPORT ======= */
.support-header {
    text-align: left;
    padding: 24px;
    margin-bottom: 24px;
}

.support-icon-large {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--white);
    margin-bottom: 16px;
}

.support-header p {
    margin-top: 8px;
}

/* ======= IOS FLOW (STEPS 1-3) ======= */
.ios-flow-page {
    padding-top: 10px;
}

.ios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
}

.ios-title {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.ios-title span {
    font-weight: 400;
    font-size: 12px;
    color: var(--hint-color);
}

.ios-page-header {
    margin-top: 0;
    margin-bottom: 30px;
}

.progress-ring-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 20px auto 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    stroke: rgba(255,255,255,0.05);
}

.progress-ring-circle {
    stroke: var(--primary-green);
    transition: stroke-dashoffset 0.5s ease-in-out;
}

.progress-icon {
    position: absolute;
    font-size: 64px;
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-icon.dashed-circle {
    width: 80px;
    height: 80px;
    border: 3px dashed var(--white);
    border-radius: 50%;
    font-size: 40px;
}

/* Confetti animation for step 3 */
.confetti-bg::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background-image: radial-gradient(circle, #ff0 10%, transparent 10%),
                      radial-gradient(circle, var(--blue-btn) 10%, transparent 10%),
                      radial-gradient(circle, var(--primary-green) 10%, transparent 10%),
                      radial-gradient(circle, #f0f 10%, transparent 10%);
    background-position: 0% 0%, 20% 40%, 80% 80%, 100% 20%;
    background-size: 8px 8px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}


/* ======= MODALS ======= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: #1a1a1a;
    width: 90%;
    max-width: 400px;
    border-radius: var(--border-radius-lg);
    padding: 30px 24px 24px;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: none;
    border: 1px solid rgba(255,255,255,0.05);
}

.modal-overlay.active .modal-content.active {
    display: block;
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--white);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
}

.modal-content h3 {
    font-size: 24px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.modal-content p {
    font-size: 15px;
    margin-bottom: 24px;
    color: var(--white);
    opacity: 0.8;
}

.modal-buttons-row {
    display: flex;
    gap: 12px;
}

.modal-btn-half {
    flex: 1;
    margin-bottom: 0;
}

/* ======= DASHBOARD UI ======= */
.dashboard-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dashboard-row:last-child {
    border-bottom: none;
}

.dash-label {
    color: var(--hint-color);
    font-size: 14px;
}

.dash-value {
    color: var(--white);
    font-weight: 500;
    font-family: monospace;
    font-size: 14px;
}

.dash-highlight {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255,255,255,0.2) !important;
}

.dash-value.highlight {
    color: var(--primary-green);
    font-weight: 700;
    font-size: 16px;
}

/* ======= MODERN INPUT ======= */
.modern-input {
    width: 100%;
    padding: 16px;
    border-radius: var(--border-radius-sm);
    background-color: var(--secondary-bg-color);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--white);
    font-size: 18px;
    text-align: center;
    font-family: monospace;
    letter-spacing: 2px;
    outline: none;
    transition: var(--transition);
    margin-bottom: 8px;
}

.modern-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(0, 201, 142, 0.2);
}

.modern-input::placeholder {
    color: rgba(255,255,255,0.2);
    letter-spacing: 1px;
}

.error-msg {
    color: #ff5252;
    font-size: 13px !important;
    text-align: left;
    margin-top: 4px;
    margin-bottom: 16px;
}

.mt-3 {
    margin-top: 16px;
}
