/**
 * Secret Shopper — Light Theme (JustInventory Design System)
 * Based on admin_common.css from /root/inventory
 */

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

/* ============================================================
   CSS VARIABLES (light theme)
   ============================================================ */
:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --accent-blue: #2563eb;
  --success-green: #16a34a;
  --warning-yellow: #ca8a04;
  --danger-red: #dc2626;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ============================================================
   ADMIN TOP BAR
   ============================================================ */

.admin-topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #2563eb 100%);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.admin-topbar-mark {
  width: 10px;
  height: 36px;
  border-radius: 5px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  flex-shrink: 0;
}

.admin-topbar-title {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.admin-topbar-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  white-space: nowrap;
}

/* ============================================================
   ADMIN NAVIGATION
   ============================================================ */

.admin-nav {
  display: flex;
  align-items: center;
  position: relative;
}

.admin-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.admin-nav-item {
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  white-space: nowrap;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.admin-nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.admin-nav-logout {
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-left: 6px;
  white-space: nowrap;
  font-family: inherit;
}

.admin-nav-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Hamburger (hidden on desktop) */
.admin-nav-hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.admin-nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.admin-nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

.admin-nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.admin-nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   CONTENT WRAPPER
   ============================================================ */

.admin-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ============================================================
   ADMIN CARDS
   ============================================================ */

.admin-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.admin-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.admin-card-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-top: 4px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

button, .btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary, button:not(.admin-nav-logout):not(.admin-nav-hamburger):not(.btn-secondary):not(.btn-danger):not(.btn-small) {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white;
}

.btn-primary:hover, button:not(.admin-nav-logout):not(.admin-nav-hamburger):not(.btn-secondary):not(.btn-danger):not(.btn-small):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled, button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.btn-danger:hover { background: #fecaca; }

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.form-input, input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
  background: white;
  transition: all 0.2s;
}

.form-input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-admin, .badge-administrator { background: #dbeafe; color: #1e40af; }
.badge-manager { background: #e0e7ff; color: #4338ca; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ============================================================
   UTILITIES
   ============================================================ */

.text-muted { color: #64748b; }
.text-success { color: #16a34a; }
.text-warning { color: #ca8a04; }
.text-danger { color: #dc2626; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.profile-value {
  font-size: 15px;
  color: var(--text-primary);
  padding: 8px 0;
}

/* ============================================================
   SECRET SHOPPER SPECIFIC COMPONENTS
   ============================================================ */

/* Department Selector */
#department-select {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    outline: none;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

#department-select:hover {
    border-color: var(--accent-blue);
}

.department {
    background: white;
    border: 1px solid var(--border);
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.scheduler-datetime,
.scheduler-multiselect {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 10px;
    width: 270px;
    transition: border-color 0.2s;
}

.scheduler-datetime:hover,
.scheduler-multiselect:hover {
    border-color: var(--accent-blue);
}

/* Calls container */
.calls-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.call-record {
    background: var(--bg-hover);
    padding: 10px;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.4;
    transition: background 0.3s;
    border: 1px solid var(--border-light);
}

.call-record:hover {
    background: #e2e8f0;
    border-color: var(--border);
}

.transcript-container {
    margin-top: 5px;
    padding: 5px;
    background: var(--bg-hover);
    border-radius: 5px;
    font-family: Arial, sans-serif;
}

.transcript-line {
    margin-bottom: 3px;
}

.transcript-speaker {
    font-weight: bold;
    margin-right: 5px;
    color: var(--text-primary);
}

.transcript-message {
    font-weight: normal;
    color: var(--text-secondary);
}

/* Test call UI at top right corner */
.test-call-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stop-calls-top-right {
    position: absolute;
    top: 20px;
    right: 320px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.load-test-call-button {
    margin-bottom: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
}

.test-call-container {
    display: none;
    background: white;
    padding: 10px;
    border-radius: 8px;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.test-call-input {
    margin-right: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
}

.test-call-select {
    margin-right: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.send-test-call-button {
    padding: 8px 12px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background: var(--accent-blue);
    color: white;
}

/* Voice selection UI */
.voice-select-top-right {
    position: absolute;
    top: 20px;
    right: 155px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.select-voice-button {
    margin-bottom: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
}

.voice-container {
    display: none;
    background: white;
    padding: 10px;
    border-radius: 8px;
    flex-direction: column;
    align-items: flex-start;
    max-height: 300px;
    overflow-y: auto;
    width: 330px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.voice-entry {
    background: var(--bg-hover);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.voice-entry button {
    margin-top: 5px;
    margin-right: 5px;
}

.top-bar {
    margin-bottom: 10px;
    position: relative;
    z-index: 9998;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.select-all-checkbox {
    margin-left: 10px;
}

/* Modal Styles */
.overlay {
  position: fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background: rgba(0,0,0,0.5);
  display:none;
  z-index:9999;
  pointer-events: none;
}

.modal {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  z-index: 10000;
  color: var(--text-primary);
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-close-button {
  cursor: pointer;
  float: right;
  font-size: 1.2em;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* Overlay styling for transcript */
#transcript-overlay {
    position: fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background: rgba(0,0,0,0.5);
    z-index:100000;
    display:none;
    justify-content: center;
    align-items: center;
}

#transcript-content {
    background: white;
    color: var(--text-primary);
    padding: 20px;
    border-radius: 12px;
    max-height: 80%;
    overflow-y: auto;
    width: 600px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Close button inside the transcript modal */
.transcript-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 1.2em;
    background: none;
    border: none;
    color: var(--text-secondary);
}

/* Generic line styling */
.transcript-line {
    margin-bottom: 10px;
    line-height: 1.4;
    padding: 10px;
    border-radius: 6px;
}

/* Differentiate Representative and AI lines */
.transcript-line-rep {
    background: #dbeafe;
    border-left: 4px solid var(--accent-blue);
}

.transcript-line-ai {
    background: #f3e8ff;
    border-left: 4px solid #9333ea;
}

/* For unknown lines if they occur */
.transcript-line-unknown {
    background: var(--bg-hover);
    border-left: 4px solid var(--border);
}

.campaign-reports-container,
.employee-reports-container {
    display: none;
    margin-top: 20px;
}

/* Report container and sections */
.report-container {
    margin-top: 20px;
}

.report-user-section {
    margin-bottom: 20px;
    background: var(--bg-surface);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.report-user-title {
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
}

.no-calls-text {
    margin-bottom: 10px;
    font-style: italic;
    color: var(--text-secondary);
}

/* Report table styling */
.report-user-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.report-table-header {
    border-bottom: 2px solid var(--border);
    padding: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    background: var(--bg-hover);
}

.report-table-cell {
    padding: 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9em;
    color: var(--text-primary);
}

.user-cards-container {
    display: block;
}

.reports-container {
    display: none;
}

/* AI Summary Overlay styling */
#ai-summary-overlay {
    position: fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background: rgba(0,0,0,0.5);
    z-index:100000;
    display:none;
    justify-content: center;
    align-items: center;
}

#ai-summary-content {
    background: white;
    color: var(--text-primary);
    padding: 20px;
    border-radius: 12px;
    max-height: 80%;
    overflow-y: auto;
    width: 600px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

#ai-summary-content .transcript-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 1.2em;
    background: none;
    border: none;
    color: var(--text-secondary);
}

#ai-summary-content h3 {
    margin-top: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 5px;
}

#ai-summary-content h4 {
    font-weight: 600;
    margin-bottom: 5px;
    margin-top: 15px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-blue);
}

#ai-summary-content p {
    margin-bottom: 10px;
    line-height: 1.4;
}

#ai-summary-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

#ai-summary-content pre {
    background: var(--bg-hover);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid var(--border);
}

#ai-summary-content ul {
    list-style-type: disc;
    margin-left: 20px;
}

#ai-summary-content li {
    margin-bottom: 10px;
}

/* Scheduler container */
.scheduler-container {
  padding: 10px;
  background: white;
}

.scheduler-container h3 {
  margin-bottom: 15px;
}

.scheduler-container input.scheduler-input,
.scheduler-container select.scheduler-input {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  width: 100%;
}

.scheduler-container label.scheduler-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text-primary);
}

.scheduler-container button.select-datetime-btn {
  margin-bottom: 15px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 5px;
}

.scheduler-container button.schedule-btn {
  margin-top: 20px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.9rem;
}

.custom-datetime-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 9999;
  min-width: 240px;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.custom-datetime-popup .close-popup-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.custom-date-input,
.custom-time-input {
  background: white;
  color: var(--text-primary);
  margin-right: 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.custom-date-select-btn {
  margin-left: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.9rem;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .admin-topbar { padding: 14px 20px; }
  .admin-topbar-title { font-size: 18px; }
  .admin-topbar-subtitle { display: none; }

  .admin-nav-hamburger { display: flex; }

  .admin-nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 999;
  }

  .admin-nav-links.open { display: flex; }

  .admin-nav-item {
    font-size: 14px;
    padding: 9px 14px;
    border-radius: 7px;
  }

  .admin-nav-logout {
    margin-left: 0;
    margin-top: 4px;
    text-align: left;
    font-size: 14px;
    padding: 9px 14px;
    border-radius: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
  }

  .admin-wrap { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .admin-topbar-title { font-size: 16px; }
  .admin-nav-links { right: -8px; min-width: 180px; }
}
