/* RetailNode Universal Support Desk — Official Enterprise Light Theme */
:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-light: #eff6ff;
  --brand-gradient: linear-gradient(135deg, #0052D4 0%, #4364F7 100%);
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   LOGIN SCREEN (Enterprise Light)
   ========================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.official-logo-login {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sso-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-primary-light);
  border: 1px solid #bfdbfe;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #1d4ed8;
  font-weight: 500;
  margin-bottom: 1.25rem;
  text-align: left;
}

.sso-banner svg {
  flex-shrink: 0;
  color: var(--brand-primary);
}

.login-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-weight: 500;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid #cbd5e1;
  color: var(--text-body);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--text-body);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

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

.btn-success:hover {
  background: #047857;
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =========================================================
   DASHBOARD LAYOUT (Enterprise Light)
   ========================================================= */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.official-navbar-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.support-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.platform-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid #bfdbfe;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* =========================================================
   CONTENT & TOOLBAR
   ========================================================= */
.content-container {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

.search-box .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.3rem;
  background: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.filter-group select {
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--brand-primary);
}

/* =========================================================
   TICKETS TABLE
   ========================================================= */
.tickets-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-card {
  width: 100%;
  overflow-x: auto;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.tickets-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.tickets-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: middle;
}

.tickets-table tbody tr:hover {
  background: #f8fafc;
}

.tkt-link {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
}

.tkt-link:hover {
  text-decoration: underline;
}

.client-name {
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

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

.subject-text {
  font-weight: 500;
  color: var(--text-main);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Badges & Status Pills */
.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-open {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-in_progress {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-resolved {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-closed {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.priority-pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.priority-urgent {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.priority-high {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.priority-medium {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.priority-low {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.platform-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* =========================================================
   MODAL & THREAD VIEW (Enterprise Light)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

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

.modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg {
  max-width: 780px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.tkt-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tkt-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--brand-primary);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.modal-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Call Audio Player Box */
.call-audio-box {
  background: var(--brand-primary-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.audio-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1d4ed8;
}

/* Thread Messages */
.messages-stream {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.chat-bubble,
.msg-bubble {
  max-width: 82%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.bubble-client,
.msg-client {
  align-self: flex-start;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
}

.bubble-agent,
.msg-agent {
  align-self: flex-end;
  background: var(--brand-primary-light);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.bubble-system,
.msg-system {
  align-self: center;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  font-size: 0.78rem;
  text-align: center;
}

.bubble-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Admin Resolution Box */
.admin-controls-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.admin-controls-card h4 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.status-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Reply Form */
.reply-form {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.reply-form textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  resize: vertical;
  margin-bottom: 0.65rem;
  font-family: var(--font-sans);
}

.reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

/* Media Queries */
@media (max-width: 768px) {
  .navbar {
    padding: 0.75rem 1rem;
  }
  .content-container {
    padding: 1rem;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
}
