/* ========================================
   MR Repuestos - Dashboard Styles
   Identidad Visual Corporativa
   ======================================== */

:root {
  /* Paleta de colores oficial */
  --crushed-berry: #880d1eff;
  --raspberry: #dd2d4aff;
  --bubblegum-pink: #f26a8dff;
  --pink-mist: #f49cbbff;
  --light-cyan: #cbeef3ff;

  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, #880d1eff, #dd2d4aff, #f26a8dff);
  --gradient-soft: linear-gradient(135deg, #f49cbbff, #cbeef3ff);
  --gradient-card: linear-gradient(145deg, rgba(136, 13, 30, 0.05), rgba(221, 45, 74, 0.05));

  /* Colores complementarios */
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --medium-gray: #6c757d;
  --dark-gray: #343a40;
  --border-color: #dee2e6;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Reset global de márgenes */
* {
  box-sizing: border-box;
}

body, html {
  margin: 0 !important;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
}

/* Prevenir márgenes y scroll horizontal en todos los contenedores */
.container,
.container-fluid,
.row {
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
}

.container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ========================================
   General Layout
   ======================================== */

#main-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--light-gray);
  font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

/* ========================================
   Navbar Custom
   ======================================== */

.navbar-custom {
  background: var(--gradient-primary) !important;
  box-shadow: var(--shadow-md);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  width: 100% !important;
  max-width: 100% !important;
}

.navbar-custom .container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
}

.navbar-custom .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--white) !important;
  font-weight: 700;
  font-size: 1.35rem;
  transition: all 0.3s ease;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
}

.navbar-custom .navbar-brand:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.navbar-custom .navbar-brand i {
  font-size: 1.5rem;
  color: var(--light-cyan);
  flex-shrink: 0;
}

.navbar-custom .brand-name {
  letter-spacing: 0.5px;
  font-size: 1.25rem;
}

.navbar-custom .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.3);
  padding: 0.4rem 0.6rem;
  border-width: 2px;
}

.navbar-custom .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-custom .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 1.5rem;
  height: 1.5rem;
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--white) !important;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
  white-space: nowrap;
}

.user-menu:hover {
  background: rgba(255, 255, 255, 0.15);
}

.user-menu i {
  font-size: 1.4rem;
  color: var(--light-cyan);
  flex-shrink: 0;
}

.user-menu .user-name {
  font-size: 0.9rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown Custom */
.dropdown-custom {
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: 12px;
  padding: 0.5rem 0;
  min-width: 220px;
  margin-top: 0.5rem !important;
}

.dropdown-custom .dropdown-item {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--dark-gray);
  transition: all 0.3s ease;
  font-weight: 500;
}

.dropdown-custom .dropdown-item i {
  width: 20px;
  text-align: center;
  color: var(--raspberry);
}

.dropdown-custom .dropdown-item:hover {
  background: linear-gradient(90deg, rgba(136, 13, 30, 0.05), rgba(221, 45, 74, 0.05));
  color: var(--crushed-berry);
  padding-left: 1.75rem;
}

.dropdown-custom .support-item:hover {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.1), rgba(13, 110, 253, 0.05));
  color: #0d6efd;
}

.dropdown-custom .support-item:hover i {
  color: #0d6efd;
}

.dropdown-custom .logout-item:hover {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
  color: #dc3545;
}

.dropdown-custom .logout-item:hover i {
  color: #dc3545;
}

.dropdown-divider {
  margin: 0.5rem 0;
  border-color: var(--border-color);
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
  flex: 1;
  padding: 2rem 1.5rem;
  width: 100%;
  margin: 0;
  margin-left: 0 !important;
  box-sizing: border-box;
}

/* ========================================
   Dashboard Header
   ======================================== */

.dashboard-header {
  margin-bottom: 3rem;
  text-align: center;
  animation: fadeInDown 0.6s ease-out;
}

.dashboard-title {
  color: var(--crushed-berry);
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.dashboard-title i {
  color: var(--raspberry);
  font-size: 2.25rem;
}

.dashboard-subtitle {
  color: var(--medium-gray);
  font-size: 1.1rem;
  font-weight: 400;
}

/* ========================================
   Modules Grid
   ======================================== */

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out;
}

/* ========================================
   Module Card
   ======================================== */

.module-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.module-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--raspberry);
}

.module-card:hover::before {
  transform: scaleX(1);
}

.module-card:active {
  transform: translateY(-4px);
}

/* Module Icon */
.module-icon {
  width: 70px;
  height: 70px;
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-card);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.module-card:hover .module-icon {
  background: var(--gradient-primary);
  transform: rotate(5deg) scale(1.1);
}

.module-icon i {
  font-size: 2rem;
  color: var(--raspberry);
  transition: all 0.3s ease;
}

.module-card:hover .module-icon i {
  color: var(--white);
  transform: scale(1.1);
}

/* Module Info */
.module-info {
  flex: 1;
}

.module-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.module-card:hover .module-name {
  color: var(--crushed-berry);
}

.module-description {
  font-size: 0.9rem;
  color: var(--medium-gray);
  margin: 0;
  line-height: 1.5;
}

/* Module Arrow */
.module-arrow {
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.module-card:hover .module-arrow {
  opacity: 1;
  transform: translateX(0);
}

.module-arrow i {
  font-size: 1.5rem;
  color: var(--raspberry);
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablets Landscape - Optimización para tablets horizontales (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  /* Optimizar contenedor principal */
  .main-content {
    padding: 1.5rem 1rem;
    margin-left: 0 !important;
    margin-right: 0;
  }

  /* Optimizar navbar para tablets */
  .navbar-custom {
    padding: 0.6rem 0;
  }

  .navbar-custom .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .navbar-custom .navbar-brand {
    font-size: 1.2rem;
    padding: 0.35rem 0.6rem;
    gap: 0.4rem;
  }

  .navbar-custom .navbar-brand i {
    font-size: 1.3rem;
  }

  .navbar-custom .brand-name {
    font-size: 1.1rem;
  }

  .user-menu {
    padding: 0.35rem 0.6rem;
  }

  .user-menu i {
    font-size: 1.3rem;
  }

  .user-menu .user-name {
    font-size: 0.85rem;
    max-width: 120px;
  }

  /* Optimizar dashboard header */
  .dashboard-header {
    margin-bottom: 1.75rem;
  }

  .dashboard-title {
    font-size: 1.85rem;
  }

  .dashboard-title i {
    font-size: 1.65rem;
  }

  .dashboard-subtitle {
    font-size: 0.95rem;
  }

  /* Mejorar grid de módulos para tablets */
  .modules-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .module-card {
    padding: 1.35rem;
  }

  .module-icon {
    width: 58px;
    height: 58px;
    min-width: 58px;
  }

  .module-icon i {
    font-size: 1.65rem;
  }

  /* Optimizar tarjetas de estadísticas */
  .row.mb-4 {
    margin-bottom: 1rem !important;
  }

  .col-md-3,
  .col-md-4,
  .col-md-6,
  .col-md-8 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .stat-card .card-body {
    padding: 0.9rem;
  }
}

/* Tablets Portrait (pantallas pequeñas) */
@media (max-width: 767px) {
  .main-content {
    padding: 1.25rem 0.75rem;
    margin-left: 0 !important;
    margin-right: 0;
    width: 100%;
  }

  /* Navbar responsive para tablets portrait y móviles */
  .navbar-custom {
    padding: 0.5rem 0;
  }

  .navbar-custom .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .navbar-custom .navbar-brand {
    font-size: 1.15rem;
    padding: 0.3rem 0.5rem;
  }

  .navbar-custom .navbar-brand i {
    font-size: 1.25rem;
  }

  .navbar-custom .brand-name {
    font-size: 1rem;
  }

  .user-menu {
    padding: 0.3rem 0.5rem;
  }

  .user-menu i {
    font-size: 1.25rem;
  }

  .user-menu .user-name {
    display: none;
  }

  /* Dashboard */
  .dashboard-header {
    margin-bottom: 1.5rem;
  }

  .dashboard-title {
    font-size: 1.65rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .dashboard-subtitle {
    font-size: 0.95rem;
  }

  .modules-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .module-card {
    padding: 1.15rem;
  }

  .module-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
  }

  .module-icon i {
    font-size: 1.6rem;
  }

  .module-name {
    font-size: 1.05rem;
  }

  .module-description {
    font-size: 0.825rem;
  }
}

/* Mobile */
@media (max-width: 575px) {
  .main-content {
    padding: 1rem 0.5rem;
    margin-left: 0 !important;
    margin-right: 0;
    width: 100%;
  }

  /* Navbar móvil */
  .navbar-custom {
    padding: 0.4rem 0;
  }

  .navbar-custom .container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .navbar-custom .navbar-brand {
    padding: 0.25rem 0.4rem;
    font-size: 1rem;
    gap: 0.35rem;
  }

  .navbar-custom .navbar-brand i {
    font-size: 1.15rem;
  }

  .navbar-custom .brand-name {
    font-size: 0.95rem;
  }

  .navbar-custom .navbar-toggler {
    padding: 0.3rem 0.5rem;
  }

  /* Dashboard móvil */
  .dashboard-header {
    margin-bottom: 1.25rem;
  }

  .dashboard-title {
    font-size: 1.4rem;
  }

  .dashboard-title i {
    font-size: 1.35rem;
  }

  .dashboard-subtitle {
    font-size: 0.875rem;
  }

  .module-card {
    padding: 1rem;
    gap: 1rem;
  }

  .module-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .module-icon i {
    font-size: 1.5rem;
  }

  .module-name {
    font-size: 1rem;
  }

  .module-description {
    font-size: 0.8rem;
  }

  .module-arrow i {
    font-size: 1.25rem;
  }
}

/* ========================================
   Additional View Styles
   ======================================== */

/* Content containers for other views */
#products-view,
#sales-view,
#purchases-view,
#customers-view,
#suppliers-view {
  animation: fadeInUp 0.6s ease-out;
}

#products-view h2,
#sales-view h2,
#purchases-view h2,
#customers-view h2,
#suppliers-view h2 {
  color: var(--crushed-berry);
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

#products-view h2 i,
#sales-view h2 i,
#purchases-view h2 i,
#customers-view h2 i,
#suppliers-view h2 i {
  color: var(--raspberry);
  margin-right: 0.5rem;
}

/* ========================================
   Dashboard Container with Sidebar Layout
   ======================================== */

.dashboard-container {
  display: flex;
  min-height: 100vh;
  background: var(--light-gray);
}

/* Sidebar Styles */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, var(--crushed-berry), var(--raspberry));
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
  width: 80px;
  min-width: 80px;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}

.sidebar .logo i {
  font-size: 1.75rem;
  color: var(--light-cyan);
}

.sidebar.collapsed .logo-text {
  display: none;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border-left: 4px solid var(--light-cyan);
}

.nav-link i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.user-info i {
  font-size: 2rem;
  color: var(--light-cyan);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar.collapsed .user-details {
  display: none;
}

.btn-logout {
  width: 100%;
  background: rgba(220, 53, 69, 0.8);
  border: none;
  color: var(--white);
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: rgba(220, 53, 69, 1);
  transform: translateY(-2px);
}

.sidebar.collapsed .btn-logout .nav-text {
  display: none;
}

/* ========================================
   Support Info Modal Styles
   ======================================== */

.support-info-modal {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.support-info-modal .swal2-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0d6efd;
  padding: 1rem 0 0.5rem 0;
}

.support-confirm-btn {
  padding: 0.75rem 2rem !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
}

.support-confirm-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3) !important;
}
