/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Container */
.container {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-white);
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.settings-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.3s;
}

.settings-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Authentication Section */
.auth-section {
  margin-bottom: 24px;
}

.auth-notice {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
  margin-bottom: 24px;
}

.lock-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.auth-notice h3 {
  font-size: 24px;
  margin-bottom: 8px;
  color: white;
}

.auth-notice p {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.5;
}

.security-notice {
  background: var(--bg-light);
  border-left: 4px solid var(--success-color);
  padding: 16px;
  border-radius: 8px;
  margin-top: 20px;
}

.security-notice p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.security-notice p:last-child {
  margin-bottom: 0;
}

/* User Profile Section */
.user-profile {
  margin-bottom: 24px;
}

.profile-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 12px;
  color: white;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.2);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-details {
  display: flex;
  flex-direction: column;
}

.profile-details strong {
  font-size: 16px;
  margin-bottom: 2px;
}

.profile-details small {
  font-size: 13px;
  opacity: 0.9;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Social Login Section */
.social-login {
  margin-bottom: 24px;
}

.social-login h4 {
  text-align: center;
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.social-login h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.helper-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.social-buttons {
  display: grid;
  gap: 8px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.social-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.social-btn .icon {
  font-size: 18px;
  font-weight: 700;
}

.social-btn.google:hover { border-color: #4285f4; }
.social-btn.facebook:hover { border-color: #1877f2; }
.social-btn.instagram:hover { border-color: #e4405f; }
.social-btn.x:hover { border-color: #000000; }
.social-btn.whatsapp:hover { border-color: #25d366; }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

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

.divider span {
  padding: 0 12px;
  font-weight: 500;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.required {
  color: var(--error-color);
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.2s ease;
  background: var(--bg-white);
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input.autofilled {
  background: #f0fdf4;
  border-color: var(--success-color);
}

.help-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* CAPTCHA Container */
.captcha-container {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.captcha-container .g-recaptcha {
  transform: scale(0.95);
  transform-origin: center;
}

.captcha-container .help-text {
  text-align: center;
  font-size: 11px;
}

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

.submit-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

/* Status Messages */
.status-message {
  display: none;
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.status-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.status-message.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Footer Info Section */
.info-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.info-section h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.info-section ol {
  margin-left: 20px;
  margin-bottom: 16px;
}

.info-section li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.privacy-note {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 12px;
  background: var(--bg-light);
  border-radius: 6px;
  border-left: 3px solid var(--success-color);
}

/* Responsive Design */
@media (max-width: 480px) {
  .container {
    padding: 24px 20px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  body {
    padding: 12px;
  }
}

/* Backend Status Indicator */
#backend-status {
  margin-bottom: 20px;
}

.backend-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
}

.backend-status.status-checking {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  color: #856404;
}

.backend-status.status-success {
  background-color: #d4edda;
  border-left: 4px solid var(--success-color);
  color: #155724;
}

.backend-status.status-error {
  background-color: #f8d7da;
  border-left: 4px solid var(--error-color);
  color: #721c24;
}

.backend-status .status-icon {
  font-size: 18px;
  line-height: 1;
}

.backend-status .status-text {
  flex: 1;
}

.backend-status .retry-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

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

/* Settings Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.log-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.log-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.log-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

.log-controls button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.log-controls button:hover {
  background: var(--primary-hover);
}

#log-output {
  width: 100%;
  height: 400px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #1e1e1e;
  color: #d4d4d4;
  resize: vertical;
}

#log-status {
  margin-top: 10px;
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
}

#log-status.success {
  background: #d4edda;
  color: #155724;
}

#log-status.error {
  background: #f8d7da;
  color: #721c24;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Verification Section Styles */
.verification-section {
  margin: 24px 0;
  animation: fadeIn 0.3s ease-in;
}

.verification-card {
  background: var(--bg-light);
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.verification-card h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.verification-message {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.verification-message strong {
  color: var(--text-primary);
  font-weight: 600;
}

#verification-code {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 8px;
  font-family: 'Courier New', monospace;
}

.resend-btn {
  width: 100%;
  padding: 12px 24px;
  background: var(--bg-white);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.resend-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: var(--bg-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.resend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cancel-btn {
  width: 100%;
  padding: 10px 24px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-btn:hover {
  background: var(--bg-white);
  color: var(--text-primary);
}

#code-timer {
  font-weight: 600;
  color: var(--primary-color);
}

/* Duplicate Request Error Styles */
.duplicate-request-error {
  background: var(--bg-white);
  border: 2px solid var(--error-color);
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  text-align: center;
}

.duplicate-request-error p {
  margin: 10px 0;
  color: var(--text-primary);
}

.duplicate-request-error strong {
  color: var(--error-color);
  font-size: 1.1em;
}

.btn-warning {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-warning:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
}

