/* Modern responsive theme with beautiful UI/UX */
:root {
  --primary: #f7a8c6;
  --primary-dark: #e68cad;
  --primary-light: #fcd4e3;
  --text-on-primary: #222;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --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);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth transitions and modern body styles */
* {
  transition: var(--transition);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  background-color: var(--bg-light);
  color: #2c3e50;
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
}

/* Modern navbar with glassmorphism effect */
.navbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-on-primary) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.navbar-brand img {
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* Enhanced button styles with hover effects */
.btn {
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  border-color: var(--primary-dark) !important;
  color: var(--text-on-primary) !important;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.1);
}

.btn-outline-light {
  color: var(--text-on-primary) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.1);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-2px);
}

.btn-outline-dark {
  border-color: var(--primary-dark) !important;
  color: var(--primary-dark) !important;
}

.btn-outline-dark:hover {
  background: var(--primary);
  border-color: var(--primary-dark) !important;
  color: var(--text-on-primary) !important;
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  border: none;
  color: white;
}

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

.btn-danger {
  background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
  border: none;
  color: white;
}

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

/* Modern card styles */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  background: var(--bg-white);
  transition: var(--transition);
  overflow: hidden;
}

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

.card-body {
  padding: 1.5rem;
}

/* Enhanced table styles */
.table {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table thead {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: var(--text-on-primary);
}

.table thead th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding: 0.75rem;
  border: none;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: var(--primary-light);
  transform: scale(1.01);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(248, 249, 250, 0.5);
}

/* Form controls with modern design */
.form-control,
.form-select {
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  transition: var(--transition);
  background: var(--bg-white);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(247, 168, 198, 0.1);
  transform: scale(1.01);
}

.form-label {
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* Input groups enhancement */
.input-group {
  box-shadow: var(--shadow-sm);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

/* Modern modal styles */
.modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  border-bottom: none;
  padding: 1.5rem;
}

.modal-title {
  font-weight: 700;
  color: var(--text-on-primary);
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  border-top: 1px solid #e2e8f0;
  padding: 1.5rem;
}

/* Enhanced navbar for mobile */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(255, 255, 255, 0.95);
    margin-top: 1rem;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
  }

  .navbar-collapse .btn {
    width: 100%;
    margin: 0.25rem 0;
    text-align: left;
  }

  .navbar-collapse .btn-outline-light {
    color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
  }
}

/* Container improvements */
.container {
  max-width: 1400px;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 768px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Page headers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 2rem;
  position: relative;
  padding-bottom: 0.75rem;
}

h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 2px;
}

/* Pagination enhancement */
.pagination {
  margin-top: 2rem;
  gap: 0.5rem;
}

.page-item .page-link {
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 0.75rem 1rem;
  margin: 0 0.25rem;
  transition: var(--transition);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary-dark);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}

.page-item .page-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Alert improvements */
.alert {
  border: none;
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

/* Badge styles */
.badge {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
}

/* Loading states */
.table tbody tr.recently-added {
  animation: highlight 3s ease;
}

@keyframes highlight {

  0%,
  100% {
    background-color: transparent;
  }

  50% {
    background-color: var(--primary-light);
  }
}

/* Responsive improvements */
@media (max-width: 767.98px) {
  h3 {
    font-size: 1.5rem;
  }

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

  .card-body {
    padding: 1rem;
  }
}

/* Dropdown menu enhancement */
.dropdown-menu {
  border: none;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  font-weight: 500;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  transform: translateX(4px);
}

/* List group improvements */
.list-group-item {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.list-group-item:hover {
  background: var(--primary-light);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* Text utilities */
.text-muted {
  color: #718096 !important;
}

.lead {
  font-size: 1.25rem;
  font-weight: 400;
  color: #4a5568;
}

/* Utility spacing */
.gap-2 {
  gap: 0.5rem !important;
}

.gap-3 {
  gap: 1rem !important;
}

/* Focus states */
button:focus,
a:focus,
input:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ======================================
   MOBILE RESPONSIVE OPTIMIZATIONS
   ====================================== */

/* Mobile Modal Optimizations */
@media (max-width: 575.98px) {

  /* Modal takes full width on small screens */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-content {
    border-radius: var(--border-radius-sm);
  }

  /* Reduce modal padding on mobile */
  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
  }

  .modal-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
    margin: 0;
  }

  /* Stack form columns on mobile */
  .modal-body .row>[class*="col-"] {
    margin-bottom: 1rem;
  }

  .modal-body .row {
    margin-left: 0;
    margin-right: 0;
  }

  .modal-body .row>* {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Touch-Friendly Buttons */
@media (max-width: 767.98px) {

  /* Ensure minimum touch target size of 44x44px */
  .btn,
  .btn-group .btn,
  .page-link {
    min-height: 44px;
    min-width: 44px;
    padding: 0.65rem 1rem;
  }

  .btn-sm,
  .btn-group-sm .btn {
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  /* Better spacing for button groups */
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .btn-group .btn {
    flex: 1;
    min-width: 80px;
  }

  /* Stacked button groups in some contexts */
  .d-flex.gap-2 {
    flex-direction: column;
  }

  .d-flex.gap-2 .btn {
    width: 100%;
  }
}

/* Mobile Card Optimizations */
@media (max-width: 767.98px) {
  .card {
    margin-bottom: 1rem;
    border-radius: var(--border-radius-sm);
  }

  .card-body {
    padding: 1rem;
  }

  .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .card-text {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* Better spacing for card content */
  .card-text.mb-1 {
    margin-bottom: 0.5rem !important;
  }

  /* Mobile product cards */
  .row.g-3 {
    gap: 1rem !important;
  }

  .shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Mobile Form Optimizations */
@media (max-width: 767.98px) {

  .form-control,
  .form-select {
    font-size: 16px;
    /* Prevents zoom on iOS */
    padding: 0.75rem;
    min-height: 44px;
  }

  .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  /* Input groups on mobile */
  .input-group {
    flex-direction: column;
  }

  .input-group>* {
    width: 100% !important;
    border-radius: var(--border-radius-sm) !important;
  }

  .input-group .btn {
    margin-top: 0.5rem;
  }

  /* Better spacing in forms */
  .mb-2 {
    margin-bottom: 1rem !important;
  }
}

/* Mobile Table Responsiveness */
@media (max-width: 991.98px) {
  .table-responsive {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
  }

  /* Hide table on mobile - show cards instead */
  .d-none.d-lg-block {
    display: none !important;
  }

  .d-lg-none {
    display: block !important;
  }
}

/* Thumbnail Gallery Mobile Optimization */
@media (max-width: 767.98px) {
  .product-gallery {
    position: relative;
    top: 0;
  }

  .main-image {
    max-width: 100%;
    margin-bottom: 1rem;
  }

  .thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .thumbnail {
    border-width: 2px;
  }

  .thumbnail-actions {
    padding: 2px;
  }

  .thumbnail-actions button {
    font-size: 0.65rem;
    padding: 2px 4px;
  }

  .badge-principal {
    font-size: 0.6rem;
    padding: 1px 4px;
  }
}

/* Mobile Navigation Improvements */
@media (max-width: 991.98px) {
  .navbar {
    padding: 0.75rem 0;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }

  .navbar-brand img {
    height: 25px !important;
  }

  /* Better mobile menu */
  .navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
  }

  .navbar-collapse .btn {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
  }
}

/* Mobile-specific utilities */
@media (max-width: 575.98px) {

  /* Responsive container */
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Smaller headings on mobile */
  h3 {
    font-size: 1.5rem;
  }

  h4 {
    font-size: 1.25rem;
  }

  h5 {
    font-size: 1.1rem;
  }

  h6 {
    font-size: 1rem;
  }

  /* Better breadcrumb on mobile */
  .breadcrumb {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.85rem;
  }

  /* Pagination on mobile */
  .pagination {
    gap: 0.25rem;
  }

  .page-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* Landscape phone optimization */
@media (max-width: 767.98px) and (orientation: landscape) {
  .modal-body {
    max-height: calc(100vh - 150px);
  }

  .navbar-collapse {
    max-height: 50vh;
  }
}

/* Prevent horizontal scroll */
body {
  overflow-x: hidden;
}

.container-fluid,
.container {
  overflow-x: visible;
  width: 100%;
}

/* Improve touch feedback */
@media (hover: none) and (pointer: coarse) {

  /* Touch devices */
  .btn:active,
  .page-link:active,
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
  }

  /* Remove hover effects on touch devices */
  .btn:hover,
  .card:hover {
    transform: none;
  }

  /* Better active states for touch */
  .btn-primary:active {
    filter: brightness(0.9);
  }

  .btn-outline-light:active,
  .btn-outline-secondary:active {
    background: rgba(0, 0, 0, 0.1);
  }
}