/**
 * Authentication Workflow Styles
 * Handles modals, cards, and interactive elements
 */

:root {
  --primary-color: #000;
  --secondary-color: #fff;
  --border-color: #e0e0e0;
  --error-color: #ff4444;
  --success-color: #00cc00;
  --modal-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  --transition-speed: 0.3s;
  --border-radius: 8px;
}

/* Modal Container */
#auth-workflow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

/* Base Modal Styles */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

.auth-modal.active {
  opacity: 1;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.auth-modal-content {
  position: relative;
  z-index: 2;
  background-color: var(--secondary-color);
  border-radius: var(--border-radius);
  box-shadow: var(--modal-shadow);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-speed) ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-color);
}

.auth-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-close:hover {
  color: var(--primary-color);
}

/* Modal Body */
.auth-modal-body {
  padding: 24px;
}

.auth-modal-body.text-center {
  text-align: center;
}

/* Card Type Options */
.card-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.common-issue-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 20px 0;
}

.common-issue-options .card-option {
  align-items: center;
  display: flex;
  justify-content: space-between;
  text-align: left;
}

.common-issue-options .card-option h3 {
  margin: 0;
}

.card-option {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.card-option:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-option h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.card-option p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #666;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
  padding: 10px 24px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: #333;
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-full {
  width: 100%;
  margin-top: 20px;
}

/* Loading Spinner */
.spinner {
  width: 50px;
  height: 50px;
  margin: 30px auto;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading/Processing Text */
#loadingContent p,
#authFailedContent p,
#processingModal p {
  font-size: 16px;
  color: #666;
  margin: 16px 0;
}

/* Error Styling */
.error-title {
  color: var(--error-color);
  font-size: 20px;
  font-weight: 600;
  margin: 20px 0 10px 0;
}

.error-description {
  color: #666;
  font-size: 14px;
  margin: 0 0 20px 0;
}

/* Phrase Selection */
.phrase-selection-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.phrase-selection-btn {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  background-color: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.phrase-selection-btn:hover {
  border-color: var(--primary-color);
  background-color: #f9f9f9;
  transform: translateY(-2px);
}

.phrase-count {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.phrase-desc {
  font-size: 12px;
  color: #999;
}

/* Phrase Entry */
.phrase-instruction {
  text-align: center;
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.phrase-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.phrase-input-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phrase-input-item label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.phrase-word-input {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
  transition: border-color 0.2s;
}

.phrase-word-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.phrase-word-input:placeholder-shown {
  color: #ccc;
}

/* Responsive Design */
@media (max-width: 600px) {
  .auth-modal-content {
    width: 95%;
  }

  .auth-modal-header {
    padding: 16px;
  }

  .auth-modal-header h2 {
    font-size: 20px;
  }

  .auth-modal-body {
    padding: 16px;
  }

  .card-type-options,
  .phrase-selection-options {
    grid-template-columns: 1fr;
  }

  .phrase-input-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .card-option,
  .phrase-selection-btn {
    padding: 16px;
  }

  .card-option h3 {
    font-size: 16px;
  }
}

/* Accessibility */
.btn-primary:focus,
.phrase-selection-btn:focus,
.phrase-word-input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Smooth transitions for modal switching */
.auth-modal {
  animation: fadeIn var(--transition-speed) ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
