/**
 * Alericos Plano Alimentar - CSS Principal
 * @version 1.0.0
 */

/* ===== CSS Variables ===== */
:root {
  /* Colors - Alericos Brand */
  --alx-primary: #219EBC;
  --alx-primary-dark: #023047;
  --alx-primary-light: #8ECAE6;
  --alx-secondary: #FFB703;
  --alx-success: #2A9D8F;
  --alx-danger: #E76F51;
  --alx-warning: #F4A261;

  /* Neutrals */
  --alx-white: #FFFFFF;
  --alx-gray-50: #F8F9FA;
  --alx-gray-100: #E9ECEF;
  --alx-gray-200: #DEE2E6;
  --alx-gray-300: #CED4DA;
  --alx-gray-400: #ADB5BD;
  --alx-gray-500: #6C757D;
  --alx-gray-600: #495057;
  --alx-gray-700: #343A40;
  --alx-gray-800: #212529;
  --alx-gray-900: #001219;

  /* Semantic Colors - Dark Mode */
  --alx-bg: var(--alx-gray-900);
  --alx-text: var(--alx-gray-100);
  --alx-text-muted: var(--alx-gray-400);
  --alx-border: rgba(33, 158, 188, 0.2);
  --alx-card-bg: rgba(33, 158, 188, 0.05);
  --alx-shadow: rgba(0, 0, 0, 0.3);
  --alx-shadow-lg: rgba(0, 0, 0, 0.5);
  --alx-hover: rgba(33, 158, 188, 0.15);

  /* Sizing */
  --alx-radius: 12px;
  --alx-radius-sm: 8px;
  --alx-radius-lg: 16px;
  --alx-spacing: 1rem;
  --alx-spacing-sm: 0.5rem;
  --alx-spacing-lg: 2rem;

  /* Typography */
  --alx-font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --alx-font-size-base: 1rem;
  --alx-font-size-sm: 0.875rem;
  --alx-font-size-lg: 1.125rem;
  --alx-font-size-xl: 1.5rem;
  --alx-font-size-2xl: 2rem;
  --alx-line-height-base: 1.5;

  /* Transitions */
  --alx-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --alx-transition-fast: all 0.15s ease-in-out;
}

/* ===== Reset & Base ===== */
.al-plano-editor-wrapper,
.al-plano-lista-wrapper {
  font-family: var(--alx-font-family);
  color: var(--alx-text);
  line-height: var(--alx-line-height-base);
}

.al-plano-editor-wrapper *,
.al-plano-lista-wrapper * {
  box-sizing: border-box;
}

/* ===== Botões ===== */
.al-plano-btn-primary,
.al-plano-btn-secondary,
.al-plano-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 1px solid var(--alx-border);
  border-radius: var(--alx-radius);
  cursor: pointer;
  transition: var(--alx-transition);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.al-plano-btn-primary {
  background: var(--alx-primary);
  color: white;
  border-color: var(--alx-primary);
}

.al-plano-btn-primary:hover {
  background: var(--alx-primary-dark);
  border-color: var(--alx-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--alx-shadow-lg);
}

.al-plano-btn-secondary {
  background: var(--alx-bg);
  color: var(--alx-text);
  border: 1px solid var(--alx-border);
}

.al-plano-btn-secondary:hover {
  background: var(--alx-hover);
  border-color: var(--alx-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--alx-shadow-lg);
}

.al-plano-save-btn {
  background: var(--alx-primary);
  color: white;
  border-color: var(--alx-primary);
  margin-top: 15px;
}

.al-plano-save-btn:hover {
  background: var(--alx-primary-dark);
}

/* ===== Cabeçalho ===== */
.al-plano-header {
  background: var(--alx-card-bg);
  padding: var(--alx-spacing);
  border-radius: var(--alx-radius);
  box-shadow: 0 2px 8px var(--alx-shadow);
  margin-bottom: var(--alx-spacing);
  border: 1px solid var(--alx-border);
}

.al-plano-user-info h2 {
  margin: 0 0 var(--alx-spacing-sm) 0;
  color: var(--alx-primary-light);
  font-weight: 700;
}

.al-plano-user-stats {
  display: flex;
  gap: var(--alx-spacing);
  flex-wrap: wrap;
}

.al-plano-user-stats span {
  font-size: var(--alx-font-size-sm);
  color: var(--alx-text-muted);
}

/* ===== Seções do Formulário ===== */
.al-plano-section {
  background: var(--alx-card-bg);
  padding: var(--alx-spacing);
  border-radius: var(--alx-radius);
  box-shadow: 0 2px 8px var(--alx-shadow);
  margin-bottom: var(--alx-spacing);
  border: 1px solid var(--alx-border);
}

.al-plano-section h3 {
  margin: 0 0 var(--alx-spacing);
  color: var(--alx-primary-light);
  border-bottom: 2px solid var(--alx-primary);
  padding-bottom: var(--alx-spacing-sm);
  font-weight: 700;
}

.al-plano-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--alx-spacing);
}

.al-plano-field {
  display: flex;
  flex-direction: column;
}

.al-plano-field-full {
  grid-column: 1 / -1;
}

.al-plano-field label {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--alx-text);
  font-size: var(--alx-font-size-sm);
}

.al-plano-field input[type="text"],
.al-plano-field input[type="date"],
.al-plano-field input[type="time"],
.al-plano-field input[type="number"],
.al-plano-field select,
.al-plano-field textarea {
  padding: 0.625rem;
  border: 1px solid var(--alx-border);
  border-radius: var(--alx-radius);
  font-size: var(--alx-font-size-base);
  transition: var(--alx-transition);
  font-family: var(--alx-font-family);
}

.al-plano-field input:focus,
.al-plano-field select:focus,
.al-plano-field textarea:focus {
  outline: none;
  border-color: var(--alx-primary);
  box-shadow: 0 0 0 3px rgba(33, 158, 188, 0.3);
}

/* ===== Loading States ===== */
.al-plano-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: al-spin 1s ease-in-out infinite;
}

@keyframes al-spin {
  to { transform: rotate(360deg); }
}

/* ===== Mensagens ===== */
.al-plano-message {
  padding: var(--alx-spacing-sm) var(--alx-spacing);
  border-radius: var(--alx-radius);
  margin-bottom: var(--alx-spacing);
  border-left: 4px solid;
}

.al-plano-message.success {
  background: rgba(42, 157, 143, 0.1);
  color: var(--alx-success);
  border-color: var(--alx-success);
}

.al-plano-message.error {
  background: rgba(231, 111, 81, 0.1);
  color: var(--alx-danger);
  border-color: var(--alx-danger);
}

/* ===== Admin Panel: User Search ===== */
.al-plano-admin-panel {
  max-width: 1200px;
  margin: 0 auto;
}

.al-plano-user-search-wrapper {
  background: var(--alx-card-bg);
  padding: var(--alx-spacing-lg);
  border-radius: var(--alx-radius);
  box-shadow: 0 2px 8px var(--alx-shadow);
  margin-bottom: var(--alx-spacing-lg);
  border: 1px solid var(--alx-border);
}

.al-plano-user-search-wrapper h2 {
  margin: 0 0 var(--alx-spacing-sm);
  color: var(--alx-primary-light);
  font-weight: 700;
}

.al-plano-user-search-wrapper .description {
  color: var(--alx-text-muted);
  margin-bottom: var(--alx-spacing);
  font-size: var(--alx-font-size-sm);
}

.al-plano-search-box {
  position: relative;
  margin-bottom: var(--alx-spacing);
}

.al-plano-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--alx-font-size-base);
  border: 1px solid var(--alx-border);
  border-radius: var(--alx-radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--alx-text);
  transition: var(--alx-transition);
}

.al-plano-search-input:focus {
  outline: none;
  border-color: var(--alx-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(33, 158, 188, 0.2);
}

.al-plano-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #001219;
  border: 1px solid var(--alx-border);
  border-radius: var(--alx-radius);
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px var(--alx-shadow-lg);
  display: none;
}

.al-plano-search-results.active {
  display: block;
}

.al-plano-search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(33, 158, 188, 0.1);
  cursor: pointer;
  transition: var(--alx-transition-fast);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.al-plano-search-result-item:last-child {
  border-bottom: none;
}

.al-plano-search-result-item:hover {
  background: rgba(33, 158, 188, 0.15);
}

.al-plano-search-result-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--alx-primary);
}

.al-plano-search-result-info h4 {
  margin: 0 0 0.25rem;
  color: var(--alx-text);
  font-size: var(--alx-font-size-base);
  font-weight: 600;
}

.al-plano-search-result-info p {
  margin: 0;
  color: var(--alx-text-muted);
  font-size: var(--alx-font-size-sm);
}

.al-plano-search-no-results {
  padding: 1.5rem;
  text-align: center;
  color: var(--alx-text-muted);
  font-style: italic;
}

.al-plano-selected-user {
  background: rgba(33, 158, 188, 0.1);
  border: 2px solid var(--alx-primary);
  border-radius: var(--alx-radius);
  padding: var(--alx-spacing-lg);
  margin-top: var(--alx-spacing);
}

.al-plano-selected-user-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: var(--alx-spacing);
}

.al-plano-selected-user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--alx-primary);
  box-shadow: 0 4px 12px var(--alx-shadow);
}

.al-plano-selected-user-details h3 {
  margin: 0 0 0.5rem;
  color: var(--alx-primary-light);
  font-weight: 700;
  font-size: var(--alx-font-size-lg);
}

.al-plano-selected-user-details p {
  margin: 0.25rem 0;
  color: var(--alx-text);
  font-size: var(--alx-font-size-sm);
}

/* Botões de ação do usuário selecionado */
.al-plano-selected-user .al-plano-btn-criar,
.al-plano-selected-user #al-plano-btn-criar-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  background: var(--alx-primary) !important;
  color: white !important;
  border: 1px solid var(--alx-primary) !important;
  border-radius: var(--alx-radius) !important;
  cursor: pointer !important;
  transition: var(--alx-transition) !important;
  text-decoration: none !important;
  margin-right: 1rem;
  box-shadow: 0 2px 8px rgba(33, 158, 188, 0.3);
}

.al-plano-selected-user .al-plano-btn-criar:hover,
.al-plano-selected-user #al-plano-btn-criar-admin:hover {
  background: var(--alx-primary-dark) !important;
  border-color: var(--alx-primary-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(33, 158, 188, 0.4);
}

.al-plano-btn-clear-user,
.al-plano-selected-user .al-plano-btn-clear-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  background: var(--alx-danger) !important;
  color: white !important;
  border: 1px solid var(--alx-danger) !important;
  border-radius: var(--alx-radius) !important;
  cursor: pointer !important;
  transition: var(--alx-transition) !important;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(231, 111, 81, 0.3);
}

.al-plano-btn-clear-user:hover,
.al-plano-selected-user .al-plano-btn-clear-user:hover {
  background: #C85A3F !important;
  border-color: #C85A3F !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 111, 81, 0.4);
}

/* ===== Responsivo ===== */
@media (max-width: 768px) {
  .al-plano-fields {
    grid-template-columns: 1fr;
  }

  .al-plano-user-stats {
    flex-direction: column;
    gap: var(--alx-spacing-sm);
  }
}
