/* ==========================================
   OCTOPLUG AI — MINI APP STYLES
   Premium Dark Theme · Inspired by Vendetta SMM
   ========================================== */

/* === CSS VARIABLES === */
:root {
    /* Backgrounds */
    --bg-app: #0a0a0a;
    --bg-card: #141414;
    --bg-card-alt: #1a1a1a;
    --bg-elevated: #1e1e1e;
    --bg-input: #1c1c1e;

    /* Accent — Amber/Gold */
    --accent: #f5a623;
    --accent-hover: #ffb840;
    --accent-dim: rgba(245, 166, 35, 0.12);
    --accent-gradient: linear-gradient(135deg, #f5a623 0%, #f7c948 100%);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #8a8a8a;
    --text-muted: #505050;
    --text-accent: #f5a623;

    /* Semantic */
    --success: #34c759;
    --success-dim: rgba(52, 199, 89, 0.12);
    --danger: #ff3b30;
    --danger-dim: rgba(255, 59, 48, 0.12);
    --info: #5ac8fa;
    --info-dim: rgba(90, 200, 250, 0.12);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(245, 166, 35, 0.25);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Sizing */
    --gap: 10px;
    --padding: 16px;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --nav-height: 66px;

    /* Transitions */
    --t: 0.2s ease;
    --t-slow: 0.35s ease;
}


/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}


/* === SCROLLBAR === */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }


/* === LOADING SCREEN === */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    z-index: 1000;
    gap: 12px;
}

.loader-logo {
    font-size: 48px;
    animation: pulse 1.5s ease infinite;
}

.loader-ring {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loader-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}


/* === APP LAYOUT === */
#app {
    max-width: 100%;
    min-height: 100vh;
}

.pages {
    padding-bottom: calc(var(--nav-height) + 20px);
}

.page {
    display: none;
    padding: var(--padding);
    padding-top: 12px;
    animation: pageIn 0.3s ease;
}

.page.active {
    display: block;
}

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


/* === PAGE HEADER === */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}


/* === USER CARD (Profile) === */
.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--gap);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2.5px solid var(--accent);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
}

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

.avatar-initials {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details h2 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.username {
    color: var(--text-secondary);
    font-size: 13px;
    display: block;
    margin-top: 1px;
}

.premium-badge {
    background: var(--accent-gradient);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.notification-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}


/* === STATS ROW === */
.stats-row {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.stat {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-accent);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 3px;
}


/* === ACTION CARDS GRID === */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--t);
    position: relative;
    overflow: hidden;
}

.action-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--t);
}

.action-card:active {
    transform: scale(0.97);
}

.action-card:active::after {
    opacity: 0.04;
}

.action-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.action-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.action-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.action-subtitle {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.action-arrow {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 300;
    position: relative;
    z-index: 1;
}


/* === ACTIVITY CARD === */
.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--gap);
}

.activity-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

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

.activity-value {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 13px;
}


/* === SECTIONS === */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    padding-left: 2px;
}


/* === MODEL / MENU CARDS === */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all var(--t);
}

.model-card:active {
    transform: scale(0.98);
    background: var(--bg-card-alt);
}

.model-card.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.model-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.model-icon.blue { background: var(--info-dim); }
.model-icon.green { background: var(--success-dim); }
.model-icon.red { background: var(--danger-dim); }

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.model-desc {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.model-arrow {
    color: var(--text-muted);
    font-size: 20px;
    font-weight: 300;
    flex-shrink: 0;
}

.model-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}


/* === BOTTOM NAVIGATION === */
.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(14, 14, 14, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color var(--t);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.nav-item svg {
    fill: currentColor;
    transition: all var(--t);
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

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

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}


/* === BACK BUTTON === */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0;
    margin-bottom: 8px;
    transition: opacity var(--t);
}

.back-btn:active {
    opacity: 0.6;
}


/* === BUTTONS === */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t);
}

.btn-accent {
    background: var(--accent-gradient);
    color: #000;
}

.btn-accent:active {
    transform: scale(0.98);
    filter: brightness(0.9);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:active {
    background: var(--bg-card-alt);
}


/* === INFO BOX === */
.info-box {
    background: var(--accent-dim);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.info-box strong {
    color: var(--accent);
}


/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-8px); }
}


/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 500;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 8px var(--padding) 24px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalUp 0.3s ease;
}

@keyframes modalUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 8px auto 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}


/* === HISTORY ITEMS === */
.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    transition: background var(--t);
}

.history-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-prompt {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.history-meta {
    display: flex;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}


/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
    line-height: 1.5;
}


/* === PRICING === */
.pricing-section {
    margin-bottom: 20px;
}

.pricing-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent);
}

.pricing-item {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

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

.pricing-item .price {
    color: var(--accent);
    font-weight: 600;
}

.pricing-item .price.free {
    color: var(--success);
}


/* === TOPUP CARDS === */
.topup-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--t);
}

.topup-card:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.topup-amount {
    font-size: 16px;
    font-weight: 700;
}

.topup-tokens {
    text-align: right;
}

.topup-tokens .amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.topup-tokens .bonus {
    font-size: 11px;
    color: var(--success);
    font-weight: 600;
}


/* === REFERRAL LINK === */
.ref-link-box {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--accent);
    word-break: break-all;
    cursor: pointer;
    transition: all var(--t);
}

.ref-link-box:active {
    background: var(--accent-dim);
    transform: scale(0.99);
}


/* === APP FOOTER === */
.app-footer {
    text-align: center;
    padding: 28px 0 8px;
    color: var(--text-muted);
    font-size: 12px;
}


/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-alt) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-card {
    height: 70px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.skeleton-user {
    height: 140px;
    border-radius: var(--radius);
    margin-bottom: var(--gap);
}

.skeleton-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.skeleton-action {
    height: 64px;
    border-radius: var(--radius-sm);
}


/* === FAQ ITEMS === */
.faq-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

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

.faq-item strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.faq-item p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}


/* === STATUS BADGE === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.status-badge.active {
    background: var(--success-dim);
    color: var(--success);
}

.status-badge.inactive {
    background: var(--danger-dim);
    color: var(--danger);
}


/* === DIVIDER === */
.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}


/* === UTILITIES === */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
