/* ============================================
   QR MANAGER - iOS 26 Liquid Glass Theme
   ============================================ */

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
    --bg-primary: #0b0b1e;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --bg-glass: rgba(255, 255, 255, 0.07);
    --bg-glass-strong: rgba(255, 255, 255, 0.1);
    --bg-input: rgba(255, 255, 255, 0.07);
    --border-subtle: rgba(255, 255, 255, 0.12);
    --border-glass: rgba(255, 255, 255, 0.18);
    --border-glass-light: rgba(255, 255, 255, 0.25);
    --border-focus: rgba(124, 58, 237, 0.5);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a8b8;
    --text-muted: #6b7280;
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --gradient-primary: linear-gradient(135deg, #7c3aed, #06b6d4);
    --gradient-card: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(6,182,212,0.04));
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px rgba(124,58,237,0.12);
    --shadow-glass: 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --blur-glass: blur(40px);
    --blur-glass-light: blur(24px);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 100% 80% at 50% -20%, rgba(124,58,237,0.18) 0%, transparent 60%),
        radial-gradient(ellipse 80% 50% at 20% 80%, rgba(6,182,212,0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(16,185,129,0.06) 0%, transparent 50%);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ---------- Top Accent Line ---------- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #06b6d4, #10b981, #06b6d4, #7c3aed);
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
    z-index: 200;
}

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

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 3px;
    z-index: 100;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    display: flex;
    align-items: center;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.4));
    transition: filter 0.3s ease;
}

.logo:hover .logo-icon {
    filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.6));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa, #7c3aed, #06b6d4, #22d3ee);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    animation: gradientFlow 4s ease infinite;
    line-height: 1.2;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.logo-tagline {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(124,58,237,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(124,58,237,0.5);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

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

.btn-outline:hover {
    background: rgba(6,182,212,0.1);
}

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

.btn-danger:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-icon.copy:hover { color: var(--accent); border-color: rgba(6,182,212,0.3); }
.btn-icon.edit:hover { color: var(--warning); border-color: rgba(245,158,11,0.3); }
.btn-icon.delete:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); }
.btn-icon.view:hover { color: var(--primary-light); border-color: rgba(124,58,237,0.3); }

/* ---------- Main Content ---------- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ---------- Stats Section ---------- */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: var(--blur-glass-light);
    -webkit-backdrop-filter: var(--blur-glass-light);
    border: 1px solid var(--border-glass);
    border-top: 1px solid var(--border-glass-light);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    animation: slideUp 0.5s ease both;
    box-shadow: var(--shadow-glass);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}

.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-total { background: rgba(124,58,237,0.15); color: var(--primary-light); }
.stat-icon-bank { background: rgba(6,182,212,0.15); color: var(--accent); }
.stat-icon-custom { background: rgba(16,185,129,0.15); color: var(--success); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- Filter Section ---------- */
.filter-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-wrapper {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 16px 11px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
    background: rgba(255,255,255,0.08);
}

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

.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.filter-tab {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.filter-tab:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

/* ---------- Cards Grid ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    perspective: 1200px;
}

.account-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 50%, rgba(124,58,237,0.05) 100%);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: cardFloat 0.6s ease both;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.2),
        0 12px 40px rgba(0,0,0,0.25),
        0 20px 60px rgba(124,58,237,0.08),
        inset 0 1px 1px rgba(255,255,255,0.2),
        inset 0 -1px 1px rgba(0,0,0,0.1);
    transform-style: preserve-3d;
    transform: translateZ(0);
}

/* Top highlight shimmer */
.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(124,58,237,0.4) 20%, 
        rgba(255,255,255,0.6) 50%, 
        rgba(6,182,212,0.4) 80%, 
        transparent 100%);
    z-index: 10;
}

/* Colored glow aura underneath */
.account-card::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 10%;
    right: 10%;
    height: 60px;
    background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(6,182,212,0.2));
    filter: blur(30px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
    transition: all 0.4s ease;
}

.account-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255,255,255,0.35);
    box-shadow:
        0 8px 24px rgba(0,0,0,0.2),
        0 20px 60px rgba(0,0,0,0.3),
        0 30px 80px rgba(124,58,237,0.15),
        0 0 80px rgba(124,58,237,0.08),
        inset 0 1px 2px rgba(255,255,255,0.3),
        inset 0 -1px 1px rgba(0,0,0,0.1);
}

.account-card:hover::after {
    opacity: 1;
    bottom: -25px;
    filter: blur(35px);
}

@keyframes cardFloat {
    0% { opacity: 0; transform: translateY(30px) scale(0.92) rotateX(5deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0); }
}

.account-card:nth-child(2) { animation-delay: 0.1s; }
.account-card:nth-child(3) { animation-delay: 0.2s; }
.account-card:nth-child(4) { animation-delay: 0.3s; }

/* Badge */
.card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 5;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
}

.card-badge.bank {
    background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(6,182,212,0.08));
    color: #67e8f9;
    border: 1px solid rgba(6,182,212,0.35);
}

.card-badge.custom {
    background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(16,185,129,0.08));
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.35);
}

/* QR Section */
.card-qr-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: linear-gradient(180deg, rgba(124,58,237,0.06) 0%, rgba(6,182,212,0.04) 50%, rgba(0,0,0,0.05) 100%);
    min-height: 220px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card-qr-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(124,58,237,0.08) 0%, transparent 50%),
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(6,182,212,0.06) 0%, transparent 40%);
}

.card-qr-section:hover::after {
    content: 'Xem lớn';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card-qr-img {
    width: 170px;
    height: 170px;
    object-fit: contain;
    border-radius: 16px;
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 8px;
    box-shadow: 
        0 4px 16px rgba(0,0,0,0.15),
        0 8px 32px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

/* Card Info */
.card-info {
    padding: 20px 22px;
    position: relative;
}

.card-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* ---- Account Holder Name (Hero) ---- */
.card-holder-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    -webkit-text-fill-color: #fff;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
    line-height: 1.3;
    text-transform: uppercase;
    text-shadow: 0 2px 12px rgba(124,58,237,0.25), 0 0 20px rgba(124,58,237,0.1);
}

.card-holder-icon {
    flex-shrink: 0;
    color: var(--primary-light);
    stroke: var(--primary-light);
    opacity: 0.8;
    filter: drop-shadow(0 0 4px rgba(124,58,237,0.3));
}

.card-bank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-bank-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-bank-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.card-account-no {
    font-size: 1rem;
    font-weight: 700;
    color: #67e8f9;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    text-shadow: 0 0 12px rgba(6,182,212,0.2);
}

.card-stk-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-right: 6px;
    font-family: var(--font);
}

.card-account-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.card-label {
    display: inline-block;
    padding: 5px 14px;
    background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(124,58,237,0.05));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #c4b5fd;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(124,58,237,0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-custom-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-custom-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 8px;
    padding: 16px 22px 20px;
    margin-top: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
    border-top: 1px solid rgba(255,255,255,0.08);
}

.card-actions .btn-icon {
    flex: 1;
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.card-actions .btn-icon:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.08));
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.6s ease;
}

.empty-icon {
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.empty-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeOverlay 0.2s ease;
}

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

@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.25s ease;
}

.modal-small {
    max-width: 400px;
}

.modal-qr-fullview {
    max-width: 440px;
    text-align: center;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 0;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body .text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* ---------- Forms ---------- */
form {
    padding: 20px 24px 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
    background: rgba(255,255,255,0.08);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.bank-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.bank-logo-preview {
    position: absolute;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    background: #fff;
    z-index: 1;
}

.bank-select-wrapper select {
    padding-left: 42px;
}

.bank-select-wrapper .bank-logo-preview[style*="display: none"] ~ select {
    padding-left: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* ---------- QR Preview ---------- */
.qr-preview {
    text-align: center;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.qr-preview h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.qr-preview img {
    max-width: 200px;
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 4px;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-glass);
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-light);
    background: rgba(124,58,237,0.05);
}

.upload-placeholder {
    color: var(--text-secondary);
}

.upload-placeholder svg {
    margin-bottom: 12px;
    color: var(--text-muted);
}

.upload-placeholder p {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.upload-placeholder strong {
    color: var(--accent);
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-preview-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* ---------- QR Full View ---------- */
.qr-fullview-content {
    padding: 24px;
}

.qr-fullview-content img {
    max-width: 280px;
    width: 100%;
    border-radius: var(--radius-md);
    background: #fff;
    padding: 6px;
    margin-bottom: 16px;
}

.qr-view-info {
    margin-bottom: 20px;
}

.qr-view-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 4px 0;
}

.qr-view-info p strong {
    color: var(--text-primary);
}

.qr-view-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
}

.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast.info { background: linear-gradient(135deg, #5b21b6, #7c3aed); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 768px) {
    .header-content {
        height: auto;
        padding: 12px 0;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    .main-content {
        padding: 12px 10px;
    }

    .stats-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 10px 12px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .filter-section {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 16px;
    }

    .search-wrapper {
        width: 100%;
        min-width: unset;
    }

    .filter-tabs {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 10px;
        border-radius: var(--radius-lg);
    }

    .qr-view-actions {
        flex-direction: column;
    }

    .empty-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* Mobile – Compact 4-column grid */
@media (max-width: 640px) {
    body::before {
        height: 2px;
    }

    .header {
        top: 2px;
        padding: 0 10px;
    }

    .header-content {
        height: auto;
        padding: 8px 0;
        gap: 6px;
    }

    .logo-icon svg {
        width: 28px;
        height: 28px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .logo-tagline {
        font-size: 0.55rem;
        letter-spacing: 1.5px;
    }

    .header-actions .btn {
        padding: 7px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .header-actions .btn svg {
        width: 14px;
        height: 14px;
    }

    .main-content {
        padding: 10px 8px;
    }

    /* Stats: compact horizontal row */
    .stats-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-bottom: 10px;
    }

    .stat-card {
        padding: 8px 10px;
        gap: 8px;
        border-radius: 12px;
    }

    .stat-card::before { display: none; }

    .stat-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .stat-value {
        font-size: 1.1rem;
        letter-spacing: 0;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    /* Filter: compact */
    .filter-section {
        gap: 6px;
        margin-bottom: 10px;
    }

    .search-input {
        padding: 8px 12px 8px 36px;
        font-size: 16px; /* iOS requires 16px minimum to prevent auto-zoom */
    }

    .search-icon {
        left: 10px;
    }

    .search-icon svg {
        width: 16px;
        height: 16px;
    }

    .filter-tabs {
        padding: 3px;
    }

    .filter-tab {
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    /* ===== CARDS: 4-COLUMN COMPACT GRID ===== */
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        perspective: none;
    }

    .account-card {
        border-radius: 14px;
        box-shadow:
            0 2px 8px rgba(0,0,0,0.2),
            0 6px 20px rgba(0,0,0,0.15),
            inset 0 1px 0 rgba(255,255,255,0.15);
    }

    .account-card::before {
        height: 1px;
    }

    .account-card::after {
        display: none;
    }

    .account-card:hover {
        transform: translateY(-2px) scale(1.02);
    }

    /* Badge: tiny */
    .card-badge {
        top: 4px;
        right: 4px;
        padding: 2px 5px;
        font-size: 0.4rem;
        letter-spacing: 0.5px;
    }

    /* QR: very compact */
    .card-qr-section {
        padding: 8px;
        min-height: auto;
    }

    .card-qr-img {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
        padding: 3px;
        border-radius: 8px;
    }

    /* Info: minimal — only name visible */
    .card-info {
        padding: 6px 8px 4px;
    }

    .card-info::before {
        left: 6px;
        right: 6px;
    }

    .card-holder-name {
        font-size: 0.5rem;
        margin-bottom: 2px;
        gap: 3px;
        letter-spacing: 0;
    }

    .card-holder-icon {
        width: 10px;
        height: 10px;
    }

    .card-bank-row {
        padding: 3px 5px;
        margin-bottom: 3px;
        gap: 4px;
        border-radius: 6px;
    }

    .card-bank-logo {
        width: 12px;
        height: 12px;
        border-radius: 3px;
    }

    .card-bank-name {
        font-size: 0.45rem;
    }

    .card-account-no {
        font-size: 0.48rem;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
    }

    .card-stk-label {
        font-size: 0.38rem;
        margin-right: 2px;
    }

    .card-account-name {
        display: none;
    }

    .card-label {
        padding: 1px 5px;
        font-size: 0.4rem;
        border-radius: 50px;
    }

    .card-custom-label {
        font-size: 0.55rem;
        margin-bottom: 2px;
    }

    .card-custom-note {
        display: none;
    }

    /* Actions: tiny row */
    .card-actions {
        padding: 4px 6px 6px;
        gap: 3px;
    }

    .card-actions .btn-icon {
        width: auto;
        height: 24px;
        border-radius: 6px;
    }

    .card-actions .btn-icon svg {
        width: 12px;
        height: 12px;
    }

    /* Toast smaller */
    .toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: unset;
        font-size: 0.78rem;
        padding: 10px 14px;
    }

    /* Modal fullscreen on mobile */
    .modal {
        max-height: 95vh;
        margin: 8px;
        border-radius: 16px;
    }

    .modal-header {
        padding: 14px 16px 0;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 12px 16px;
    }

    form {
        padding: 12px 16px 16px;
    }

    .empty-state {
        padding: 40px 16px;
    }

    .empty-state h3 {
        font-size: 1.1rem;
    }

    .empty-state p {
        font-size: 0.85rem;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .card-holder-name {
        font-size: 0.48rem;
    }

    .card-badge {
        display: none;
    }
}
