/* ==========================================
   PANEL OPERADOR - Argenville Shop
   Diseño dark, colores azul/dorado
   ========================================== */

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #020617;
  color: #e5f3ff;
  overflow: hidden;
}

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-box {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.login-box h2 {
  text-align: center;
  color: white;
  font-size: 24px;
  margin-bottom: 5px;
}

.login-subtitle {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 30px;
}

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

.form-group label {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-group input::placeholder {
  color: #64748b;
}

.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(90deg, #0ea5e9, #1d4ed8);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.3);
}

.login-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
}

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

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: 260px;
  background: #0f172a;
  border-right: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  font-size: 28px;
}

.sidebar-header h3 {
  color: white;
  font-size: 18px;
  font-weight: 700;
}

.sidebar-user {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

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

.user-name {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.user-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-status.online {
  color: #4ade80;
}

.user-status.online::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.sidebar-nav {
  flex: 1;
  padding: 15px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 10px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
  position: relative;
}

.nav-item:hover {
  background: rgba(14, 165, 233, 0.1);
  color: white;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(29, 78, 216, 0.2));
  color: white;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

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

.nav-badge {
  position: absolute;
  right: 15px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.logout-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.section.active {
  display: flex;
}

.section-header {
  padding: 20px 25px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header h2 {
  color: white;
  font-size: 20px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(14, 165, 233, 0.1);
  color: white;
}

/* ==========================================
   FILTROS
   ========================================== */
.conversations-filter {
  padding: 15px 25px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(14, 165, 233, 0.1);
  color: white;
}

.filter-btn.active {
  background: linear-gradient(90deg, #0ea5e9, #1d4ed8);
  color: white;
  border-color: transparent;
}

/* ==========================================
   LISTA DE CONVERSACIONES
   ========================================== */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.conversations-list::-webkit-scrollbar {
  width: 5px;
}

.conversations-list::-webkit-scrollbar-track {
  background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.conversation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 6px;
  position: relative;
}

.conversation-item:hover {
  background: rgba(14, 165, 233, 0.05);
}

.conversation-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.15), rgba(29, 78, 216, 0.1));
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.conversation-item.unread {
  background: rgba(14, 165, 233, 0.08);
}

.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conv-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  color: #64748b;
  font-size: 12px;
  flex-shrink: 0;
}

.conv-preview {
  color: #94a3b8;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.conv-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.conv-status {
  color: #64748b;
}

.conv-assigned {
  color: #d4a017;
}

.conv-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state p {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state span {
  color: #64748b;
  font-size: 13px;
}

/* ==========================================
   CHAT AREA
   ========================================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #020617;
}

.chat-header {
  padding: 15px 20px;
  background: linear-gradient(90deg, #0ea5e9, #1d4ed8);
  display: flex;
  align-items: center;
  gap: 15px;
}

.back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.back-btn:hover {
  transform: translateX(-3px);
}

.chat-header-info {
  flex: 1;
}

.chat-header-info h3 {
  color: white;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.visitor-status {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header-btn.danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* ==========================================
   MENSAJES DEL CHAT
   ========================================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.empty-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #64748b;
  font-size: 14px;
}

.msg {
  max-width: 75%;
  animation: msgIn 0.3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-visitor {
  align-self: flex-start;
}

.msg-agent {
  align-self: flex-end;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.msg-visitor .message-bubble {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px 14px 14px 4px;
}

.msg-agent .message-bubble {
  background: linear-gradient(90deg, #0ea5e9, #1d4ed8);
  color: white;
  border-radius: 14px 14px 4px 14px;
}

.message-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}

.msg-visitor .message-sender {
  color: #0ea5e9;
}

.message-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 6px;
  text-align: right;
}

/* ==========================================
   INPUT AREA
   ========================================== */
.chat-input-area {
  padding: 15px 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  background: #0f172a;
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
}

.chat-input-wrapper input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 25px;
  border: 1px solid #334155;
  background: #020617;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-wrapper input:focus {
  border-color: #0ea5e9;
}

.chat-input-wrapper input::placeholder {
  color: #64748b;
}

.chat-input-wrapper input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, #0ea5e9, #1d4ed8);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

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

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .sidebar {
    width: 70px;
  }

  .sidebar-header h3,
  .user-info,
  .nav-item span:not(.nav-icon),
  .sidebar-footer {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 15px;
  }

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

  .nav-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
  }
}
