/* Google Forms Style Redesign */
:root {
  --gf-primary: #673ab7;
  --gf-primary-dark: #5e35b1;
  --gf-primary-light: #f3e8ff;
  --gf-bg: #f1f3f4;
  --gf-card-bg: #ffffff;
  --gf-border: #dadce0;
  --gf-text-dark: #202124;
  --gf-text-light: #5f6368;
  --gf-red: #d93025;
  --gf-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --gf-shadow-focused: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
}

/* Base Form Styling Context */
.gf-theme-body {
  background-color: var(--gf-bg) !important;
  color: var(--gf-text-dark) !important;
  font-family: 'Roboto', 'Arial', sans-serif !important;
  padding: 40px 20px;
  min-height: 100vh;
}

/* If inside admin page panel, set wrapper styles */
.gf-admin-wrapper {
  background-color: var(--gf-bg) !important;
  padding: 30px 20px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.03);
}

/* Container */
.gf-container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Top Header Card */
.gf-header-card {
  background-color: var(--gf-card-bg);
  border-radius: 12px;
  box-shadow: var(--gf-shadow);
  padding: 28px 24px 24px;
  position: relative;
  margin-bottom: 16px;
  border-top: 10px solid var(--gf-primary);
  overflow: hidden;
}

.gf-header-title {
  font-family: 'Google Sans', 'Roboto', sans-serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 40px;
  color: var(--gf-text-dark);
  margin-bottom: 10px;
}

.gf-header-description {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--gf-text-light);
  margin-bottom: 16px;
}

.gf-header-required-note {
  font-size: 13px;
  color: var(--gf-red);
}

/* Section Header Card */
.gf-section-card {
  background-color: var(--gf-card-bg);
  border-radius: 12px;
  box-shadow: var(--gf-shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
  border-left: 6px solid var(--gf-primary);
}

.gf-section-title {
  font-family: 'Google Sans', 'Roboto', sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--gf-primary);
  margin-bottom: 4px;
}

.gf-section-desc {
  font-size: 13px;
  color: var(--gf-text-light);
}

/* Question Block Card */
.gf-question-card {
  background-color: var(--gf-card-bg);
  border-radius: 12px;
  box-shadow: var(--gf-shadow);
  padding: 24px;
  margin-bottom: 24px; /* Increased spacing between cards */
  border-left: 6px solid transparent;
  border-top: 1px solid rgba(0,0,0,0.02);
  border-right: 1px solid rgba(0,0,0,0.02);
  border-bottom: 1px solid rgba(0,0,0,0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gf-question-card:focus-within {
  border-left-color: var(--gf-primary);
  box-shadow: var(--gf-shadow-focused);
}

.gf-label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: var(--gf-text-dark);
  margin-bottom: 12px;
  word-wrap: break-word;
}

.gf-required-asterisk {
  color: var(--gf-red);
  margin-left: 4px;
}

.gf-question-description {
  font-size: 13px;
  color: var(--gf-text-light);
  margin-top: -6px;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* Input Fields */
.gf-input {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--gf-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  color: var(--gf-text-dark);
  background-color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gf-input:focus {
  border-color: var(--gf-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.gf-input::placeholder {
  color: #94a3b8;
}

textarea.gf-input {
  height: auto;
  min-height: 100px;
  resize: vertical;
}

/* Custom Styled Radio Button Group */
.gf-radio-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.gf-radio-option {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-size: 14px;
  color: var(--gf-text-dark);
  user-select: none;
  min-height: 24px;
}

.gf-radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.gf-radio-checkmark {
  position: relative;
  height: 20px;
  width: 20px;
  border: 2px solid var(--gf-text-light);
  border-radius: 50%;
  margin-right: 12px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gf-radio-option:hover input[type="radio"] ~ .gf-radio-checkmark {
  border-color: var(--gf-text-dark);
  background-color: rgba(95, 99, 104, 0.04);
}

.gf-radio-option input[type="radio"]:checked ~ .gf-radio-checkmark {
  border-color: var(--gf-primary);
}

.gf-radio-checkmark::after {
  content: "";
  position: absolute;
  display: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gf-primary);
}

.gf-radio-option input[type="radio"]:checked ~ .gf-radio-checkmark::after {
  display: block;
}

/* Custom Styled Checkbox Group */
.gf-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.gf-checkbox-option {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-size: 14px;
  color: var(--gf-text-dark);
  user-select: none;
  min-height: 24px;
}

.gf-checkbox-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.gf-checkbox-checkmark {
  position: relative;
  height: 20px;
  width: 20px;
  border: 2px solid var(--gf-text-light);
  border-radius: 4px;
  margin-right: 12px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gf-checkbox-option:hover input[type="checkbox"] ~ .gf-checkbox-checkmark {
  border-color: var(--gf-text-dark);
  background-color: rgba(95, 99, 104, 0.04);
}

.gf-checkbox-option input[type="checkbox"]:checked ~ .gf-checkbox-checkmark {
  border-color: var(--gf-primary);
  background-color: var(--gf-primary);
}

.gf-checkbox-checkmark::after {
  content: "";
  position: absolute;
  display: none;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.gf-checkbox-option input[type="checkbox"]:checked ~ .gf-checkbox-checkmark::after {
  display: block;
}

/* Searchable Dropdown Styles */
.gf-select-wrapper {
  position: relative;
  width: 100%;
}

.gf-select-search {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  padding-right: 40px;
  border: 1px solid var(--gf-border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--gf-text-dark);
  outline: none;
  background-color: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gf-select-search:focus {
  border-color: var(--gf-primary);
}

.gf-select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gf-text-light);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.gf-select-wrapper.open .gf-select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.gf-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #ffffff;
  border: 1px solid var(--gf-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}

.gf-select-wrapper.open .gf-select-dropdown {
  display: block;
}

.gf-select-option {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gf-text-dark);
  transition: background-color 0.15s ease;
}

.gf-select-option:hover {
  background-color: #f1f3f4;
}

.gf-select-option.selected {
  background-color: var(--gf-primary-light);
  color: var(--gf-primary);
  font-weight: 500;
}

.gf-select-no-results {
  padding: 12px 16px;
  color: var(--gf-text-light);
  font-size: 14px;
  text-align: center;
}

/* File Upload Component Styling */
.gf-file-upload {
  border: 1px dashed var(--gf-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.gf-file-upload:hover {
  border-color: var(--gf-primary);
  background-color: var(--gf-primary-light);
}

.gf-file-input {
  display: none;
}

.gf-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #ffffff;
  border: 1px solid var(--gf-border);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #1a73e8;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  margin-top: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.gf-file-btn:hover {
  background-color: #f8f9fa;
}

.gf-file-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--gf-text-light);
  word-break: break-all;
}

/* Progress Indicator */
.gf-progress-container {
  margin-bottom: 20px;
  background-color: var(--gf-card-bg);
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: var(--gf-shadow);
}

.gf-progress-text {
  font-size: 13px;
  color: var(--gf-text-light);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.gf-progress-bar-bg {
  background-color: #e8eaed;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.gf-progress-bar-fill {
  background-color: var(--gf-primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

/* Validation Styling */
.gf-error-text {
  color: var(--gf-red);
  font-size: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gf-question-card.has-error {
  border: 1px solid var(--gf-red);
}

.gf-question-card.has-error:focus-within {
  border-left-color: var(--gf-red);
}

/* Buttons Styling */
.gf-btn-submit {
  background-color: var(--gf-primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  height: 48px;
  padding: 0 32px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gf-btn-submit:hover {
  background-color: var(--gf-primary-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gf-btn-cancel {
  background-color: #ffffff;
  color: var(--gf-text-light);
  border: 1px solid var(--gf-border);
  border-radius: 8px;
  height: 48px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none !important;
}

.gf-btn-cancel:hover {
  background-color: #f8f9fa;
  border-color: #c0c4c9;
  color: var(--gf-text-dark);
}

.gf-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  margin-bottom: 24px;
}

.gf-actions-group {
  display: flex;
  gap: 12px;
}

/* Submit Spinner Overlay */
.gf-submit-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(255,255,255,0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(2px);
}

.gf-submit-overlay.active {
  display: flex;
}

.gf-spinner {
  display: inline-block;
  width: 48px;
  height: 48px;
  border: 4px solid rgba(103, 58, 183, 0.1);
  border-radius: 50%;
  border-top-color: var(--gf-primary);
  animation: gf-spin 0.8s linear infinite;
}

.gf-submit-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--gf-primary);
}

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

/* Success Message Dialog styling */
.gf-success-box {
  background-color: var(--gf-card-bg);
  border-radius: 12px;
  box-shadow: var(--gf-shadow);
  padding: 40px 24px;
  text-align: center;
  max-width: 600px;
  margin: 40px auto;
  border-top: 10px solid var(--gf-primary);
}

.gf-success-icon {
  font-size: 48px;
  color: #0f9d58;
  margin-bottom: 16px;
}

.gf-success-title {
  font-size: 24px;
  font-weight: 400;
  color: var(--gf-text-dark);
  margin-bottom: 12px;
}

.gf-success-desc {
  font-size: 14px;
  color: var(--gf-text-light);
  margin-bottom: 24px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .gf-theme-body {
    padding: 12px 10px;
  }
  .gf-question-card, .gf-header-card, .gf-section-card {
    padding: 18px 16px;
  }
  .gf-header-title {
    font-size: 26px;
    line-height: 32px;
  }
  .gf-btn-submit, .gf-btn-cancel, .gf-input, .gf-select-search {
    height: 44px;
  }
  .gf-actions-row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .gf-actions-group {
    flex-direction: column;
    width: 100%;
  }
  .gf-btn-submit, .gf-btn-cancel {
    width: 100%;
  }
}
