/* ==========================================
   EDRA - Sistema de Gestión
   Custom CSS Styles
   ========================================== */

:root {
  --primary: #e60000;
  --primary-dark: #cc0000;
  --primary-light: #ff3333;
  --secondary: #0033a0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --bg-dark: #001233;
  --bg-sidebar: #001a4d;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-white: #f8fafc;

  --border-color: #e2e8f0;
  --border-radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-sidebar) 50%, #1a365d 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(
      circle at 30% 50%,
      rgba(99, 102, 241, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(14, 165, 233, 0.1) 0%,
      transparent 50%
    );
  animation: loginBgPulse 8s ease-in-out infinite alternate;
}

@keyframes loginBgPulse {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-2%, -2%) scale(1.05);
  }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: rgba(0, 26, 77, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.login-logo img {
  max-width: 100%;
  height: auto;
  max-height: 90px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.login-header h1 {
  color: var(--text-white);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
}

.login-header p {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.login-form .form-control {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  transition: var(--transition);
}

.login-form .form-control:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  color: var(--text-white);
}

.login-form .form-control::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

.form-check-group {
  margin-bottom: 24px;
}

.form-check-label {
  color: var(--text-light);
  font-size: 13px;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--primary-dark), #3730a3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
}

.login-footer p {
  color: var(--text-light);
  font-size: 12px;
  opacity: 0.6;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.wrapper {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  color: var(--text-white);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
}

.sidebar-brand img {
  max-height: 36px;
  margin-right: 8px;
}

.sidebar-subtitle {
  color: var(--text-light);
  font-size: 12px;
  margin: 4px 0 0 0;
  opacity: 0.6;
}

.sidebar-nav {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
}

.sidebar-heading {
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 16px 8px;
  opacity: 0.5;
}

.sidebar-item {
  margin-bottom: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-link:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-white);
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-link i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 10px;
}

.sidebar-user i {
  font-size: 20px;
  color: var(--primary-light);
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
}

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

.main-content.expanded {
  margin-left: 0;
}

.top-navbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.btn-toggle-sidebar {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.btn-toggle-sidebar:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.navbar-date {
  color: var(--text-secondary);
  font-size: 13px;
}

.navbar-date i {
  margin-right: 4px;
}

.content-wrapper {
  padding: 24px;
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-title i {
  color: var(--primary);
  margin-right: 8px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 2px 0 0 0;
}

/* ==========================================
   STAT CARDS
   ========================================== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.stat-card__icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-card--pedidos .stat-card__icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.stat-card--pendientes .stat-card__icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.stat-card--clientes .stat-card__icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.stat-card--articulos .stat-card__icon {
  background: rgba(14, 165, 233, 0.1);
  color: var(--secondary);
}

.stat-card--ventas .stat-card__icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.stat-card__info h3 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.stat-card__info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================
   CUSTOM CARDS
   ========================================== */
.card-custom {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-custom__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.card-custom__header h5 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.card-custom__header h5 i {
  color: var(--primary);
  margin-right: 6px;
}

.card-custom__body {
  padding: 20px 24px;
}

/* ==========================================
   TABLES
   ========================================== */
.table {
  margin-bottom: 0;
}

.table thead th {
  background: var(--bg-main);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

.table-hover tbody tr:hover {
  background: rgba(99, 102, 241, 0.03);
}

/* ==========================================
   BADGES
   ========================================== */
.badge--activo,
.badge--completado {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge--inactivo,
.badge--cancelado {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge--pendiente {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge--en_proceso {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #3730a3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-group {
  display: inline-flex;
  gap: 5px;
}

.btn-group .btn {
  border-radius: 6px !important;
  margin: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ==========================================
   FORMS
   ========================================== */
.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
}

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

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  border-radius: 10px;
  border: none;
  font-size: 14px;
  padding: 12px 20px;
  margin-bottom: 20px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

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

  .sidebar.show {
    width: var(--sidebar-width);
  }

  .main-content {
    margin-left: 0;
  }

  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .content-wrapper {
    padding: 16px;
  }

  .stat-card__info h3 {
    font-size: 22px;
  }

  .btn-close-sidebar {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-white);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
  }

  .btn-close-sidebar:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
  }
}
