:root {
  /* Colores principales - Esquema claro y elegante */
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #8b5cf6;
  --secondary-color: #f8fafc;
  --secondary-light: #ffffff;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --background-main: #f1f5f9;
  --background-card: #ffffff;
  --border-color: #e2e8f0;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-strong: rgba(0, 0, 0, 0.15);

  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --security-color: #22c55e;
  --purple-color: #8b5cf6;
  --purple-dark: #7c3aed;

  --transition-fast: 0.3s;
  --transition-medium: 0.5s;
}

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

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

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Layout principal */
.main-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 2rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  animation: slideIn var(--transition-medium) ease-out;
  display: flex; /* Added for flexbox layout */
  flex-direction: column; /* Added for column layout */
  justify-content: space-between; /* Added to push content to top and footer to bottom */
}

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

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo::before {
  content: "📦";
  font-size: 2rem;
}

.nav-menu {
  list-style: none;
  padding: 0 1rem;
  flex-grow: 1; /* Allows nav-menu to take available space */
}

.nav-item {
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 12px;
  transition: all var(--transition-fast);
  gap: 1rem;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(5px);
}

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-credit {
  padding: 1rem 2rem; /* Adjust padding as needed */
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2rem; /* Added margin to separate from menu */
}

.sidebar-credit a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

.sidebar-credit a:hover {
  text-decoration: underline;
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem;
  animation: fadeIn var(--transition-medium) ease-out;
}

.header {
  background: var(--background-card);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-dark);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--background-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  animation: fadeIn var(--transition-medium) ease-out;
}

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

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

.card-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.card-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
}

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

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-dark);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  transition: all var(--transition-fast);
  background: var(--background-card);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--secondary-color);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
}

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

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

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

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

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

/* Tablas */
.table-container {
  background: var(--background-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
}

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

.table th {
  background: var(--secondary-color);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border-color);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.table tr:hover {
  background: var(--secondary-color);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success-color);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

.badge-primary {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
}

/* Grid */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Stats Cards */
.stats-card {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  animation: pulse 2s infinite;
}

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

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

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  padding: 2rem;
}

.login-card {
  background: var(--background-card);
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  animation: fadeIn var(--transition-medium) ease-out;
}

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

.login-logo {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--text-light);
}

/* Footer for login card */
.login-card .footer-credit {
    margin-top: 2rem; /* Add some space above it */
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.login-card .footer-credit a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.login-card .footer-credit a:hover {
    text-decoration: underline;
}

/* Alertas */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--success-color);
  color: var(--success-color);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error-color);
  color: var(--error-color);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning-color);
  color: var(--warning-color);
}

.alert-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

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

.stock-alert {
    color: var(--warning-color);
    font-weight: 600;
}

.current-stock {
    color: var(--danger-color);
}

.min-stock {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .header {
    padding: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Búsqueda */
.search-container {
  position: relative;
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--background-card);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Countdown */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.875rem;
}

.countdown.expired {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

/* Barcode Scanner */
.barcode-scanner {
  text-align: center;
  padding: 2rem;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.scanner-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
