/* Pelaikan Account Page Styles */

:root {
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --bg-sidebar: #1f2937;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --rubric-primary: #b91c1c;
  --rubric-secondary: #991b1b;
  --rubric-light: #fecaca;
  --positive: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  height: 64px;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo { text-decoration: none; }

.logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--rubric-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 13px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--rubric-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--rubric-secondary);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-alt);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Account Layout */
.account-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 64px;
}

/* Sidebar */
.account-sidebar {
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  width: 280px;
  background: var(--bg-sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  background: var(--rubric-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: white;
}

.user-plan {
  font-size: 12px;
  color: var(--text-light);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.sidebar-link.active {
  background: rgba(185, 28, 28, 0.2);
  color: white;
  border-left-color: var(--rubric-primary);
}

.sidebar-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.back-to-app {
  color: var(--text-light);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.back-to-app:hover { color: white; }

/* Main Content */
.account-main {
  flex: 1;
  margin-left: 280px;
  padding: 32px 40px;
  max-width: 900px;
}

.account-section {
  display: none;
}

.account-section.active {
  display: block;
}

.section-header {
  margin-bottom: 32px;
}

.section-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

/* Content Cards */
.content-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.content-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--rubric-primary);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.form-input:disabled {
  background: var(--bg-alt);
  cursor: not-allowed;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.save-status {
  font-size: 13px;
  color: var(--positive);
}

.account-date {
  font-size: 14px;
  color: var(--text-muted);
}

/* Credits Section */

/* Credit Balance Card */
.credit-balance-card {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
  border: 2px solid var(--rubric-light);
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.balance-header h3 {
  margin: 0;
}

.balance-display {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.balance-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.balance-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--rubric-primary);
  line-height: 1;
}

.balance-remaining {
  font-size: 16px;
  color: var(--text-muted);
}

.balance-limit {
  font-size: 14px;
  color: var(--text-muted);
}

/* Credit Progress Bar */
.credit-progress-container {
  margin-bottom: 20px;
}

.credit-progress-bar {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.credit-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rubric-primary), var(--rubric-secondary));
  border-radius: 6px;
  transition: width 0.5s ease, background-color 0.3s ease;
}

.credit-progress-fill.warning {
  background: linear-gradient(90deg, var(--warning), #b45309);
}

.credit-progress-fill.low {
  background: linear-gradient(90deg, var(--danger), #991b1b);
}

.credit-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.credit-warning,
.credit-blocked {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 16px;
}

.credit-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.credit-blocked {
  background: #fee2e2;
  border: 1px solid #ef4444;
  color: #991b1b;
}

/* Usage Section */
.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.usage-header h3 {
  margin: 0;
}

.usage-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.usage-date-range input {
  width: 140px;
  padding: 8px 10px;
  font-size: 13px;
}

.usage-date-range span {
  color: var(--text-muted);
  font-size: 13px;
}

.usage-summary {
  min-height: 60px;
}

.usage-loading,
.usage-error {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}

.usage-error {
  color: var(--danger);
}

.usage-total-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.total-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.total-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--rubric-primary);
}

/* Usage by Type */
.usage-by-type {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.usage-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.type-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
}

.type-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.type-cost {
  font-size: 16px;
  font-weight: 700;
  color: var(--rubric-primary);
  min-width: 80px;
  text-align: right;
}

.type-calls {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

/* Documents Section */
.docs-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
}

.docs-list {
  margin-bottom: 20px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: all 0.2s;
}

.doc-item:hover:not(.placeholder) {
  border-color: var(--rubric-primary);
  box-shadow: var(--shadow);
}

.doc-item.placeholder { opacity: 0.4; }

.doc-icon { font-size: 28px; }

.doc-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.doc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.doc-date {
  font-size: 12px;
  color: var(--text-muted);
}

.doc-actions {
  display: flex;
  gap: 8px;
}

/* Pricing Section */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.pricing-card {
  position: relative;
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pricing-card.featured {
  border-color: var(--rubric-primary);
  border-width: 2px;
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rubric-primary);
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.pricing-header {
  margin-bottom: 24px;
}

.pricing-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.pricing-price {
  font-size: 42px;
  font-weight: 700;
  color: var(--rubric-primary);
  line-height: 1;
}

.pricing-period {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}

.pricing-features li {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.pricing-features li:last-child { border-bottom: none; }

.pricing-features li::before {
  content: "✓";
  color: var(--positive);
  margin-right: 10px;
  font-weight: 700;
}

/* Referral Box */
.promo-card {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.referral-box {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.referral-box .form-input {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
}

/* Danger Zone */
.danger-zone {
  border-color: var(--danger);
  background: #fef2f2;
}

.danger-zone h3 {
  color: var(--danger);
}

/* Placeholder & Notes */
.placeholder-text {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.coming-soon-note {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
}

/* Auth Required Overlay */
.auth-required-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.auth-required-modal {
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  max-width: 400px;
}

.auth-required-modal h2 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--rubric-primary);
}

.auth-required-modal p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
  .account-sidebar { width: 240px; }
  .account-main { margin-left: 240px; padding: 24px; }
  .credits-overview { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .account-sidebar {
    position: relative;
    width: 100%;
    top: 0;
  }
  .account-main {
    margin-left: 0;
    padding: 20px;
  }
  .credits-overview { grid-template-columns: 1fr; }
  .docs-toolbar { flex-direction: column; }
  .doc-item { flex-wrap: wrap; }
  .doc-actions { width: 100%; margin-top: 12px; }
}

/* === Documents Section === */

/* Stats Card */
.stats-card {
  background: linear-gradient(135deg, #f9fafb 0%, #fff 100%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--rubric-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Documents List */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.docs-loading,
.docs-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.docs-empty .empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

.docs-empty h3 {
  font-size: 18px;
  color: var(--text);
}

.docs-empty p {
  font-size: 14px;
}

.docs-empty a {
  color: var(--rubric-primary);
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  transition: background 0.2s, box-shadow 0.2s;
}

.doc-item:hover {
  background: #f3f4f6;
  box-shadow: var(--shadow);
}

.doc-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.doc-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.doc-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.ocr-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.doc-date {
  font-size: 12px;
  color: var(--text-light);
}

.doc-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Reports Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Reports List */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reports-loading,
.reports-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.report-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.report-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.report-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.report-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.report-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.report-date {
  font-size: 12px;
  color: var(--text-light);
}

.report-actions {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .modal-content {
    max-height: 90vh;
  }
  
  .report-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .report-actions {
    width: 100%;
    margin-top: 8px;
  }
  
  .report-actions .btn {
    width: 100%;
  }
}

