/**
 * Pupil Form Block - Combined Styles
 * Editor and Frontend
 */

/* ========================================
   EDITOR STYLES
   ======================================== */

.pupil-form-block-editor {
  padding: 20px;
  background: #f8f9fa;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  min-height: 200px;
}

.pupil-form-editor-preview {
  background: white;
  padding: 30px;
  border-radius: 6px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pupil-form-editor-preview .lock-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.8;
}

.pupil-form-editor-preview h3 {
  margin: 0 0 15px 0;
  font-size: 24px;
  color: #2c3e50;
}

/* No Form Selected State */
.no-form-selected {
  padding: 40px 20px;
}

.no-form-selected p {
  color: #666;
  margin: 10px 0;
  font-size: 16px;
}

.no-form-selected .warning {
  color: #e67e22;
  font-weight: 600;
  margin-top: 20px;
  padding: 15px;
  background: #fff3cd;
  border-radius: 4px;
}

/* Form Selected State */
.form-selected {
  text-align: left;
}

.form-details {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 4px;
  margin: 20px 0;
}

.form-details p {
  margin: 0 0 15px 0;
  color: #495057;
}

.form-details strong {
  color: #2c3e50;
}

.instruction-preview {
  font-style: italic;
  color: #6c757d;
  padding: 15px;
  background: white;
  border-left: 3px solid #3498db;
  margin: 15px 0 !important;
}

.key-input-preview {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.key-input-preview input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: white;
}

.key-input-preview button {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: not-allowed;
  opacity: 0.7;
}

.editor-note {
  margin-top: 20px;
  padding: 15px;
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  border-radius: 4px;
  text-align: left;
}

.editor-note p {
  margin: 0;
  color: #1565c0;
  font-size: 14px;
}

/* Inspector Controls Styles */
.components-panel__body .components-base-control {
  margin-bottom: 20px;
}

.components-panel__body .components-base-control__help {
  font-size: 12px;
  color: #757575;
  margin-top: 5px;
}

/* ========================================
   FRONTEND STYLES
   ======================================== */

/* Main Wrapper */
.pupil-form-wrapper {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

/* Authentication Gate */
.pupil-form-gate {
  background: white;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pupil-form-gate h3 {
  margin: 0 0 20px 0;
  font-size: 28px;
  color: #2c3e50;
  text-align: center;
}

.pupil-form-instructions {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 6px;
}

.pupil-form-instructions p {
  margin: 0;
  font-size: 16px;
  color: #495057;
  line-height: 1.6;
}

/* Authentication Form */
.pupil-form-auth {
  max-width: 500px;
  margin: 0 auto;
}

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

.pupil-key-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.pupil-key-input {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  transition: border-color 0.3s ease;
  font-family: monospace;
  letter-spacing: 1px;
  box-sizing: border-box;
}

.pupil-key-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.pupil-key-submit {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: #3498db;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.pupil-key-submit:hover {
  background: #2980b9;
}

.pupil-key-submit:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* Loading State */
.pupil-key-form.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Messages */
.pupil-form-message {
  margin-bottom: 20px;
  min-height: 0;
}

.pupil-form-message-content {
  padding: 15px 20px;
  border-radius: 6px;
  font-size: 15px;
  animation: slideDown 0.3s ease;
}

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

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

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

/* Remember Me Checkbox */
.remember-me-group {
  margin-bottom: 20px;
}

.remember-me-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
  color: #495057;
}

.remember-me-checkbox {
  width: auto;
  margin: 0 10px 0 0;
  cursor: pointer;
}

.remember-me-label span {
  font-size: 14px;
  line-height: 1.5;
}

/* Help Text */
.pupil-form-help {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid #e1e8ed;
}

.pupil-form-help p {
  font-size: 14px;
  color: #6c757d;
  line-height: 1.6;
  text-align: center;
  margin: 0;
}

.pupil-form-help strong {
  color: #495057;
  display: block;
  margin-bottom: 5px;
}

/* Unlocked Form Section */
.pupil-form-unlocked {
  background: white;
  border: 2px solid #28a745;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pupil-form-unlocked h3 {
  margin: 0 0 20px 0;
  font-size: 28px;
  color: #2c3e50;
}

.pupil-form-info {
  background: #d4edda;
  padding: 15px 20px;
  border-radius: 6px;
  border-left: 4px solid #28a745;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.pupil-info-text {
  flex: 1;
  min-width: 200px;
}

.pupil-form-info p {
  margin: 0 0 5px 0;
  color: #155724;
  font-size: 15px;
}

.pupil-form-info p:last-child {
  margin-bottom: 0;
}

.pupil-form-info strong {
  font-weight: 600;
}

.edit-notice {
  color: #0c5460;
  background: #d1ecf1;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 10px !important;
  font-size: 14px !important;
}

/* Sign Out Button */
.pupil-form-signout {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: #dc3545;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

.pupil-form-signout:hover {
  background: #c82333;
}

.pupil-form-signout:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* Formidable Form Overrides */
.pupil-form-content .frm_forms {
  margin-top: 0;
}

.pupil-form-content .frm_form_field {
  margin-bottom: 20px;
}

/* Error Display */
.pupil-form-error {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  margin: 20px 0;
}

.pupil-form-error p {
  margin: 0;
  color: #856404;
  font-size: 16px;
}

/* Email Verification Steps */
.pupil-form-email-step,
.pupil-form-code-step {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #e1e8ed;
}

.email-verification-info,
.code-verification-info {
  text-align: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #e3f2fd;
  border-radius: 6px;
  border-left: 4px solid #2196f3;
}

.email-verification-info p,
.code-verification-info p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #1565c0;
}

.email-verification-info p:last-child,
.code-verification-info p:last-child {
  margin-bottom: 0;
}

.email-verification-info strong,
.code-verification-info strong {
  display: block;
  font-size: 16px;
  margin-bottom: 8px;
  color: #0d47a1;
}

.pupil-email-input,
.pupil-code-input {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.pupil-code-input {
  font-family: monospace;
  letter-spacing: 3px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}

.pupil-email-input:focus,
.pupil-code-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.pupil-email-submit,
.pupil-code-submit {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: #3498db;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-bottom: 10px;
}

.pupil-email-submit:hover,
.pupil-code-submit:hover {
  background: #2980b9;
}

.pupil-email-submit:disabled,
.pupil-code-submit:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.pupil-code-resend {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #3498db;
  background: white;
  border: 2px solid #3498db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pupil-code-resend:hover {
  background: #3498db;
  color: white;
}

/* Info message style */
.pupil-form-info-message {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  color: #1565c0;
}

/* Responsive Styles */
@media screen and (max-width: 640px) {
  .pupil-form-gate,
  .pupil-form-unlocked {
    padding: 20px;
  }

  .pupil-form-gate h3,
  .pupil-form-unlocked h3 {
    font-size: 22px;
  }

  .pupil-form-instructions {
    padding: 15px;
  }

  .pupil-form-instructions p {
    font-size: 14px;
  }

  .pupil-key-input,
  .pupil-key-submit {
    font-size: 14px;
  }

  .pupil-form-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .pupil-form-signout {
    width: 100%;
    text-align: center;
  }

  .remember-me-label span {
    font-size: 13px;
  }

  .pupil-code-input {
    font-size: 18px;
    letter-spacing: 2px;
  }

  .email-verification-info strong,
  .code-verification-info strong {
    font-size: 15px;
  }

  .email-verification-info p,
  .code-verification-info p {
    font-size: 13px;
  }
}
