/**
 * M4P Moodle Registration Form Styles
 */

/* Main Container */
.m4p-moodle-registration {
  max-width: 700px;
  margin: 40px auto;
  padding: 30px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.m4p-moodle-registration.already-logged-in {
  max-width: 500px;
  text-align: center;
}

/* Header */
.m4p-registration-header {
  margin-bottom: 30px;
  text-align: center;
}

.m4p-registration-header h2 {
  margin: 0 0 15px 0;
  color: #1976d2;
  font-size: 28px;
  font-weight: 600;
}

.m4p-registration-intro {
  margin: 0;
  color: #666;
  line-height: 1.6;
  font-size: 15px;
}

/* Notice Messages */
.m4p-notice {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 4px;
  border-left: 4px solid;
  font-size: 14px;
  line-height: 1.6;
}

.m4p-notice-hidden {
  display: none;
}

.m4p-notice-success {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

.m4p-notice-error {
  background: #ffebee;
  border-color: #f44336;
  color: #c62828;
}

.m4p-notice-info {
  background: #e3f2fd;
  border-color: #2196f3;
  color: #1565c0;
}

.m4p-notice p {
  margin: 0;
}

.m4p-notice p + p {
  margin-top: 10px;
}

/* Form Sections */
.m4p-form-section {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #e0e0e0;
}

.m4p-form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.m4p-form-section h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

/* Form Rows */
.m4p-form-row {
  margin-bottom: 20px;
}

.m4p-form-row:last-child {
  margin-bottom: 0;
}

.m4p-form-row-half {
  display: inline-block;
  width: calc(50% - 10px);
  margin-right: 20px;
  vertical-align: top;
}

.m4p-form-row-half:nth-child(even) {
  margin-right: 0;
}

.m4p-form-row label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.m4p-form-row .required {
  color: #d32f2f;
  font-weight: 700;
}

/* Input Fields */
.m4p-input-text {
  width: 100%;
  padding: 12px 15px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.m4p-input-text:focus {
  border-color: #ce529e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.m4p-input-text::placeholder {
  color: #999;
}

/* Field Descriptions */
.m4p-field-description {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* Password Strength */
.m4p-password-strength {
  margin-top: 15px;
}

.m4p-password-tips {
  padding: 15px;
  background: #f5f5f5;
  border-radius: 4px;
}

.m4p-tips-title {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: #333;
  font-size: 13px;
}

.m4p-password-tips ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.m4p-password-tips li {
  margin-bottom: 5px;
  color: #666;
  font-size: 13px;
}

.m4p-password-tips li:last-child {
  margin-bottom: 0;
}

/* Checkbox */
.m4p-form-row-checkbox {
  padding: 15px;
  background: #f9f9f9;
  border-radius: 4px;
}

.m4p-checkbox-label {
  display: flex;
  align-items: flex-start;
  font-weight: normal;
  cursor: pointer;
  line-height: 1.5;
}

.m4p-checkbox-label input[type="checkbox"] {
  margin: 3px 10px 0 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.m4p-checkbox-label a {
  color: #2196f3;
  text-decoration: none;
}

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

/* Form Actions */
.m4p-form-actions {
  margin: 30px 0;
  text-align: center;
}

.m4p-button {
  display: inline-block;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s, transform 0.1s;
}

.m4p-button:active {
  transform: translateY(1px);
}

.m4p-button-primary {
  background: #2196f3;
  color: #ffffff;
}

.m4p-button-primary:hover {
  background: #1976d2;
}

.m4p-button-primary:disabled {
  background: #90caf9;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Form Footer */
.m4p-form-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

.m4p-help-text {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.m4p-help-text a {
  color: #2196f3;
  text-decoration: none;
  font-weight: 600;
}

.m4p-help-text a:hover {
  text-decoration: underline;
}

/* Loading State */
.m4p-button.m4p-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.m4p-button.m4p-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: m4p-spin 0.6s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .m4p-moodle-registration {
    margin: 20px 15px;
    padding: 20px;
  }

  .m4p-registration-header h2 {
    font-size: 24px;
  }

  .m4p-form-row-half {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 20px;
  }

  .m4p-form-row-half:last-child {
    margin-bottom: 0;
  }

  .m4p-button {
    width: 100%;
    padding: 14px 20px;
  }
}

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

  .m4p-registration-header h2 {
    font-size: 22px;
  }

  .m4p-form-section h3 {
    font-size: 16px;
  }

  .m4p-input-text {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Terms of Use Modal */
.m4p-modal {
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.m4p-modal-content {
  position: relative;
  background: #ffffff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 700px;
  animation: m4p-modal-appear 0.2s ease;
}

@keyframes m4p-modal-appear {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.m4p-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.m4p-modal-close:hover {
  color: #333;
}

.m4p-modal-content h2 {
  margin: 0 0 20px 0;
  padding-right: 30px;
  color: #1976d2;
  font-size: 24px;
}

.m4p-terms-content {
  font-size: 14px;
  line-height: 1.7;
  color: #333;
}

.m4p-terms-content p {
  margin: 0 0 15px 0;
}

.m4p-terms-content p:last-child {
  margin-bottom: 0;
}

.m4p-terms-link {
  color: #2196f3;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.m4p-terms-link:hover {
  text-decoration: underline;
}

/* Disabled checkbox styling */
.m4p-checkbox-label input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.m4p-checkbox-label input[type="checkbox"]:disabled + * {
  opacity: 0.7;
}

@media (max-width: 480px) {
  .m4p-modal-content {
    padding: 20px;
    margin: 10px;
    width: calc(100% - 20px);
  }

  .m4p-modal-content h2 {
    font-size: 20px;
  }

  .m4p-terms-content {
    max-height: 40vh !important;
  }
}
