/* ============================================
   PedidoListo - Sistema de Gestión
   Estilos Modernos y Responsivos
   ============================================ */

/* Variables CSS */
:root {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #d1fae5;
  --background: #f8fafc;
  --card: #ffffff;
  --foreground: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --input: #f1f5f9;
  --destructive: #ef4444;
  --destructive-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 0.5rem;
}

/* Reset y Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

a {
  text-decoration: none;
  color: inherit;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
  min-height: 100vh;
  display: flex;
}

.login-brand {
  display: none;
  width: 50%;
  background-color: var(--sidebar-bg);
  padding: 3rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  position: relative;
  overflow: hidden;
}

/* Animación de "vida" en el fondo */
.login-brand::before,
.login-brand::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  opacity: 0.2;
  animation: floatBlobs 25s infinite alternate ease-in-out;
}

.login-brand::before {
  background: var(--primary);
  top: -150px;
  left: -150px;
}

.login-brand::after {
  background: #3b82f6; /* Azul vibrante para dar contraste */
  bottom: -150px;
  right: -150px;
  animation-duration: 30s;
  animation-delay: -5s;
}

@keyframes floatBlobs {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(100px, 80px) rotate(90deg) scale(1.2); }
  100% { transform: translate(-50px, 150px) rotate(180deg) scale(0.9); }
}

.login-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 400px;
}

.login-brand h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 1.125rem;
  color: var(--sidebar-text);
  margin-bottom: 3rem;
  opacity: 0.9;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}

.login-feature svg {
  color: var(--primary);
  flex-shrink: 0;
}

.login-form-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-form-wrapper {
  width: 100%;
  max-width: 400px;
}

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

.login-form-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-form-header p {
  color: var(--muted);
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  border: 1px solid var(--border);
}

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

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--card);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.form-group input::placeholder {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

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

.btn-secondary {
  background-color: var(--input);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--border);
}

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

.btn-destructive:hover {
  background-color: var(--destructive-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background-color: var(--input);
}

.btn-full {
  width: 100%;
}

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

.btn-icon {
  padding: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: white;
}

.sidebar-logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.sidebar-logo-text span {
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  padding: 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-text);
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
}

.nav-item.active {
  background-color: var(--sidebar-hover);
  border-left-color: var(--primary);
  color: var(--primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.user-dropdown-container {
  position: relative;
  width: 100%;
}

.sidebar-user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: none;
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: background-color 0.2s;
  color: var(--sidebar-text);
}

.sidebar-user:hover {
  background-color: var(--sidebar-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

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

.user-info h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info span {
  font-size: 0.75rem;
  color: var(--muted);
}

.dropdown-icon {
  margin-left: auto;
  opacity: 0.5;
  transition: transform 0.2s;
}

.user-dropdown-container.active .dropdown-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #1e293b; /* Color un poco más claro que el sidebar para contraste */
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5);
  display: none;
  z-index: 60;
  flex-direction: column;
}

.user-dropdown-container.active .user-dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--sidebar-text);
  border-radius: var(--radius);
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background-color: var(--primary);
  color: white;
}

.dropdown-item svg {
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background-color: rgba(255,255,255,0.1);
  margin: 0.5rem 0;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--foreground);
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-title p {
  font-size: 0.875rem;
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Content Area */
.content {
  flex: 1;
  padding: 1.5rem;
}

/* .mb-4 is used in dashboard.html */
.mb-4 {
    margin-bottom: 1rem;
}

/* ============================================
   CARDS & STATS
   ============================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.card-header p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.card-content {
  padding: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-content h3 {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.stat-content .stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-content .stat-change {
  font-size: 0.75rem;
  color: var(--success);
  margin-top: 0.25rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green {
  background-color: var(--primary-light);
  color: var(--primary);
}

.stat-icon.blue {
  background-color: #dbeafe;
  color: #3b82f6;
}

.stat-icon.orange {
  background-color: #fef3c7;
  color: #f59e0b;
}

.stat-icon.purple {
  background-color: #f3e8ff;
  color: #a855f7;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.quick-action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.quick-action-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.quick-action-card svg {
  color: var(--primary);
}

.quick-action-card h3 {
  font-weight: 500;
}

/* ============================================
   DATA TABLES
   ============================================ */
.table-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.table-header-top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 18px;
  height: 18px;
}

.search-input input {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.search-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.table-container {
  overflow-x: auto;
}

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

thead {
  background-color: var(--input);
}

th {
  padding: 0.75rem 1rem;  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

tr:hover {
  background-color: var(--input);
}

.table-actions-cell {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-warning {
  background-color: #fef3c7;
  color: #d97706;
}

.badge-danger {
  background-color: #fee2e2;
  color: var(--destructive);
}

.badge-secondary {
  background-color: var(--input);
  color: var(--muted);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--input);
  color: var(--foreground);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background-color: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary);
}

.alert-error {
  background-color: #fee2e2;
  color: var(--destructive);
  border: 1px solid var(--destructive);
}

.alert-warning {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid var(--warning);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.empty-state p {
  font-size: 0.875rem;
}

/* ============================================
   MOBILE STYLES
   ============================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.5rem;
  z-index: 50;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  color: var(--muted);
  font-size: 0.625rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

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

.mobile-nav-item svg {
  width: 24px;
  height: 24px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 45;
}

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

/* Tablet */
@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .table-header-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .login-brand {
    display: flex;
  }
  
  .login-form-container {
    width: 50%;
  }
  
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
    padding-bottom: 70px;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .mobile-nav {
    display: block;
  }
  
  .header-title h1 {
    font-size: 1rem;
  }
  
  .content {
    padding: 1rem;
  }
  
  .card-header,
  .card-content {
    padding: 1rem;
  }
  
  .table-header {
    padding: 1rem;
  }
  
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-input {
    width: 100%;
  }
  
  th, td {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .hide-mobile {
    display: none;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--destructive); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }