/* ========== LOADING & ERROR STATES ========== */

/* Loading Spinner */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  color: var(--color-text-gray, #666);
  font-size: 1rem;
}

.loading::before {
  content: '';
  width: 40px;
  height: 40px;
  margin-right: 1rem;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--color-primary, #d4af37);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background-color: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  color: #c33;
  text-align: center;
  margin: 2rem auto;
  max-width: 600px;
}

.error-message::before {
  content: '⚠️';
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Empty State */
.empty-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background-color: #f9f9f9;
  border: 1px dashed #ddd;
  border-radius: 8px;
  color: var(--color-text-gray, #666);
  text-align: center;
  margin: 2rem auto;
  max-width: 600px;
}

.empty-message::before {
  content: '📭';
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Success Message (para formulários) */
.success-message {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  color: #155724;
  margin: 1rem 0;
}

.success-message::before {
  content: '✓';
  font-size: 1.5rem;
  margin-right: 0.75rem;
  font-weight: bold;
}

/* Button States */
.btn:disabled,
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Form Validation States */
.form-field--error input,
.form-field--error textarea,
.form-field--error select {
  border-color: #dc3545;
}

.form-field__error {
  display: block;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-field--success input,
.form-field--success textarea,
.form-field--success select {
  border-color: #28a745;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 0.75rem;
}

.skeleton-image {
  height: 200px;
  width: 100%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #ffffff;
  color: #333333;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 300px;
  max-width: 500px;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast--success {
  border-left: 4px solid #28a745;
}

.toast--error {
  border-left: 4px solid #dc3545;
}

.toast--warning {
  border-left: 4px solid #ffc107;
}

.toast--info {
  border-left: 4px solid #17a2b8;
}

.toast__icon {
  font-size: 1.5rem;
}

.toast__message {
  flex: 1;
  color: #333333;
  font-size: 0.95rem;
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast__close:hover {
  color: #333;
}

/* ============================================
   LOGIN MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-login {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 100%;
  padding: 2rem;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-login {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  background-color: #f5f5f5;
  color: #333;
}

.modal-login__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-login__logo {
  max-width: 120px;
  margin: 0 auto 1rem;
  display: block;
}

.modal-login__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}

.modal-login__subtitle {
  font-size: 0.95rem;
  color: #666;
  margin: 0;
}

.modal-login__form {
  margin-top: 1.5rem;
}

.modal-login__form .form-group {
  margin-bottom: 1rem;
}

.modal-login__form .form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
  font-size: 0.9rem;
}

.modal-login__form .form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.3s;
  font-family: inherit;
}

.modal-login__form .form-input:focus {
  outline: none;
  border-color: #28a745;
}

.modal-login__form .form-input.error {
  border-color: #dc3545;
}

.modal-login__form .btn-login {
  width: 100%;
  padding: 0.875rem;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: 0.5rem;
}

.modal-login__form .btn-login:hover:not(:disabled) {
  background-color: #218838;
}

.modal-login__form .btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-login__form .form-links {
  text-align: center;
  margin-top: 1rem;
}

.modal-login__form .form-links a {
  color: #28a745;
  text-decoration: none;
  font-size: 0.9rem;
}

.modal-login__form .form-links a:hover {
  text-decoration: underline;
}

.modal-login__form .divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.modal-login__form .divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #e0e0e0;
}

.modal-login__form .divider span {
  background-color: white;
  padding: 0 1rem;
  position: relative;
  color: #999;
  font-size: 0.85rem;
}

/* Alerts do modal de login */
#loginAlertContainer .alert,
.modal-login__form .alert {
  padding: 1.25rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  text-align: left;
  line-height: 1.6;
  display: block;
  animation: slideDown 0.3s ease-out;
}

#loginAlertContainer .alert strong,
.modal-login__form .alert strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#loginAlertContainer .alert small,
.modal-login__form .alert small {
  display: block;
  margin-top: 0.75rem;
  opacity: 0.9;
  font-size: 0.85rem;
  font-style: italic;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#loginAlertContainer .alert-error,
.modal-login__form .alert-error {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

#loginAlertContainer .alert-success,
.modal-login__form .alert-success {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
  text-align: center;
  font-weight: 500;
}

#loginAlertContainer .alert-warning,
.modal-login__form .alert-warning {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
  color: #856404;
  border: none;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    min-width: auto;
  }
  
  .modal-login {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .modal-login__logo {
    max-width: 100px;
  }
  
  .modal-login__title {
    font-size: 1.5rem;
  }
  .loading,
  .error-message,
  .empty-message {
    padding: 2rem 1rem;
  }
}

/* ============================================
   USER DROPDOWN
   ============================================ */
.header__login {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown__header {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.user-dropdown__header strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #1a1a1a;
  font-size: 0.95rem;
}

.user-dropdown__header small {
  display: block;
  color: #666;
  font-size: 0.85rem;
}

.user-dropdown__logout {
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  text-align: left;
  color: #dc3545;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.user-dropdown__logout:hover {
  background-color: #f5f5f5;
}
