/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&display=swap');

:root {
  --primary-color: #673ab7;
  --primary-light: #f0ebf8;
  --primary-hover: #512da8;
  --bg-color: #f0ebf8;
  --card-bg: #ffffff;
  --text-main: #202124;
  --text-secondary: #70757a;
  --text-muted: #5f6368;
  --error-color: #d93025;
  --border-color: #dadce0;
  --focus-border-color: #673ab7;
  --font-body: 'Inter', sans-serif;
  --font-title: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  padding: 12px 12px 60px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 640px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card Styling */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  word-wrap: break-word;
}

/* Active card state (Google Forms blue/purple left border on focus) */
.card.active-card {
  border-left: 6px solid var(--primary-color);
  padding-left: 19px; /* Subtract 5px from padding to offset border */
}

/* Error card state */
.card.error-card {
  border: 1px solid var(--error-color);
}

/* Title Card Specifics */
.title-card {
  border-top: 10px solid var(--primary-color);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Banner Image inside Title Card */
.banner-container {
  width: 100%;
  max-width: 640px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: #e2eeee;
  height: 160px;
}

.banner-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Header Text Styles */
.form-title {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.form-description {
  font-size: 14px;
  color: var(--text-main);
  white-space: pre-line;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-description p {
  margin-bottom: 4px;
}

/* Lists styling inside description */
.form-description ul {
  list-style: none;
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-description li {
  position: relative;
  padding-left: 28px;
}

.form-description li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
}

/* Form Questions */
.question-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 20px;
  display: inline-block;
  vertical-align: middle;
}

.required-star {
  color: var(--error-color);
  margin-left: 4px;
}

/* Text Input Styling (Underlined style) */
.input-wrapper {
  position: relative;
  margin-top: 10px;
  width: 100%;
  max-width: 360px;
}

.text-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  font-size: 14px;
  font-family: var(--font-body);
  background-color: transparent;
  color: var(--text-main);
  outline: none;
  transition: border-bottom-color 0.2s ease;
}

.text-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.input-focus-line {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: width 0.25s ease, left 0.25s ease;
}

.text-input:focus ~ .input-focus-line {
  width: 100%;
  left: 0;
}

/* Custom Radio Option Styles */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.radio-option:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

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

.custom-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-secondary);
  border-radius: 50%;
  margin-right: 12px;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

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

.custom-radio::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary-color);
  transition: transform 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46);
}

.radio-option input[type="radio"]:checked ~ .custom-radio::after {
  transform: translate(-50%, -50%) scale(1);
}

.option-text {
  font-size: 14px;
  color: var(--text-main);
  user-select: none;
  line-height: 1.4;
}

/* Error Messages */
.error-msg {
  display: none;
  color: var(--error-color);
  font-size: 12px;
  margin-top: 8px;
  align-items: center;
  gap: 8px;
}

.error-msg svg {
  fill: var(--error-color);
  flex-shrink: 0;
}

.error-card .error-msg {
  display: flex;
}

/* Action Buttons Footer */
.actions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 8px 0;
}

.submit-btn {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.submit-btn:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

.submit-btn:active {
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.clear-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clear-btn:hover {
  background-color: rgba(103, 58, 183, 0.05);
}

/* Form Progress Bar (Quota Indicator) */
.quota-progress-card {
  padding: 16px 24px;
  background-color: #ffffff;
  border-top: 4px solid #00bcd4;
  border-radius: 8px;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.quota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.quota-bar-bg {
  width: 100%;
  height: 8px;
  background-color: #e0f7fa;
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background-color: #00bcd4;
  width: 0%;
  transition: width 0.5s ease-in-out;
}

.quota-warning {
  margin-top: 6px;
  font-size: 11px;
  color: #ff9800;
  display: none;
}

.quota-full-banner {
  background-color: #ffebee;
  color: var(--error-color);
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: none;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

/* Success Card */
.success-container {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

.success-message {
  font-size: 14px;
  color: var(--text-main);
}

.success-link {
  color: #1a73e8;
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  margin-top: 16px;
  cursor: pointer;
}

.success-link:hover {
  text-decoration: underline;
}

/* Admin Dashboard Panel (The WOW Factor!) */
.admin-badge {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.admin-badge:hover {
  transform: scale(1.05);
  background-color: var(--primary-hover);
}

.admin-panel {
  position: fixed;
  top: 0;
  right: -450px;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background-color: white;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 200;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.admin-panel.open {
  right: 0;
}

.admin-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 199;
  display: none;
}

.admin-panel-overlay.open {
  display: block;
}

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

.admin-header h3 {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--primary-color);
}

.admin-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.admin-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-box {
  flex: 1;
  background-color: var(--primary-light);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}

.stat-box .num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-box .label {
  font-size: 11px;
  color: var(--text-secondary);
}

.data-table-container {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.data-table tr:hover {
  background-color: #f1f3f4;
}

.admin-actions {
  display: flex;
  gap: 10px;
}

.admin-btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  background-color: white;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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

.admin-btn.danger {
  color: var(--error-color);
  border-color: #ffcdd2;
}

.admin-btn.danger:hover {
  background-color: #ffebee;
}

.admin-btn.primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.admin-btn.primary:hover {
  background-color: var(--primary-hover);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom branding */
.forms-branding {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.forms-branding a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Responsive fixes */
@media (max-width: 660px) {
  body {
    padding: 0 0 40px 0;
  }
  .container {
    margin-top: 0;
    gap: 12px;
  }
  .card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 20px 16px;
  }
  .card.active-card {
    border-left: 6px solid var(--primary-color);
    padding-left: 10px;
  }
  .title-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  .banner-container {
    border-radius: 0;
    border-left: none;
    border-right: none;
    height: 140px;
  }
  .admin-panel {
    max-width: 100%;
    right: -100%;
  }
}
