﻿@import 'variables';

// Cards
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;

  &-header {
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;

    h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
    }
  }

  &-body {
    padding: 20px;
  }
}

// Forms
.form-group {
  margin-bottom: 20px;

  label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: $secondary-color;
  }
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color $transition-speed;

  &:focus {
    outline: none;
    border-color: $primary-color;
    box-shadow: 0 0 0 0.2rem rgba($primary-color, 0.25);
  }

  &.is-invalid {
    border-color: $danger-color;
  }
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
}

// Buttons
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all $transition-speed;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  i {
    font-size: 14px;
  }

  &-primary {
    background-color: $primary-color;
    color: white;

    &:hover {
      background-color: darken($primary-color, 10%);
    }
  }

  &-secondary {
    background-color: #6c757d;
    color: white;

    &:hover {
      background-color: darken(#6c757d, 10%);
    }
  }

  &-danger {
    background-color: $danger-color;
    color: white;

    &:hover {
      background-color: darken($danger-color, 10%);
    }
  }

  &-sm {
    padding: 5px 10px;
    font-size: 12px;
  }

  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}

// Tables
.table {
  width: 100%;
  margin-bottom: 0;

  thead {
    background-color: #f8f9fa;

    th {
      padding: 12px;
      text-align: left;
      font-weight: 600;
      border-bottom: 2px solid #dee2e6;
    }
  }

  tbody {
    tr {
      &:hover {
        background-color: #f8f9fa;
      }
    }

    td {
      padding: 12px;
      border-bottom: 1px solid #dee2e6;
    }
  }
}

// Sortable Table Headers
.sortable-header {
  position: relative;
  user-select: none;

  &.sortable {
    &:hover {
      background-color: #e9ecef;
    }
  }

     &__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    // Centra el texto (e.j. "Imagen", "Modelos disponibles") justo debajo
    // de la celda centrada, neutralizando el space-between del flex.
    &.text-center {
      justify-content: center;
    }
  }

  &__icons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  &.sortable:hover &__icons,
  &.active &__icons {
    opacity: 1;
  }

  &__icon {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    transition: color 0.2s ease;

    &--up {
      margin-bottom: -2px;
    }

    &--down {
      margin-top: -2px;
    }

    &.active {
      color: #000;
      font-weight: 900;
    }
  }

  &.active {
    background-color: #e9ecef;
  }

  &.active &__icons {
    opacity: 1;
  }
}

// Badges
.badge {
  display: inline-block;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;

  &-success {
    background-color: $success-color;
    color: white;
  }

  &-danger {
    background-color: $danger-color;
    color: white;
  }

  &-info {
    background-color: $info-color;
    color: white;
  }

  &-secondary {
    background-color: #6c757d;
    color: white;
  }
}

// Product Selector
.product-selector {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 15px;
  max-height: 200px;
  overflow-y: auto;
  background-color: #f8f9fa;

  .form-check {
    margin-bottom: 10px;

    &:last-child {
      margin-bottom: 0;
    }
  }
}

// Reportes
.reportes-container {
  .card {
    margin-bottom: 20px;
  }
}

.report-filters {
  .form-group {
    margin-bottom: 15px;
  }
}

// Product list table: images column and thumbnails
.product-list-table {
  &__col-images {
    width: 1%;
    white-space: nowrap;
    min-width: 120px;
  }

  &__cell-images {
    vertical-align: middle;
  }
}

.product-list__thumbnails {
  .product-list__thumb {
    border-radius: 4px;
    overflow: hidden;
    background-color: #eee;
  }

  .product-list__thumb-img {
    display: block;
    background-color: #f5f5f5;
  }

  .product-list__thumb-more {
    font-size: 11px;
    padding: 2px 6px;
  }

  .product-list__no-images {
    font-size: 14px;
  }
}

// Responsive
@media (max-width: 768px) {
  .admin-layout {
    &__content {
      margin-left: 0;
    }
  }

  .sidebar {
    transform: translateX(-100%);

    &--open {
      transform: translateX(0);
    }
  }
}

