/* ── AkLite Pay — Mobile-First Premium Design ────────────────── */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-bg: rgba(99, 102, 241, 0.08);
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --blue-bg: #eff6ff;
    --text: #0f172a;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

.state { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Loading ──────────────────────────────────── */
.loading-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; flex: 1; gap: 16px;
}
.spinner {
    width: 48px; height: 48px; border-radius: 50%;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Typography ───────────────────────────────── */
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 14px; }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }

/* ── Cards ────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}
.card-header { margin-bottom: 16px; }
.card-header h3 { margin-bottom: 4px; }

.error-card, .paid-card {
    max-width: 400px; margin: auto; text-align: center; padding: 40px 24px;
}
.icon-circle {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.icon-error { background: var(--error-bg); color: var(--error); }
.icon-success { background: var(--success-bg); color: var(--success); }
.icon-white { background: rgba(255,255,255,0.2); color: white; }

/* ── Status Headers ───────────────────────────── */
.status-header {
    padding: 40px 24px 32px; text-align: center; color: white;
}
.status-header h1 { margin-top: 16px; }
.status-header p { opacity: 0.85; font-size: 14px; margin-top: 4px; }
.status-success { background: linear-gradient(135deg, var(--success), #059669); }
.status-pending { background: linear-gradient(135deg, var(--warning), #ea580c); }
.status-rejected { background: linear-gradient(135deg, var(--error), #e11d48); }

/* ── Content Area ─────────────────────────────── */
.content-area { padding: 20px 16px; max-width: 480px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.content-offset { margin-top: -12px; }

/* ── Org Header ───────────────────────────────── */
.org-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; padding: 20px 16px;
}
.org-header-inner {
    max-width: 480px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
}
.org-avatar {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.org-info h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-info p { font-size: 14px; opacity: 0.8; }

/* ── Invoice Card ─────────────────────────────── */
.student-row { display: flex; align-items: center; gap: 12px; }
.student-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.student-info { flex: 1; min-width: 0; }
.student-info strong { display: block; font-size: 15px; }
.student-info span { font-size: 13px; }
.amount-box {
    background: linear-gradient(135deg, var(--primary-bg), rgba(99,102,241,0.12));
    border-radius: var(--radius-sm); padding: 16px; text-align: center; margin: 16px 0;
}
.amount-box .amount { font-size: 32px; font-weight: 700; color: var(--primary); }
.amount-box .text-muted { font-size: 12px; }

/* ── Steps ────────────────────────────────────── */
.steps { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.step.active { color: var(--primary); }
.step.active .step-num { background: var(--primary); color: white; border-color: var(--primary); }
.step-num {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid var(--border); display: flex;
    align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; transition: all 0.2s;
}
.step-line { width: 32px; height: 2px; background: var(--border); }

/* ── QR Code ──────────────────────────────────── */
.qr-container { display: flex; justify-content: center; padding: 8px 0 16px; }
.qr-container canvas { border-radius: 8px; }

/* ── UPI Copy ─────────────────────────────────── */
.upi-copy-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.upi-copy-row code { flex: 1; font-size: 14px; font-weight: 600; word-break: break-all; }
.btn-icon {
    background: none; border: none; cursor: pointer;
    padding: 6px; border-radius: 6px; color: var(--text-muted);
    transition: background 0.2s;
}
.btn-icon:hover { background: var(--border); }

/* ── Summary Card ─────────────────────────────── */
.summary-card {
    background: var(--bg); border-radius: var(--radius-sm);
    padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.summary-row span:first-child { color: var(--text-muted); }

/* ── Badges ───────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-overdue { background: var(--error-bg); color: var(--error); }
.badge-pending { background: var(--warning-bg); color: #92400e; }

/* ── Info / Alert Boxes ───────────────────────── */
.info-box {
    display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-sm);
    font-size: 13px; align-items: flex-start;
}
.info-box svg { flex-shrink: 0; margin-top: 1px; }
.info-blue { background: var(--blue-bg); color: #1e40af; }
.info-amber { background: var(--warning-bg); color: #92400e; }

.alert { padding: 12px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-error { background: var(--error-bg); color: #991b1b; border: 1px solid #fecaca; }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: var(--radius-sm); border: none;
    font-family: inherit; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-outline { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-ghost { background: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row { display: flex; gap: 12px; margin-top: 8px; }
.btn-row .btn:last-child { flex: 1; }

/* ── Form ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; }
.form-group input {
    height: 48px; padding: 0 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 15px;
    outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); }
.form-group small { font-size: 11px; }

.divider-or {
    display: flex; align-items: center; gap: 12px; margin: 8px 0;
}
.divider-or::before, .divider-or::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider-or span { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── Screenshot Upload ────────────────────────── */
.upload-area {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 24px; border: 2px dashed var(--border); border-radius: var(--radius-sm);
    cursor: pointer; color: var(--text-muted); transition: all 0.2s;
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); }
.upload-area small { font-size: 11px; }

.screenshot-preview { position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.screenshot-preview img { width: 100%; max-height: 200px; object-fit: cover; }
.btn-remove {
    position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
    border-radius: 50%; background: rgba(0,0,0,0.6); color: white;
    border: none; cursor: pointer; font-size: 14px; display: flex;
    align-items: center; justify-content: center;
}

/* ── Footer ───────────────────────────────────── */
.footer {
    text-align: center; padding: 20px; font-size: 11px;
    color: var(--text-muted); display: flex; align-items: center;
    justify-content: center; gap: 4px;
}

/* ── Toast Notification ───────────────────────── */
.toast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: white; padding: 10px 20px;
    border-radius: 8px; font-size: 14px; font-weight: 500;
    z-index: 1000; animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
