/* ========================================
   AnaTraf Download Auth Modal Styles
   ======================================== */

/* Modal Overlay */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.auth-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.auth-modal-overlay.active .auth-modal {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.auth-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.auth-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.auth-modal-close:hover {
  background: #e5e7eb;
}

.auth-modal-close svg {
  width: 20px;
  height: 20px;
  color: #6b7280;
}

/* Modal Body */
.auth-modal-body {
  padding: 24px;
}

/* Form Groups */
.auth-form-group {
  margin-bottom: 16px;
}

.auth-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.auth-form-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.auth-form-input:focus {
  outline: none;
  border-color: var(--color-primary, #0052CC);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.auth-form-input.error {
  border-color: #ef4444;
}

.auth-form-input:disabled {
  background: #f9fafb;
  cursor: not-allowed;
}

/* Input with Button Row */
.auth-input-row {
  display: flex;
  gap: 10px;
}

.auth-input-row .auth-form-input {
  flex: 1;
}

.auth-sms-btn {
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: var(--color-primary, #0052CC);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.auth-sms-btn:hover:not(:disabled) {
  background: var(--color-primary-dark, #003D99);
}

.auth-sms-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Error Message */
.auth-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.auth-error.show {
  display: block;
}

/* Submit Button */
.auth-submit-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--color-primary, #0052CC);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin-top: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
  background: var(--color-primary-dark, #003D99);
}

.auth-submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.auth-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Secondary Button */
.auth-secondary-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary, #0052CC);
  background: transparent;
  border: 1px solid var(--color-primary, #0052CC);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-top: 12px;
}

.auth-secondary-btn:hover {
  background: rgba(0, 82, 204, 0.05);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: #9ca3af;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.auth-divider span {
  padding: 0 16px;
}

/* Agreement Text */
.auth-agreement {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-top: 16px;
}

.auth-agreement a {
  color: var(--color-primary, #0052CC);
  text-decoration: none;
}

.auth-agreement a:hover {
  text-decoration: underline;
}

/* Success State */
.auth-success {
  text-align: center;
  padding: 20px 0;
}

.auth-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #EFF6FF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-success-icon svg {
  width: 32px;
  height: 32px;
  color: #2563EB;
}

.auth-success h3 {
  font-size: 18px;
  color: #1a1a1a;
  margin: 0 0 8px;
}

.auth-success p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Loading Spinner */
.auth-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .auth-modal {
    max-width: calc(100% - 32px);
    margin: 16px;
  }

  .auth-modal-body {
    padding: 20px;
  }

  .auth-input-row {
    flex-direction: column;
  }

  .auth-sms-btn {
    width: 100%;
  }
}

/* ========================================
   Top Bar User Dropdown (login / nickname + logout)
   ======================================== */
.top-bar-user {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.top-bar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.top-bar-user-btn:hover,
.top-bar-user-btn:focus {
  background-color: rgba(0, 0, 0, 0.04);
  outline: none;
}

.top-bar-user-btn svg {
  flex-shrink: 0;
}

.top-bar-user-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-user-caret {
  transition: transform 0.2s ease;
}

.top-bar-user.open .top-bar-user-caret {
  transform: rotate(180deg);
}

.top-bar-user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  display: none;
  z-index: 200;
}

.top-bar-user.open .top-bar-user-menu {
  display: block;
}

.top-bar-user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  color: #1f2937;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.top-bar-user-menu-item:hover,
.top-bar-user-menu-item:focus {
  background-color: #f3f4f6;
  outline: none;
}

.top-bar-user-menu-danger {
  color: #dc2626;
}

.top-bar-user-menu-danger:hover,
.top-bar-user-menu-danger:focus {
  background-color: #fef2f2;
}

@media (max-width: 480px) {
  .top-bar-user-name {
    max-width: 80px;
  }
}
