/* ============================================
   AnalizaVode CRM — Admin Panel Styles
   ============================================ */

:root {
  --primary: #0066CC;
  --primary-dark: #0052a3;
  --success: #00C896;
  --warning: #FFA502;
  --danger: #FF4757;
  --purple: #A855F7;
  --dark: #1a1a2e;
  --gray-900: #1e1e2e;
  --gray-800: #2a2a3e;
  --gray-700: #3a3a4e;
  --gray-600: #555577;
  --gray-400: #9999bb;
  --gray-200: #e8e8f0;
  --gray-100: #f4f4f8;
  --white: #ffffff;
  --sidebar-width: 220px;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   LOGIN
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0066CC 0%, #00B4D8 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon { font-size: 2.5rem; }
.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  margin-top: 8px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--dark);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-text {
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
}

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

.nav-item.active {
  background: var(--primary);
  color: var(--white);
}

.nav-icon { font-size: 16px; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-badge-warn { background: var(--warning); color: var(--dark); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}

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

.view { display: none; }
.view.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.last-updated {
  font-size: 12px;
  color: var(--gray-400);
}

/* ============================================
   STATS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}

.stat-blue { border-left-color: var(--primary); }
.stat-green { border-left-color: var(--success); }
.stat-purple { border-left-color: var(--purple); }
.stat-dark { border-left-color: var(--dark); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   PIPELINE
   ============================================ */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.pipeline-card {
  background: var(--white);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.pipeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pipeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin: 0 auto 8px;
}

.dot-new { background: var(--primary); }
.dot-kit { background: var(--warning); }
.dot-sample { background: var(--purple); }
.dot-analysis { background: #00B4D8; }
.dot-done { background: var(--success); }

.pipeline-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
}

.pipeline-label {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 500;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

.alert-warn {
  background: #fff8e6;
  border: 1px solid #ffd580;
  color: #8a6000;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-100);
}

.data-table th:first-child { border-radius: 12px 0 0 0; }
.data-table th:last-child { border-radius: 0 12px 0 0; }

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--dark);
  font-size: 13px;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--gray-100); }

.loading-row {
  text-align: center;
  color: var(--gray-400);
  padding: 40px !important;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-new      { background: #e8f0ff; color: var(--primary); }
.badge-kit      { background: #fff3e0; color: #e65100; }
.badge-sample   { background: #f3e5f5; color: #7b1fa2; }
.badge-analysis { background: #e0f7fa; color: #00838f; }
.badge-done     { background: #e8f5e9; color: #2e7d32; }
.badge-cancelled{ background: var(--gray-200); color: var(--gray-600); }
.badge-waiting  { background: #fff3e0; color: #e65100; }
.badge-expiring { background: #fff3e0; color: var(--danger); }

/* ============================================
   FORMS & INPUTS
   ============================================ */
.search-input, .select-input {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.2s;
}

.search-input { width: 220px; }

.search-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--primary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--gray-200);
  color: var(--dark);
}
.btn-secondary:hover { background: #d8d8e8; }

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

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

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

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

.btn-full { width: 100%; justify-content: center; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  margin-left: auto;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 2;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-200);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover { background: var(--gray-400); }

.modal-body {
  padding: 24px;
}

/* Modal sections */
.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item label {
  display: block;
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.info-item span {
  font-size: 14px;
  color: var(--dark);
  font-weight: 500;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tracking-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tracking-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
}

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

/* Email log */
.email-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
}

.email-log-item:last-child { border-bottom: none; }

.email-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-sent { background: var(--success); }
.dot-failed { background: var(--danger); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 0;
}

.page-info {
  font-size: 13px;
  color: var(--gray-400);
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  transition: opacity 0.3s;
}

.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
.toast.toast-warn { background: var(--warning); color: var(--dark); }

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }

.text-muted {
  color: var(--gray-400);
  font-style: italic;
}

.text-right { text-align: right; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .logo-text, .nav-item span:not(.nav-icon), .nav-badge, .btn-logout { display: none; }
  .main-content { margin-left: 60px; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
}