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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

/* ========== NAVIGATION ========== */
.navbar {
  background: #2c3e50;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-logo {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
}

.navbar-menu {
  display: flex;
  gap: 3rem;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.nav-link {
  color: #ecf0f1;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #3498db;
}

.nav-user {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-left: 2rem;
  border-left: 1px solid #34495e;
  padding-left: 2rem;
  font-size: 0.9rem;
}

.btn-logout {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: #c0392b;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  min-height: calc(100vh - 70px);
}

/* ========== LOGIN PAGE ========== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-form h1 {
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
  color: #2c3e50;
}

.login-form p {
  margin-bottom: 2rem;
  color: #7f8c8d;
  font-size: 0.95rem;
}

.login-form input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.error {
  color: #e74c3c;
  padding: 0.75rem;
  background: #fadbd8;
  border-radius: 4px;
  margin-top: 1rem;
  font-size: 0.9rem;
  border-left: 4px solid #e74c3c;
}

.success {
  color: #27ae60;
  padding: 0.75rem;
  background: #d5f4e6;
  border-radius: 4px;
  margin-top: 1rem;
  font-size: 0.9rem;
  border-left: 4px solid #27ae60;
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: #3498db;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* ========== DASHBOARD ========== */
.dashboard {
  display: grid;
  gap: 2rem;
}

.section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8e8e8;
}

.section h2 {
  margin-bottom: 1.5rem;
  color: #2c3e50;
  font-size: 1.25rem;
  font-weight: 600;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 0.75rem;
}

.section h3 {
  margin-bottom: 1rem;
  color: #34495e;
  font-size: 1.05rem;
  font-weight: 600;
}

/* ========== AGENT GRID ========== */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.agent-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3498db, #9b59b6);
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.agent-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 500;
}

.agent-status.online {
  background: #d5f4e6;
  color: #27ae60;
}

.agent-status.offline {
  background: #fadbd8;
  color: #e74c3c;
}

.agent-status.idle {
  background: #fef5e7;
  color: #f39c12;
}

.agent-status.unknown {
  background: #ecf0f1;
  color: #95a5a6;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.agent-role {
  color: #7f8c8d;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.agent-last-active {
  font-size: 0.8rem;
  color: #95a5a6;
  margin-top: 0.75rem;
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead {
  background: #f5f7fa;
  border-bottom: 2px solid #e8e8e8;
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #34495e;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #ecf0f1;
}

tbody tr {
  transition: background-color 0.2s;
}

tbody tr:hover {
  background: #fafbfc;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========== UPLOAD AREA ========== */
.upload-area {
  border: 2px dashed #3498db;
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  background: #ecf0f1;
  margin-bottom: 2rem;
  transition: all 0.2s;
}

.upload-area:hover {
  border-color: #2980b9;
  background: #d5e8f7;
}

.upload-area p {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: #2c3e50;
  font-weight: 500;
}

.upload-area-hint {
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-top: 0.5rem;
}

/* ========== KANBAN BOARD ========== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.column {
  background: #f5f7fa;
  border-radius: 8px;
  padding: 1.25rem;
  min-height: 500px;
}

.column h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-weight: 600;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid #3498db;
  cursor: move;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.card-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.card-priority {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.card-priority.critical {
  background: #fadbd8;
  color: #e74c3c;
}

.card-priority.high {
  background: #fef5e7;
  color: #f39c12;
}

.card-priority.medium {
  background: #d5ecf1;
  color: #3498db;
}

.card-priority.low {
  background: #d5f4e6;
  color: #27ae60;
}

/* ========== STATS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ========== MODALS ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  color: #2c3e50;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #95a5a6;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #34495e;
}

/* ========== FILTERS ========== */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: #34495e;
  font-weight: 500;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ========== CHAT ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 400px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  border-bottom: 1px solid #ddd;
}

.chat-message {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.chat-message.user {
  background: #d5e8f7;
  color: #2c3e50;
}

.chat-message.agent {
  background: #d5f4e6;
  color: #27ae60;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
}

.chat-form input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.chat-form button {
  padding: 0.5rem 1rem;
}

/* ========== LOADING ========== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== UTILITY ========== */
.text-center {
  text-align: center;
}

.text-muted {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.text-nowrap {
  white-space: nowrap;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.flex {
  display: flex;
}

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

.flex-col {
  flex-direction: column;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .navbar-menu {
    gap: 1.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .agent-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }

  .navbar-menu {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-user {
    width: 100%;
    flex-direction: column;
    border: none;
    border-top: 1px solid #34495e;
    padding-left: 0;
    padding-top: 1rem;
    margin-left: 0;
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-content {
    width: 95%;
  }

  .filters {
    flex-direction: column;
  }

  .filters input,
  .filters select {
    width: 100%;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .navbar-logo {
    font-size: 1rem;
  }

  .main-content {
    padding: 1rem 0.5rem;
  }

  .section {
    padding: 1rem;
  }

  .agent-grid {
    gap: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }
}
