/**
 * Authentication Modal Styles
 * Styles for login/register modal, OAuth buttons, and form elements
 */

/* ========================================
   Modal Container & Overlay
   ======================================== */

.auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-modal-content {
  position: relative;
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  height: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.15);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide scrollbar but allow scrolling */
.auth-modal-content::-webkit-scrollbar {
  width: 0;
  display: none;
}

.auth-modal-content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================
   Close Button
   ======================================== */

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  color: #666;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  z-index: 10;
}

.auth-modal-close svg {
  width: 16px;
  height: 16px;
}

.auth-modal-close:hover {
  background: #e8e8e8;
  color: #000;
  transform: rotate(90deg);
}

.auth-modal-close:active {
  transform: rotate(90deg) scale(0.9);
}

/* ========================================
   Modal Header
   ======================================== */

.auth-modal-header {
  margin-bottom: 28px;
  text-align: center;
  padding-top: 8px;
}

.auth-modal-title {
  font-size: 26px;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.auth-modal-subtitle {
  font-size: 15px;
  color: #717171;
  margin: 0;
  font-weight: 400;
}

/* ========================================
   Tabs
   ======================================== */

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: #f5f5f5;
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #717171;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
  border-radius: 10px;
}

.auth-tab:hover {
  color: #1a1a1a;
}

.auth-tab.active {
  color: #1a1a1a;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   OAuth Buttons
   ======================================== */

.auth-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-oauth-btn {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e0e0e0;
  background: white;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.auth-oauth-btn:hover {
  border-color: #1a1a1a;
  background: #fafafa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-oauth-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.google-btn {
  color: #1a1a1a;
}

.apple-btn {
  color: #000;
  background: #000;
  border-color: #000;
  color: white;
}

.apple-btn:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.auth-oauth-btn svg {
  flex-shrink: 0;
}

/* ========================================
   Divider
   ======================================== */

.auth-divider {
  position: relative;
  text-align: center;
  margin: 20px 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e0e0e0 20%, #e0e0e0 80%, transparent);
}

.auth-divider span {
  position: relative;
  display: inline-block;
  padding: 0 16px;
  background: white;
  color: #999;
  font-size: 13px;
  font-weight: 500;
}

/* ========================================
   Forms
   ======================================== */

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: formFadeIn 0.3s ease;
}

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

.auth-form-group {
  margin-bottom: 18px;
}

.auth-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.auth-form-group input[type="text"],
.auth-form-group input[type="email"],
.auth-form-group input[type="password"],
.auth-form-group input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
  background: #fafafa;
}

.auth-form-group input:focus {
  outline: none;
  border-color: #FF385C;
  box-shadow: 0 0 0 4px rgba(255, 56, 92, 0.08);
  background: white;
}

.auth-form-group input::placeholder {
  color: #aaa;
}

/* ========================================
   Checkbox Groups
   ======================================== */

.checkbox-group {
  margin-bottom: 14px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #444;
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #FF385C;
}

.checkbox-label span {
  flex: 1;
  line-height: 1.5;
}

.checkbox-label a {
  color: #FF385C;
  text-decoration: none;
  font-weight: 600;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* ========================================
   Form Actions
   ======================================== */

.auth-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.auth-forgot-password {
  font-size: 14px;
  color: #FF385C;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-forgot-password:hover {
  color: #E31C5F;
  text-decoration: underline;
}

/* ========================================
   Messages (Error/Success)
   ======================================== */

.auth-error,
.auth-success {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: messageSlide 0.3s ease;
}

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

.auth-error {
  background: linear-gradient(135deg, #FFF5F5 0%, #FFE8E8 100%);
  border: 1px solid #FFCCCC;
  color: #C41E3A;
}

.auth-success {
  background: linear-gradient(135deg, #F0FFF4 0%, #E8FFE8 100%);
  border: 1px solid #C6F6D5;
  color: #0F5132;
}

/* ========================================
   Submit Button
   ======================================== */

.auth-submit-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #FF385C 0%, #E31C5F 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(255, 56, 92, 0.35);
  position: relative;
  overflow: hidden;
}

.auth-submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.auth-submit-btn:hover::before {
  left: 100%;
}

.auth-submit-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 56, 92, 0.45);
}

.auth-submit-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 56, 92, 0.3);
}

.auth-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(255, 56, 92, 0.2);
}

.auth-submit-btn:disabled::before {
  display: none;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .auth-modal {
    padding: 24px 16px;
    align-items: center;
  }

  .auth-modal-content {
    padding: 20px 20px 32px;
    max-width: 100%;
    border-radius: 20px;
    height: 480px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-modal-header {
    margin-bottom: 16px;
  }

  .auth-modal-title {
    font-size: 20px;
  }

  .auth-modal-subtitle {
    font-size: 13px;
  }

  .auth-tabs {
    margin-bottom: 16px;
    padding: 3px;
  }

  .auth-tab {
    padding: 8px 10px;
    font-size: 13px;
  }

  .auth-oauth-btn {
    font-size: 13px;
    padding: 11px 12px;
  }

  .auth-form-group {
    margin-bottom: 12px;
  }

  .auth-form-group label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .auth-form-group input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 12px;
  }

  .auth-submit-btn {
    padding: 13px 18px;
    font-size: 14px;
  }

  .auth-divider {
    margin: 14px 0;
  }

  .checkbox-label {
    font-size: 12px;
  }

  .checkbox-group {
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  .auth-modal {
    padding: 16px 12px;
  }

  .auth-modal-content {
    padding: 18px 16px 28px;
    border-radius: 16px;
    height: 450px;
    max-height: calc(100vh - 32px);
  }
}

/* 480px 이하 추가 스타일 */
@media (max-width: 480px) {
  .auth-modal-close {
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
  }

  .auth-modal-close svg {
    width: 14px;
    height: 14px;
  }

  .auth-modal-header {
    padding-top: 4px;
    margin-bottom: 14px;
  }

  .auth-modal-title {
    font-size: 18px;
  }

  .auth-modal-subtitle {
    font-size: 12px;
  }

  .auth-tabs {
    margin-bottom: 14px;
  }

  .auth-tab {
    font-size: 12px;
    padding: 8px 8px;
  }

  .auth-oauth-btn {
    padding: 10px 10px;
    font-size: 12px;
  }

  .auth-form-group {
    margin-bottom: 10px;
  }

  .auth-form-group label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .auth-form-group input {
    padding: 10px 10px;
  }

  .auth-submit-btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .auth-divider {
    margin: 12px 0;
  }

  .checkbox-label {
    font-size: 11px;
  }

  .checkbox-group {
    margin-bottom: 8px;
  }
}

/* 화면 높이가 작을 때 */
@media (max-height: 700px) {
  .auth-modal {
    padding: 12px;
  }

  .auth-modal-content {
    max-height: calc(100vh - 24px);
  }
}

@media (max-height: 600px) {
  .auth-modal {
    padding: 8px;
  }

  .auth-modal-content {
    max-height: calc(100vh - 16px);
    padding: 16px 14px 24px;
  }

  .auth-modal-header {
    margin-bottom: 10px;
  }

  .auth-modal-title {
    font-size: 16px;
  }

  .auth-form-group {
    margin-bottom: 8px;
  }

  .auth-form-group input {
    padding: 8px 10px;
  }

  .auth-submit-btn {
    padding: 10px;
  }

  .auth-tabs {
    margin-bottom: 12px;
  }

  .auth-divider {
    margin: 10px 0;
  }
}

/* ========================================
   Loading State
   ======================================== */

.auth-submit-btn:disabled::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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

/* ========================================
   Login Button (Header Component)
   ======================================== */

.auth-login-btn {
  padding: 10px 20px;
  background: white;
  color: #FF385C;
  border: 1px solid #FF385C;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.auth-login-btn:hover {
  background: #FF385C;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 56, 92, 0.3);
}

.auth-login-btn:active {
  transform: scale(0.98);
}

/* ========================================
   User Menu (Header Component)
   ======================================== */

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-menu-btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-menu-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF385C 0%, #E31C5F 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 9999;
}

.user-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: block;
  padding: 12px 16px;
  color: #222;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.user-menu-item:last-child {
  border-bottom: none;
}

.user-menu-item:hover {
  background: #f9f9f9;
}

.user-menu-item.logout {
  color: #C41E3A;
  font-weight: 600;
}

/* ========================================
   Login Menu Dropdown (Header Component)
   ======================================== */

.login-menu {
  position: relative;
}

.login-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 9999;
}

.login-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.login-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #222;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.login-menu-item:last-child {
  border-bottom: none;
}

.login-menu-item:hover {
  background: #f9f9f9;
}

.login-menu-item svg {
  color: #666;
  flex-shrink: 0;
}

/* ========================================
   Bottom Nav Login Modal (Mobile)
   ======================================== */

.bottom-nav-login-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 10000;
}

.bottom-nav-login-modal.active {
  opacity: 1;
  visibility: visible;
}

.bottom-nav-login-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  min-width: 280px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.2s;
}

.bottom-nav-login-modal.active .bottom-nav-login-content {
  transform: scale(1);
}

.bottom-nav-login-header {
  padding: 20px 20px 16px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.bottom-nav-login-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #222;
}

.bottom-nav-login-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  color: #222;
  text-decoration: none;
  font-size: 15px;
  transition: background 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.bottom-nav-login-item:last-child {
  border-bottom: none;
}

.bottom-nav-login-item:hover,
.bottom-nav-login-item:active {
  background: #f9f9f9;
}

.bottom-nav-login-item svg {
  color: #FF385C;
  flex-shrink: 0;
}

.bottom-nav-login-cancel {
  display: block;
  width: 100%;
  padding: 14px;
  background: #f5f5f5;
  border: none;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.bottom-nav-login-cancel:hover {
  background: #eee;
}
