/* Svenn Site Admin Dashboard */

/* ── Poppins Font ── */

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-hover: #ebebef;
  --border: #e0e0e8;
  --border-hover: #c8c8d4;
  --text: #1a1a2e;
  --text-secondary: #4a4a5c;
  --text-muted: #8888a0;
  --primary: #E93D82;
  --primary-hover: #D32D6C;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 0;
  min-height: 100vh;
}

/* ── Header ── */

.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header .logo {
  height: 32px;
  width: auto;
}

.app-header .subtitle {
  color: var(--warning);
  font-size: 0.85rem;
  font-weight: 500;
}

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header .header-right a {
  text-decoration: none;
}

/* ── Layout ── */

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.sa-loading {
  text-align: center;
  padding: 80px 20px;
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}

/* ── Buttons ── */

button, .btn {
  display: inline-block;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* ── Tables ── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover {
  background: var(--surface-hover);
}

/* ── Badges ── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-past_due { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-canceled { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-none { background: rgba(120, 120, 138, 0.15); color: var(--text-muted); }
.badge-trialing { background: rgba(233, 61, 130, 0.15); color: var(--primary); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-completed { background: rgba(120, 120, 138, 0.15); color: var(--text-muted); }
.badge-calculated { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-processing { background: rgba(233, 61, 130, 0.15); color: var(--primary); }
.badge-paid { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Analytics Grid ── */

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.analytics-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.analytics-value {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Tickets ── */

.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.ticket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.ticket-header strong {
  font-size: 0.9rem;
  display: block;
}

.ticket-provider-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ticket-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.ticket-response {
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ticket-response-provider {
  background: rgba(233, 61, 130, 0.08);
  border-left: 3px solid var(--primary);
}

.ticket-response-admin {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--success);
}

.ticket-response-from {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.ticket-response p {
  color: var(--text-secondary);
  margin: 0;
}

.ticket-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.ticket-reply {
  display: flex;
  gap: 8px;
  flex: 1;
}

.ticket-reply input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.ticket-reply input:focus {
  outline: none;
  border-color: var(--primary);
}

.ticket-reply .btn {
  white-space: nowrap;
}

/* ── Misc ── */

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

/* ── Toast ── */

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 24px;
  border-radius: var(--radius);
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }

/* ── Responsive ── */

@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ticket-header {
    flex-direction: column;
  }

  .ticket-actions {
    flex-direction: column;
  }
}

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
