* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #4a90d9;
  --primary-hover: #357abd;
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
  --text-color: #333;
  --text-muted: #666;
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;
  --border-color: #ddd;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 40px;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo h1 {
  color: var(--primary-color);
  font-size: 28px;
  font-weight: 700;
}

.logo p {
  color: var(--text-muted);
  margin-top: 5px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.form-group input.error {
  border-color: var(--error-color);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.3s;
}

.password-toggle:hover {
  color: var(--primary-color);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.error-message {
  color: var(--error-color);
  font-size: 13px;
  margin-top: 5px;
  display: none;
}

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

.btn {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.btn-link {
  background: none;
  color: var(--primary-color);
  padding: 0;
  font-weight: 500;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Form options - checkbox and forgot password */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.checkbox-label {
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
}

.forgot-password-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.form-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Form options (checkbox and forgot password) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 14px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.checkbox-label {
  color: var(--text-color);
}

.forgot-password-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s ease-in-out infinite;
  margin-right: 8px;
}

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

.dashboard-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.dashboard-content {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 40px;
}

.user-info {
  margin-bottom: 30px;
}

.user-info-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.user-info-label {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 5px;
}

.user-info-value {
  font-size: 18px;
  font-weight: 500;
}

.verification-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.verified {
  background: #d4edda;
  color: #155724;
}

.unverified {
  background: #fff3cd;
  color: #856404;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  width: auto;
  padding: 10px 20px;
}

.btn-secondary:hover {
  background: #5a6268;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-weight: 500;
  padding: 0;
}

.resend-btn:hover {
  text-decoration: underline;
}

.resend-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Success page */
.success-container {
  text-align: center;
}

.success-icon {
  font-size: 64px;
  color: var(--success-color);
  margin-bottom: 20px;
}

.success-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 10px;
}

.success-message {
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* Avatar styles */
.avatar-wrapper {
  position: relative;
  display: inline-block;
}

.avatar-upload-btn:hover {
  transform: scale(1.1);
  background: var(--primary-hover);
}

.avatar-upload-btn:active {
  transform: scale(0.95);
}

.avatar-delete-btn:hover {
  transform: scale(1.1);
  background: #c82333;
}

.avatar-delete-btn:active {
  transform: scale(0.95);
}

/* Top Navigation */
.top-nav {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

/* User Menu */
.user-menu-container {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.user-menu-btn:hover {
  background: var(--bg-color);
}

.user-menu-btn:focus {
  outline: none;
}

.user-avatar-small {
  width: 36px;
  height: 36px;
  position: relative;
  flex-shrink: 0;
}

.user-avatar-small img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.user-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
}

.dropdown-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.user-menu-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
}

.dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

.dropdown-item:hover {
  background: var(--bg-color);
  color: var(--primary-color);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Welcome Container */
.welcome-container {
  max-width: 800px;
  margin: 60px auto;
  padding: 20px;
  text-align: center;
}

.welcome-title {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.welcome-message {
  font-size: 18px;
  color: var(--text-muted);
}

/* Profile Page */
.profile-container {
  max-width: 600px;
  margin: 40px auto;
  padding: 0 20px;
}

.profile-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 40px;
}

.profile-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 30px;
  text-align: center;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.avatar-section {
  text-align: center;
  margin-bottom: 20px;
}

.avatar-section .avatar-wrapper {
  position: relative;
  display: inline-block;
}

.profile-card .avatar-wrapper img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--card-bg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-card .avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
}

.profile-card .avatar-upload-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.profile-card .avatar-upload-btn:hover {
  transform: scale(1.1);
  background: var(--primary-hover);
}

.profile-card .avatar-upload-btn:active {
  transform: scale(0.95);
}

.profile-card .avatar-upload-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.profile-card .avatar-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--error-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.profile-card .avatar-delete-btn:hover {
  transform: scale(1.1);
  background: #c82333;
}

.profile-card .avatar-delete-btn:active {
  transform: scale(0.95);
}

.profile-card .avatar-delete-btn svg {
  width: 16px;
  height: 16px;
}

.avatar-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 10px;
}

.form-section {
  margin-top: 10px;
}

.form-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 5px;
}

.section-hint {
  color: var(--text-muted);
  font-size: 13px;
}

.profile-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.profile-actions .btn {
  flex: 1;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

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

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  .card {
    padding: 30px 20px;
  }

  .form-options {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .nav-content {
    padding: 0 10px;
  }

  .nav-menu {
    gap: 20px;
  }

  .welcome-title {
    font-size: 32px;
  }

  .welcome-message {
    font-size: 16px;
  }

  .profile-container {
    margin: 20px auto;
    padding: 0 15px;
  }

  .profile-card {
    padding: 25px 20px;
  }

  .profile-title {
    font-size: 24px;
  }

  .profile-actions {
    flex-direction: column;
  }
}

/* OAuth Buttons */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-social:hover {
  background: #f5f7fa;
  border-color: #ccc;
}

.btn-social svg {
  flex-shrink: 0;
}

.btn-google:hover {
  background: #f8f9ff;
  border-color: #dbe4ff;
}

.btn-facebook:hover {
  background: #f0f4ff;
  border-color: #c4d5ff;
}

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.divider span {
  padding: 0 16px;
}