﻿@import 'variables';

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: $bg-light;

  &__content {
    flex: 1;
    margin-left: $sidebar-width;
    transition: margin-left $transition-speed;
    display: flex;
    flex-direction: column;

    &--sidebar-open {
      margin-left: $sidebar-width;
    }
  }

  &__main {
    flex: 1;
    padding: 20px;
  }
}

// Sidebar
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: $sidebar-width;
  background-color: $bg-sidebar;
  color: white;
  transition: width $transition-speed;
  z-index: 1000;
  overflow-y: auto;

  &--closed {
    width: $sidebar-width-collapsed;

    .sidebar__subtitle,
    .sidebar__menu-link span {
      display: none;
    }
  }

  &__header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  &__logo {
    h2 {
      margin: 0;
      font-size: 24px;
      font-weight: bold;
      color: white;
    }
  }

  &__subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
  }

  &__nav {
    padding: 10px 0;
  }

  &__menu {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  &__menu-item {
    margin: 0;
  }

  &__menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all $transition-speed;

    i {
      width: 20px;
      margin-right: 15px;
      text-align: center;
    }

    &:hover {
      background-color: rgba(255, 255, 255, 0.1);
      color: white;
    }

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

// Header
.admin-header {
  height: $header-height;
  background-color: white;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

  &__left {
    display: flex;
    align-items: center;
  }

  &__tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  &__tab {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: $secondary-color;
    text-decoration: none;
    transition: background-color $transition-speed, color $transition-speed;

    &:hover {
      background-color: rgba(52, 152, 219, 0.1);
      color: $primary-color;
      text-decoration: none;
    }

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

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

  &__menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: $secondary-color;
    cursor: pointer;
    padding: 10px;
    margin-right: 15px;

    &:hover {
      color: $primary-color;
    }
  }

  &__right {
    display: flex;
    align-items: center;
    color: $secondary-color;

    .dropdown-menu {
      background-color: white;
      border: 1px solid #dee2e6;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

      .dropdown-item-text {
        color: $secondary-color;
        padding: 10px 15px;

        small {
          color: #6c757d;
        }

        div {
          color: $secondary-color;
          font-weight: 500;
        }
      }

      .dropdown-item {
        color: $secondary-color;
        padding: 10px 15px;
        transition: background-color $transition-speed;

        &:hover {
          background-color: #f8f9fa;
          color: $primary-color;
        }

        i {
          color: inherit;
        }
      }
    }
  }

  &__user {
    display: flex;
    align-items: center;
    color: $secondary-color;

    i {
      font-size: 24px;
      margin-right: 10px;
    }

    &-button {
      color: $secondary-color !important;
      text-decoration: none;
      transition: color $transition-speed;

      &:hover {
        color: $primary-color !important;
        text-decoration: none;
      }

      i, span {
        color: inherit;
      }
    }
  }
}

// Page Header
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;

  h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
  }
}

// Dashboard
.dashboard {
  &__header {
    margin-bottom: 30px;

    h1 {
      margin-bottom: 10px;
    }
  }

  &__stats {
    margin-bottom: 30px;
  }

  // Sección de completitud del catálogo (tarjetas clicables del Dashboard)
  &__completeness {
    margin-bottom: 30px;

    &-title {
      font-weight: 700;
      margin-bottom: 2px;
    }

    &-hint {
      margin-bottom: 18px;
      font-size: 0.9rem;
    }
  }
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform $transition-speed;

  &:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }

  &__icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-right: 20px;

    &--blue {
      background-color: #3498db;
    }

    &--green {
      background-color: #2ecc71;
    }

    &--orange {
      background-color: #f39c12;
    }

    &--purple {
      background-color: #9b59b6;
    }

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

    &--red {
      background-color: #e52727;
    }

    &--yellow {
      background-color: #f1c40f;
    }
  }

  &__content {
    h3 {
      margin: 0;
      font-size: 32px;
      font-weight: bold;
      color: #000;
    }

    p {
      margin: 5px 0 0 0;
      color: #6c757d;
    }
  }
}

// Buscador de productos (pill redondeado)
.productos-search {
  &__wrapper {
    position: relative;
    flex: 1 1 auto;
    min-width: 220px;
    max-width: 480px;
  }

  &__input {
    border-radius: 50px;
    height: 42px;
    padding-left: 20px;
    padding-right: 90px;
    border: 1px solid #dee2e6;
    transition: border-color $transition-speed, box-shadow $transition-speed;

    &:focus {
      border-color: $primary-color;
      box-shadow: 0 0 0 3px rgba($primary-color, 0.12);
    }
  }

  // Botón de buscar integrado dentro del campo (círculo azul)
  &__go {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #0b4b99;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color $transition-speed, transform $transition-speed;

    &:hover:not(:disabled) {
      background: darken(#0b4b99, 8%);
      transform: translateY(-50%) scale(1.06);
    }

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

  &__clear {
    position: absolute;
    right: 46px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f1f3f5;
    color: #6c757d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background-color $transition-speed, color $transition-speed;

    &:hover {
      background: #e9ecef;
      color: #495057;
    }
  }

  &__btn {
    border-radius: 50px;
    height: 42px;
    padding-left: 24px;
    padding-right: 24px;
    margin-left: 10px;
    white-space: nowrap;
    font-weight: 500;
  }

  // Filtro por modelo (dropdown pill)
  &__model {
    position: relative;
    margin-left: 14px;
  }

  &__model-btn {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 50px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all $transition-speed;

    &:hover {
      border-color: $primary-color;
      color: $primary-color;
    }

    &--active {
      background: #0b4b99;
      border-color: #0b4b99;
      color: white;
      box-shadow: 0 2px 6px rgba(11, 75, 153, 0.35);

      &:hover {
        background: darken(#0b4b99, 8%);
        border-color: darken(#0b4b99, 8%);
        color: white;
      }
    }
  }

  &__model-chevron {
    font-size: 0.7rem;
    transition: transform $transition-speed;

    &--open {
      transform: rotate(180deg);
    }
  }

  &__model-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    width: 280px;
    max-width: 90vw;
    background: white;
    border-radius: 14px;
    border: 1px solid #dee2e6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 16px;
  }

  &__model-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 8px;
    display: block;
  }

  &__model-select {
    border-radius: 10px;
    height: 40px;

    &:focus {
      border-color: $primary-color;
      box-shadow: 0 0 0 3px rgba($primary-color, 0.12);
    }
  }

  // Filtros Todos / Activos / Inactivos (segmentados redondeados)
  &__filters {
    display: inline-flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 50px;
    padding: 4px;
    padding-left: 16px;
    margin-left: 14px;
    gap: 2px;
  }

  &__filters-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
  }

  &__filter {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    text-decoration: none;
    white-space: nowrap;
    transition: all $transition-speed;

    &:hover {
      color: #495057;
      background: #e9ecef;
      text-decoration: none;
    }

    &--active {
      background: $primary-color;
      color: white;
      box-shadow: 0 2px 6px rgba($primary-color, 0.35);

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

    &--green:hover {
      color: #2ecc71;
    }

    &--gray:hover {
      color: #6c757d;
    }

    &--active-green {
      background: #2ecc71;
      color: white;
      box-shadow: 0 2px 6px rgba(46, 204, 113, 0.35);

      &:hover {
        background: darken(#2ecc71, 6%);
        color: white;
      }
    }

    &--active-gray {
      background: #6c757d;
      color: white;
      box-shadow: 0 2px 6px rgba(108, 117, 125, 0.35);

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

  // Botón Eliminar (outline rojo pill)
  &__action {
    margin-left: 14px;
    border-radius: 50px;
    height: 42px;
    padding-left: 20px;
    padding-right: 20px;
    font-weight: 500;
    white-space: nowrap;

    &:disabled {
      opacity: 0.45;
    }
  }

  // Botón Nuevo producto (azul sitio web, pill)
  &__new {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    height: 42px;
    padding-left: 22px;
    padding-right: 22px;
    border-radius: 50px;
    border: none;
    background: #0b4b99;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(11, 75, 153, 0.3);
    transition: background-color $transition-speed, transform $transition-speed;

    &:hover {
      background: darken(#0b4b99, 8%);
      color: white;
      text-decoration: none;
      transform: translateY(-1px);
    }
  }
}

