/* ===== Reset & Design Tokens ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overscroll-behavior: none; }
:root {
    --bg-1: #07080d;
    --bg-2: #0d1220;
    --bg-3: #111827;
    --surface: rgba(255,255,255,0.03);
    --surface-hover: rgba(255,255,255,0.06);
    --surface-active: rgba(255,255,255,0.08);
    --glass-border: rgba(255,255,255,0.08);
    --glass-border-hover: rgba(255,255,255,0.14);
    --text: #e4e7ef;
    --text-dim: #6b7280;
    --text-muted: #4b5563;
    --accent-1: #00d4aa;
    --accent-2: #7c5cfc;
    --accent-grad: linear-gradient(135deg, #00d4aa, #7c5cfc);
    --success: #34c759;
    --warning: #ff9f0a;
    --danger: #ff453a;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --blur: blur(20px);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(0,212,170,0.15);
}

body {
    font-family: var(--font);
    background: var(--bg-1);
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 40%, var(--bg-3) 100%);
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: '';
    position: fixed;
    top: -30%; left: -20%;
    width: 70%; height: 70%;
    background: radial-gradient(circle, rgba(0,212,170,0.06) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -30%; right: -20%;
    width: 60%; height: 60%;
    background: radial-gradient(circle, rgba(124,92,252,0.05) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
a { color: var(--accent-1); text-decoration: none; }

/* ===== Glass Card ===== */
.glass-card {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    width: 100%;
}

/* ===== Layout ===== */
.app-wrapper {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.header {
    padding: 24px 0 8px;
    text-align: center;
    width: 100%; max-width: 540px;
}
.logo-row {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    text-decoration: none;
}
.logo {
    height: 40px; width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.brand-title {
    font-size: 24px; font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.tagline {
    font-size: 13px; color: var(--text-dim);
    margin-top: 4px; font-weight: 400;
}

.main {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 12px 0 24px;
    gap: 14px;
    width: 100%; max-width: 540px;
}

.footer {
    text-align: center; padding: 20px 0 28px;
    font-size: 12px; color: var(--text-muted);
    display: flex; gap: 8px; justify-content: center; align-items: center;
}
.footer a { color: var(--text-dim); transition: color 0.2s; }
.footer a:hover { color: var(--accent-1); }

/* ===== Navigation ===== */
.nav-row {
    display: flex; gap: 8px; width: 100%;
}
.nav-btn {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-btn.active {
    background: var(--surface-active);
    color: var(--text);
    border-color: var(--glass-border-hover);
}
.nav-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ===== Pills / Tabs ===== */
.location-pills, .os-pills, .admin-tabs {
    display: flex; gap: 8px; flex-wrap: wrap; width: 100%;
}
.pill {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.pill:hover { background: var(--surface-hover); color: var(--text); }
.pill.active {
    background: var(--accent-grad);
    color: #fff;
    border-color: transparent;
}

/* ===== Plan Cards ===== */
.plans-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
}
@media (min-width: 480px) {
    .plans-grid { grid-template-columns: 1fr 1fr; }
}

.plan-card {
    display: flex; flex-direction: column;
    gap: 14px;
    padding: 20px;
}
.plan-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.plan-header {
    display: flex; justify-content: space-between; align-items: center;
}
.plan-name {
    font-size: 18px; font-weight: 700;
}
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-shared { background: rgba(0,212,170,0.15); color: var(--accent-1); }
.badge-dedicated { background: rgba(124,92,252,0.15); color: var(--accent-2); }
.badge-pro { background: rgba(255,159,10,0.15); color: var(--warning); }

.plan-specs {
    display: flex; flex-direction: column; gap: 6px;
}
.spec-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-dim);
}
.spec-icon { font-size: 14px; width: 20px; text-align: center; }

.plan-footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}
.plan-location {
    font-size: 12px; color: var(--text-dim); font-weight: 500;
}
.plan-price {
    font-size: 20px; font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.plan-price span {
    font-size: 12px; font-weight: 400;
    -webkit-text-fill-color: var(--text-dim);
}

.stock-badge {
    font-size: 11px; padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.in-stock { background: rgba(52,199,89,0.15); color: var(--success); }
.out-of-stock { background: rgba(255,69,58,0.15); color: var(--danger); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px; font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-full { width: 100%; }
.btn-sm { padding: 10px 16px; font-size: 13px; }

.btn-primary {
    background: var(--accent-grad);
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

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

.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-disabled {
    background: var(--surface);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block; font-size: 13px; color: var(--text-dim);
    margin-bottom: 8px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
    border-color: rgba(0,212,170,0.3);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.06);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-select option { background: var(--bg-2); color: var(--text); }
.form-select-sm { width: auto; padding: 8px 14px; font-size: 13px; }

/* ===== Card Titles ===== */
.card-title {
    font-size: 16px; font-weight: 700;
    margin-bottom: 16px;
}

/* ===== Price Display ===== */
.price-display {
    text-align: center;
    font-size: 14px;
    color: var(--text-dim);
    padding: 16px 0;
}
.price-amount {
    font-size: 28px; font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Payment ===== */
.payment-info {
    display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 20px;
}
.payment-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px;
}
.payment-label { color: var(--text-dim); }
.payment-value { font-weight: 600; }

.deposit-address-box {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    margin-bottom: 16px;
}
.deposit-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.deposit-address {
    font-family: var(--mono);
    font-size: 13px;
    word-break: break-all;
    margin-bottom: 12px;
    color: var(--accent-1);
}

.qr-box {
    display: flex; justify-content: center;
    margin-bottom: 16px;
}
.qr-box svg, .qr-box img.qr-img {
    border-radius: var(--radius-md);
    background: #fff;
    padding: 12px;
    max-width: 200px;
}

.deposit-memo-box {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    margin-bottom: 16px;
}

.payment-timer {
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
    padding: 8px 0;
}
.payment-timer span { color: var(--warning); font-weight: 600; font-family: var(--mono); }

/* ===== Status Badges ===== */
.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600;
    text-transform: capitalize;
}
.status-active { background: rgba(52,199,89,0.15); color: var(--success); }
.status-provisioning { background: rgba(255,159,10,0.15); color: var(--warning); }
.status-suspended, .status-failed { background: rgba(255,69,58,0.15); color: var(--danger); }
.status-terminated { background: rgba(75,85,99,0.15); color: var(--text-muted); }
.status-awaiting_payment, .status-awaiting { background: rgba(124,92,252,0.15); color: var(--accent-2); }
.status-paid { background: rgba(0,212,170,0.15); color: var(--accent-1); }
.status-completed { background: rgba(52,199,89,0.15); color: var(--success); }
.status-expired { background: rgba(75,85,99,0.15); color: var(--text-muted); }

/* ===== Server Cards ===== */
.server-card {
    display: block; text-decoration: none; color: inherit;
    cursor: pointer;
}
.server-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
}

.server-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.server-hostname {
    font-size: 17px; font-weight: 700;
}
.server-card-details {
    display: flex; flex-direction: column; gap: 4px;
}
.server-ip {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--accent-1);
}
.server-meta {
    font-size: 12px;
    color: var(--text-dim);
}
.expiring-warning {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,159,10,0.12);
    color: var(--warning);
    font-size: 12px; font-weight: 600;
}
.expiring-critical { background: rgba(255,69,58,0.12); color: var(--danger); }

/* ===== Server Detail ===== */
.server-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.server-detail-header h2 { font-size: 20px; font-weight: 800; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.info-value { font-size: 14px; font-weight: 500; }
.ip-copyable { cursor: pointer; color: var(--accent-1); }
.ip-copyable:hover { opacity: 0.8; }
.copy-icon { font-size: 12px; opacity: 0.5; }

/* ===== Credentials ===== */
.credentials-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.cred-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0;
}
.cred-row + .cred-row { border-top: 1px solid var(--glass-border); }
.cred-label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.cred-value {
    font-family: var(--mono);
    font-size: 14px;
    cursor: pointer;
    color: var(--accent-1);
}
.cred-value:hover { opacity: 0.8; }

/* ===== Power Controls ===== */
.power-btns, .mgmt-btns {
    display: flex; gap: 10px; flex-wrap: wrap;
}
.power-btns .btn { flex: 1; min-width: 80px; }
.mgmt-btns { flex-direction: column; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-card {
    max-width: 400px; width: 100%;
}
.modal-card h3 { margin-bottom: 12px; font-size: 18px; }
.modal-card p { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; }
.modal-actions {
    display: flex; gap: 10px;
}
.modal-actions .btn { flex: 1; }

/* ===== Plan Summary ===== */
.plan-summary-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.plan-summary-header h3 { font-size: 18px; font-weight: 700; }
.plan-specs-inline {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.plan-specs-inline span {
    padding: 4px 10px;
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--text-dim);
}

/* ===== Empty / Loading ===== */
.loading-state, .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 14px;
}
.empty-state-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state-card h3 { font-size: 18px; color: var(--text); }
.empty-state-card p { color: var(--text-dim); font-size: 14px; }
.empty-icon { font-size: 48px; opacity: 0.3; }

/* ===== Admin ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}
.stat-card {
    text-align: center;
    padding: 16px;
}
.stat-value {
    font-size: 22px; font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}
.admin-table th {
    text-align: left;
    padding: 10px 8px;
    font-size: 11px; font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}
.admin-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.admin-table code { font-family: var(--mono); font-size: 12px; color: var(--accent-1); }

.filter-row {
    display: flex; gap: 8px; align-items: center;
    margin-top: 12px;
}

.pagination {
    display: flex; gap: 4px; justify-content: center;
    margin-top: 12px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%; transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast-notification {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500;
    backdrop-filter: blur(10px);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s;
    min-width: 200px;
    text-align: center;
}
.toast-success { background: rgba(52,199,89,0.9); color: #fff; }
.toast-error { background: rgba(255,69,58,0.9); color: #fff; }
.toast-info { background: rgba(124,92,252,0.9); color: #fff; }

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

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-dim { color: var(--text-dim); font-size: 13px; }
