/* CSS Custom Properties for easy customization */
:root {
  /* Colors - easily replaceable */
  --primary-gradient: linear-gradient(135deg, #ffffff 0%, #b5c1cd 50%);
  --accent-color: #0a2c47;
  --accent-hover: #295c89;
  --form-bg: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-white: #ffffff;
  --border-color: #e5e7eb;
  --input-bg: #f9fafb;
  --shadow-main: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-form: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Typography */
  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-size-xl: 2.5rem;
  --font-size-lg: 1.25rem;
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Border radius */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background: var(--primary-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  line-height: 1.6;
}

/* Main container */
.formbold-main-wrapper {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
}

/* Form wrapper with split design concept */
.formbold-form-wrapper {
  background: var(--form-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-main);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 460px;
  height: auto;
}

.form-top-banner {
  width: 100%;
  padding: var(--spacing-md);
  background: linear-gradient(120deg, #0a2c47, #1f4e79);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.form-top-banner img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Seção esquerda para imagem */
.form-left-section {
  flex: 0 0 48%;
  position: relative;
  background: #f0f0f0;
  overflow: hidden;
  display: flex;
}

.image-overlay {
  width: 100%;
  height: 100%;
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.8) 0%,
    rgba(147, 51, 234, 0.8) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

.placeholder-image {
  text-align: center;
  color: white;
  padding: var(--spacing-lg);
}

.placeholder-image p {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.placeholder-image small {
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

/* Seção direita para formulário */
.form-right-section {
  flex: 1 1 auto;
  width: 100%;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.form-right-section form {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}

/* Form title */
.form-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  text-align: center;
}

/* Form content */
form {
  padding: 0;
  position: relative;
  z-index: 1;
}

/* Remove o header decorativo anterior */
.formbold-form-wrapper::before {
  display: none;
}

/* Remove o título anterior do form */
form::before {
  display: none;
}

/* Form groups */
.formbold-mb-5 {
  margin-bottom: var(--spacing-md);
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.formbold--mx-3 {
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}

.formbold-px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.w-full {
  width: 100%;
}

.sm\:w-half {
  width: 50%;
}

/* Labels */
.formbold-form-label {
  display: block;
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  letter-spacing: 0.025em;
}

/* Form inputs */
.formbold-form-input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--input-bg);
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: inherit;
}

.formbold-form-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: var(--form-bg);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  transform: translateY(-1px);
}

.formbold-form-input:hover {
  border-color: var(--accent-color);
}

/* Select dropdown */
select.formbold-form-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Radio buttons */
.formbold-radio {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: var(--spacing-xs);
  accent-color: var(--accent-color);
  cursor: pointer;
}

.formbold-radio-label {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  cursor: pointer;
  margin-right: var(--spacing-md);
  font-weight: 500;
}

/* Submit button */
.formbold-btn {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--accent-hover) 100%
  );
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-form);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: var(--spacing-sm);
}

.formbold-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  background: linear-gradient(135deg, var(--accent-hover) 0%, #0e7490 100%);
}

.formbold-btn:active {
  transform: translateY(0);
}

/* Required field indicator */
span[style*="color: red"] {
  color: #ef4444 !important;
  font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
  .formbold-form-wrapper {
    min-height: auto;
    height: auto;
  }

  .form-top-banner {
    padding: var(--spacing-md);
  }

  .form-top-banner img {
    max-width: 260px;
  }

  .form-left-section {
    flex: none;
    height: 300px;
    min-height: 300px;
  }

  .form-right-section {
    flex: none;
    padding: var(--spacing-md);
    min-height: auto;
  }

  .form-title {
    font-size: var(--font-size-lg);
    text-align: center;
  }
}

@media (max-width: 640px) {
  .sm\:w-half {
    width: 100%;
  }

  .form-left-section {
    height: 250px;
    min-height: 250px;
  }

  .form-right-section {
    padding: var(--spacing-sm);
  }
}

@media (max-width: 480px) {
  body {
    padding: var(--spacing-sm);
  }

  .formbold-btn {
    font-size: var(--font-size-base);
  }

  .form-left-section {
    height: 200px;
    min-height: 200px;
  }
}

/* Loading state for form submission */
.formbold-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Focus visible for accessibility */
.formbold-form-input:focus-visible,
.formbold-btn:focus-visible,
.formbold-radio:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Custom scrollbar for select on webkit browsers */
select.formbold-form-input::-webkit-scrollbar {
  width: 8px;
}

select.formbold-form-input::-webkit-scrollbar-track {
  background: var(--input-bg);
}

select.formbold-form-input::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

/* Animation for form appearance */
.formbold-form-wrapper {
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown #guest-search {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.dropdown-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--input-bg);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-input:hover {
  border-color: var(--accent-color);
}

.dropdown-input:focus-within {
  outline: none;
  border-color: var(--accent-color);
  background-color: var(--form-bg);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  transform: translateY(-1px);
}

.dropdown-arrow {
  color: var(--text-secondary);
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.dropdown-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--form-bg);
  border: 2px solid var(--accent-color);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-form);
  z-index: 1000;
  /* Limitar pela altura da tela e permitir scroll interno
     para que o dropdown não saia para fora da tela, especialmente no modo admin */
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
}

.dropdown-options.active {
  display: block;
}

.search-container {
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

.search-container input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background-color: var(--input-bg);
}

.search-container input:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: var(--form-bg);
}

.options-list {
  /* A lista usa a altura disponível do container que já tem scroll */
}

/* Itens solicitados */
.item-section.visible {
  animation: fadeIn 0.3s ease;
}

.item-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-sm);
  align-items: end;
}

.item-inputs .add-item-btn {
  grid-column: 1 / -1;
  width: 100%;
}

.items-list {
  margin-top: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-height: 18rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.item-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  background-color: var(--input-bg);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.item-info strong {
  display: block;
  color: var(--text-primary);
}

.item-details {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.item-details li + li {
  margin-top: 0.2rem;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.item-qty-badge {
  background-color: var(--accent-color);
  color: var(--text-white);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.remove-item-btn {
  border: none;
  background: transparent;
  color: var(--error);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.remove-item-btn:hover {
  text-decoration: underline;
}

.dropdown-option {
  padding: 0.75rem var(--spacing-sm);
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.dropdown-option:hover {
  background-color: var(--input-bg);
}

.dropdown-option.selected {
  background-color: var(--accent-color);
  color: var(--text-white);
}

.dropdown-option:last-child {
  border-bottom: none;
}

/* Scrollbar customizada para o dropdown */
.options-list::-webkit-scrollbar {
  width: 6px;
}

.options-list::-webkit-scrollbar-track {
  background: var(--input-bg);
}

.options-list::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

.options-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Scrollbar customizada para a lista de itens */
.items-list::-webkit-scrollbar {
  width: 6px;
}

.items-list::-webkit-scrollbar-track {
  background: var(--input-bg);
}

.items-list::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

.items-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Indicador de carregamento para o dropdown */
.dropdown-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

.dropdown-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Estado de carregamento para o dropdown */
.dropdown-loading .dropdown-options {
  opacity: 0.7;
  pointer-events: none;
}

/* Modais personalizados */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--form-bg);
  margin: 15% auto;
  padding: 0;
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-main);
  animation: slideIn 0.3s ease;
  overflow: hidden;
}

.modal-header {
  padding: var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.modal-header.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.modal-header.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.modal-header h2 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.close:hover {
  opacity: 0.7;
}

.modal-body {
  padding: var(--spacing-md);
  text-align: center;
}

.modal-body p {
  margin: var(--spacing-sm) 0;
  color: var(--text-primary);
  font-size: var(--font-size-base);
}

.modal-footer {
  padding: var(--spacing-md);
  text-align: center;
  border-top: 1px solid var(--border-color);
  background-color: var(--input-bg);
}

.modal-btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.modal-btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.modal-btn.success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.modal-btn.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.modal-btn.error:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

/* Animações dos modais */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsividade para modais */
@media (max-width: 768px) {
  .modal-content {
    margin: 20% auto;
    width: 95%;
  }

  .modal-header h2 {
    font-size: var(--font-size-base);
  }

  .modal-btn {
    padding: 0.625rem 1.5rem;
    font-size: var(--font-size-sm);
  }
}

/* Estilo do botão ClickUp */
.clickup-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #111111;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: fit-content;
  margin: 0 auto;
}

.clickup-login-btn:hover {
  background: #f8f9fa;
  border-color: #d0d0d0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.clickup-login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clickup-login-btn .clickup-icon {
  width: 72px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.clickup-login-btn .clickup-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Estilos para as telas de login e formulário */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-lg);
  min-height: 340px;
}

.login-description {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-base);
  max-width: 400px;
  line-height: 1.6;
}

.login-btn {
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
  color: #000000;
  border: 1px solid #000000;
  padding: 10px 16px;
  width: 55%;
  max-width: 220px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: var(--spacing-md);
}

.login-btn img.login-icon {
  width: 48px;
  height: 48px;
  margin-right: 8px;
  vertical-align: middle;
  object-fit: contain;
}

.login-btn:hover {
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.login-info {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  max-width: 400px;
}

.login-info p {
  color: #92400e;
  font-size: var(--font-size-sm);
  margin: 0;
}

.form-screen {
  width: 100%;
}

.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.user-info span {
  font-weight: 600;
  color: var(--text-primary);
}

.logout-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Responsividade para as telas de login */
@media (max-width: 768px) {
  .login-screen {
    padding: var(--spacing-md);
    min-height: 300px;
  }

  .login-description {
    font-size: var(--font-size-sm);
  }

  .login-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
  }

  .user-info {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
  }
}
