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

:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

/* NAVBAR */
.navbar { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-weight: 600; font-size: 17px; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--text-muted); font-size: 14px; transition: all 0.15s; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link-primary { background: var(--primary); color: white !important; font-weight: 500; }
.nav-link-primary:hover { background: var(--primary-dark); }
.nav-link-logout { color: var(--danger) !important; }
.credit-badge { background: #ede9fe; color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.navbar-admin { background: #1a1a2e; border-color: #2d2d4e; }
.navbar-admin .nav-brand, .navbar-admin .nav-link { color: #c8c8e8; }
.navbar-admin .nav-link:hover { background: #2d2d4e; color: white; }
.admin-tag { background: #6C63FF; color: white; font-size: 11px; padding: 2px 7px; border-radius: 5px; margin-left: 4px; }
.nav-link-active { color: white !important; }

/* PAGE */
.page-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-container-narrow { max-width: 680px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 600; }
.page-subtitle { color: var(--text-muted); margin-top: 4px; }

/* CARDS */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.card-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card-primary { border-color: var(--primary); background: #f5f3ff; }
.stat-card-warning { border-color: var(--warning); background: #fffbeb; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-card-primary .stat-value { color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.stat-action { font-size: 13px; color: var(--primary); text-decoration: none; display: inline-block; margin-top: 8px; }
.stat-card-action { display: flex; align-items: center; justify-content: center; }
.big-action-btn { background: var(--primary); color: white; border-radius: var(--radius); padding: 16px 24px; text-decoration: none; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; text-align: center; transition: background 0.15s; }
.big-action-btn:hover { background: var(--primary-dark); }
.big-action-icon { font-size: 28px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: #94a3b8; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-full { width: 100%; }
.btn-large { padding: 13px 28px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert a { color: inherit; font-weight: 600; }

/* AUTH */
.auth-body { background: linear-gradient(135deg, #667eea15, #764ba215); min-height: 100vh; display: flex; align-items: center; }
.auth-container { width: 100%; padding: 24px; display: flex; justify-content: center; }
.auth-card { background: white; border-radius: 14px; border: 1px solid var(--border); padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.auth-card-wide { max-width: 560px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { font-size: 40px; margin-bottom: 10px; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* FORMS */
.auth-form, .form-group { display: flex; flex-direction: column; gap: 14px; }
.form-group { gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-group input, .form-group select, .form-group textarea { padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.terms-box { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-muted); }
.terms-box a { color: var(--primary); }

/* GENERATE PAGE */
.generate-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .generate-layout { grid-template-columns: 1fr; } }
.generate-col { display: flex; flex-direction: column; }

/* UPLOAD ZONES */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; position: relative; transition: border-color 0.15s; min-height: 160px; display: flex; align-items: center; justify-content: center; }
.upload-zone:hover { border-color: var(--primary); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone-sm { min-height: 110px; }
.upload-placeholder { pointer-events: none; }
.upload-icon { font-size: 28px; margin-bottom: 8px; }
.upload-placeholder p { font-size: 14px; font-weight: 500; }
.upload-placeholder span { font-size: 12px; color: var(--text-muted); }
.upload-preview { max-width: 100%; max-height: 200px; border-radius: 8px; object-fit: contain; }

/* POSE SELECTOR */
.pose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pose-option { border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 10px; text-align: center; cursor: pointer; transition: all 0.15s; }
.pose-option input { display: none; }
.pose-option:hover { border-color: var(--primary); }
.pose-option.selected { border-color: var(--primary); background: #f5f3ff; }
.pose-icon { font-size: 24px; margin-bottom: 6px; }
.pose-label { font-size: 13px; font-weight: 600; }
.pose-desc { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* BACKGROUND SELECTOR */
.bg-toggle { margin-bottom: 14px; }
.toggle-label { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle-switch { width: 36px; height: 20px; background: var(--border); border-radius: 10px; position: relative; transition: background 0.2s; flex-shrink: 0; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-option { border: 1.5px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; cursor: pointer; font-size: 12px; transition: all 0.15s; }
.bg-option input { display: none; }
.bg-option:hover { border-color: var(--primary); }
.bg-option.selected { border-color: var(--primary); background: #f5f3ff; color: var(--primary); font-weight: 500; }

/* SUBMIT CARD */
.card-submit { position: sticky; bottom: 16px; }
.submit-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.credit-cost { font-weight: 600; color: var(--text); }
.submit-note { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* TAGS */
.tag-optional { font-size: 11px; background: #f1f5f9; color: var(--text-muted); padding: 2px 7px; border-radius: 4px; font-weight: 400; }
.tag-required-mundi { font-size: 11px; background: #fef2f2; color: var(--danger); padding: 2px 7px; border-radius: 4px; font-weight: 500; }

/* RESULT PAGE */
.result-success, .result-failed, .result-processing { text-align: center; padding: 32px 16px; }
.result-header h1 { font-size: 24px; margin-bottom: 6px; }
.result-image-container { margin: 24px 0; }
.result-image { max-width: 100%; max-height: 600px; border-radius: var(--radius); box-shadow: var(--shadow); }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.result-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 20px; justify-content: center; }
.result-icon { font-size: 48px; margin-bottom: 16px; }
.error-detail { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* PROCESSING */
.processing-animation { position: relative; width: 80px; height: 80px; margin: 0 auto 24px; }
.processing-ring { width: 80px; height: 80px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.processing-saree { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing-steps { display: flex; flex-direction: column; gap: 8px; max-width: 280px; margin: 20px auto; }
.step { font-size: 13px; color: var(--text-muted); padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); }
.step.active { color: var(--primary); border-color: var(--primary); background: #f5f3ff; font-weight: 500; }
.processing-note { font-size: 12px; color: var(--text-muted); margin-top: 16px; }

/* IMAGE GRID */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.image-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.image-thumb { height: 180px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-thumb-processing { flex-direction: column; gap: 8px; color: var(--text-muted); font-size: 13px; }
.image-thumb-failed { background: #fef2f2; color: var(--danger); font-size: 13px; }
.processing-spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.image-card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.image-pose-tag { font-size: 11px; font-weight: 600; color: var(--primary); background: #f5f3ff; padding: 2px 8px; border-radius: 4px; display: inline-block; }
.image-date { font-size: 12px; color: var(--text-muted); }

/* PLANS */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 36px; }
.plan-card { background: white; border: 1.5px solid var(--border); border-radius: 12px; padding: 24px; position: relative; }
.plan-card-popular { border-color: var(--primary); }
.plan-badge { background: var(--primary); color: white; font-size: 11px; padding: 3px 10px; border-radius: 4px; display: inline-block; margin-bottom: 10px; }
.plan-name { font-size: 16px; font-weight: 600; }
.plan-price { font-size: 36px; font-weight: 700; color: var(--primary); margin: 8px 0 2px; }
.plan-credits { font-size: 15px; font-weight: 500; }
.plan-per { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.plan-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

/* TABLES */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* BADGES */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-suspended { background: #fee2e2; color: #b91c1c; }
.badge-recharge { background: #dcfce7; color: #15803d; }
.badge-deduction { background: #fee2e2; color: #b91c1c; }
.badge-refund { background: #dbeafe; color: #1d4ed8; }

/* SECTION */
.section { margin-top: 32px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { font-size: 18px; font-weight: 600; }
.link-more { font-size: 14px; color: var(--primary); text-decoration: none; }

/* MODALS */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box { background: white; border-radius: 14px; padding: 28px; max-width: 400px; width: 90%; position: relative; z-index: 1; }
.modal-box h3 { font-size: 18px; margin-bottom: 8px; }
.modal-box p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* FILTER TABS */
.filter-tabs { display: flex; gap: 4px; margin-top: 12px; }
.filter-tab { padding: 6px 14px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--text-muted); border: 1px solid var(--border); }
.filter-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* STATUS PAGES */
.status-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }

/* MISC */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }
