/* ============================================================
   3CX Transcription Admin — Shared Styles
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg-primary:     #0b0f1a;
  --bg-secondary:   #111827;
  --bg-card:        rgba(17, 24, 39, 0.65);
  --bg-card-solid:  #151d2e;
  --bg-sidebar:     rgba(11, 15, 26, 0.92);
  --bg-input:       rgba(30, 41, 59, 0.7);
  --bg-hover:       rgba(38, 152, 255, 0.08);

  --border-color:   rgba(255, 255, 255, 0.06);
  --border-glow:    rgba(38, 152, 255, 0.25);

  --accent:         #2698ff;
  --accent-hover:   #4dacff;
  --accent-muted:   rgba(38, 152, 255, 0.15);

  --success:        #22c55e;
  --success-bg:     rgba(34, 197, 94, 0.12);
  --warning:        #f59e0b;
  --warning-bg:     rgba(245, 158, 11, 0.12);
  --danger:         #ef4444;
  --danger-bg:      rgba(239, 68, 68, 0.12);
  --info:           #06b6d4;
  --info-bg:        rgba(6, 182, 212, 0.12);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 14px rgba(0,0,0,0.35);
  --shadow-lg:      0 10px 40px rgba(0,0,0,0.45);
  --shadow-glow:    0 0 30px rgba(38, 152, 255, 0.08);

  --sidebar-width:  260px;
  --topbar-height:  0px;

  --transition-fast:   0.15s cubic-bezier(.4,0,.2,1);
  --transition-base:   0.25s cubic-bezier(.4,0,.2,1);
  --transition-slow:   0.4s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 10%, rgba(38,152,255,0.06), transparent),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(124,58,237,0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.18); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.3); }

/* ============================================================ LAYOUT */
.layout-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; position: relative; z-index: 1;
}

.layout-app {
  display: flex; min-height: 100vh; position: relative; z-index: 1;
}

/* ============================================================ SIDEBAR */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  display: flex; flex-direction: column;
  z-index: 100; transition: transform var(--transition-base);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 12px;
}

.sidebar-brand .brand-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 20px rgba(38,152,255,0.25);
}

.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand .brand-text span:first-child { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.sidebar-brand .brand-text span:last-child {
  font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px; margin-top: 2px;
}

.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}

.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius-md);
  font-size: 0.92rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition-fast); position: relative;
}

.sidebar-nav a:hover { color: var(--text-primary); background: var(--bg-hover); }

.sidebar-nav a.active { color: var(--accent); background: var(--accent-muted); }

.sidebar-nav a.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}

.sidebar-nav a svg, .sidebar-nav a .nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.sidebar-nav a.active svg, .sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-nav .nav-section {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 20px 16px 8px; font-weight: 600;
}

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border-color); }

.sidebar-footer a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius-md);
  font-size: 0.92rem; font-weight: 500; color: var(--danger);
  transition: all var(--transition-fast);
}

.sidebar-footer a:hover { background: var(--danger-bg); color: #f87171; }

.sidebar-toggle {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
  width: 42px; height: 42px; border-radius: var(--radius-md);
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  color: var(--text-primary); font-size: 20px; cursor: pointer;
  align-items: center; justify-content: center; backdrop-filter: blur(12px);
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 90;
}

/* ============================================================ MAIN CONTENT */
.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  padding: 36px 40px 60px; min-height: 100vh; position: relative;
}

.page-header { margin-bottom: 32px; animation: fadeInUp 0.5s ease; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.page-header p { font-size: 0.92rem; color: var(--text-secondary); }

/* ============================================================ GLASS CARD */
.glass-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover { border-color: var(--border-glow); box-shadow: var(--shadow-glow); }
.glass-card .card-body { padding: 24px; }

.glass-card .card-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.glass-card .card-header h2 { font-size: 1.05rem; font-weight: 600; }

/* ============================================================ STAT CARDS */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 32px;
}

.stat-card {
  position: relative; overflow: hidden; padding: 24px;
  animation: fadeInUp 0.5s ease backwards;
}

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

.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 16px;
}

.stat-card .stat-icon.blue   { background: var(--accent-muted); color: var(--accent); }
.stat-card .stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-icon.cyan   { background: var(--info-bg); color: var(--info); }
.stat-card .stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }

.stat-card .stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1.1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }

.stat-card::after {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 90px; height: 90px; border-radius: 50%; opacity: 0.07; pointer-events: none;
}

.stat-card:nth-child(1)::after { background: var(--accent); }
.stat-card:nth-child(2)::after { background: var(--success); }
.stat-card:nth-child(3)::after { background: var(--danger); }
.stat-card:nth-child(4)::after { background: var(--info); }

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left; padding: 14px 16px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-color); white-space: nowrap;
}

tbody td {
  padding: 14px 16px; font-size: 0.9rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color); vertical-align: middle;
}

tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 0.74rem; font-weight: 600;
  text-transform: capitalize; letter-spacing: 0.3px; white-space: nowrap;
}

.badge-completed, .badge-success   { background: var(--success-bg); color: var(--success); }
.badge-failed, .badge-error        { background: var(--danger-bg);  color: var(--danger); }
.badge-processing, .badge-pending  { background: var(--warning-bg); color: var(--warning); }
.badge-queued, .badge-info         { background: var(--info-bg);    color: var(--info); }
.badge-active                      { background: var(--success-bg); color: var(--success); }
.badge-inactive                    { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-md); font-family: inherit;
  font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none;
  transition: all var(--transition-fast); white-space: nowrap; line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #1d7de8); color: #fff;
  box-shadow: 0 2px 12px rgba(38,152,255,0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), #2698ff);
  box-shadow: 0 4px 20px rgba(38,152,255,0.35); transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) { border-color: var(--border-glow); background: rgba(38,152,255,0.08); }

.btn-danger {
  background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ============================================================ FORMS */
.form-group { margin-bottom: 20px; }

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

.form-control {
  width: 100%; padding: 11px 16px; font-family: inherit; font-size: 0.92rem;
  color: var(--text-primary); background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  outline: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }

select.form-control {
  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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}

.search-bar { position: relative; }
.search-bar input { padding-left: 40px; min-width: 260px; }
.search-bar svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}

.filter-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filter-row .form-control { max-width: 200px; }

/* ============================================================ MODAL */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); width: 90%; max-width: 520px;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97); transition: transform var(--transition-base);
}

.modal-backdrop.active .modal { transform: translateY(0) scale(1); }

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

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

.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 22px;
  cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px 28px; }

.modal-footer {
  padding: 0 28px 24px; display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================================ PAGINATION */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-top: 1px solid var(--border-color);
  flex-wrap: wrap; gap: 12px;
}

.pagination .page-info { font-size: 0.82rem; color: var(--text-muted); }
.pagination .page-buttons { display: flex; gap: 6px; }

.pagination .page-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--border-color); background: transparent;
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast);
}

.pagination .page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================================ LOGIN */
.login-card { width: 100%; max-width: 420px; animation: fadeInUp 0.6s ease; }
.login-card .card-body { padding: 40px; }

.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-bottom: 32px;
}

.login-logo .brand-icon {
  width: 48px; height: 48px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: 0 0 30px rgba(38,152,255,0.3);
}

.login-logo h1 { font-size: 1.4rem; font-weight: 700; }
.login-logo h1 span { color: var(--accent); }

.login-error {
  background: var(--danger-bg); color: var(--danger); padding: 10px 16px;
  border-radius: var(--radius-md); font-size: 0.85rem; margin-bottom: 16px;
  display: none; border: 1px solid rgba(239,68,68,0.15);
}

.login-error.show { display: block; animation: shake 0.4s ease; }

/* ============================================================ JOB DETAIL */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 28px;
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }

.detail-item .detail-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); font-weight: 600;
}

.detail-item .detail-value { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; }

.content-section { margin-top: 28px; }
.content-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; color: var(--text-primary); }

.content-box {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 20px 24px; font-size: 0.9rem;
  line-height: 1.8; color: var(--text-secondary); max-height: 500px; overflow-y: auto;
}

.content-box p { margin-bottom: 10px; }
.content-box p:last-child { margin-bottom: 0; }

/* ============================================================ SETTINGS */
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px;
}

.setting-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 0; border-bottom: 1px solid var(--border-color); gap: 16px;
}

.setting-row:last-child { border-bottom: none; }

.setting-row .setting-key {
  font-size: 0.82rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; min-width: 140px; flex-shrink: 0;
}

.setting-row .setting-value {
  font-size: 0.9rem; color: var(--text-primary); font-weight: 500;
  word-break: break-all; text-align: right;
}

/* ============================================================ EMPTY & LOADING */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state p { font-size: 0.92rem; }

.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border-color);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin: 40px auto;
}

.spinner-sm { width: 18px; height: 18px; border-width: 2px; margin: 0; display: inline-block; }

/* ============================================================ TOAST */
.toast-container {
  position: fixed; top: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}

.toast {
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 14px 20px; font-size: 0.88rem;
  color: var(--text-primary); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; min-width: 280px;
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.removing { animation: slideOutRight 0.3s ease forwards; }

/* ============================================================ ANIMATIONS */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(60px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ============================================================ UTILITY */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.hidden { display: none !important; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, rgba(148,163,184,0.08) 50%, var(--bg-input) 75%);
  background-size: 200% 100%; animation: pulse 1.5s ease-in-out infinite; border-radius: var(--radius-sm);
}

/* ============================================================ RESPONSIVE */
@media (max-width: 1024px) { .main-content { padding: 28px 24px 50px; } }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; padding: 70px 16px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-row .form-control { max-width: 100%; flex: 1; }
  .page-header h1 { font-size: 1.4rem; }
  .search-bar input { min-width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal { width: 95%; max-width: 95%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .pagination { flex-direction: column; align-items: flex-start; }
}
