/* ================================================================
   community.css — Amar Porashona
   Community Answer System Styles
================================================================ */

/* ── Community Section ── */
.community-section {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.community-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
  justify-content: space-between;
}
.community-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.community-toggle-btn.open {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.community-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.community-count-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.community-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.community-toggle-btn.open .community-chevron {
  transform: rotate(180deg);
}

/* ── Community Panel ── */
.community-panel {
  display: none;
  border: 1.5px solid var(--primary);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bg-card);
  overflow: hidden;
}
.community-panel.open { display: block; }

/* ── Existing Submissions ── */
.community-submissions {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.submission-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}

.submission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.submission-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-correction { background: #fef3c7; color: #92400e; }
.badge-explanation { background: #d1fae5; color: #065f46; }
.badge-wrong { background: #fee2e2; color: #991b1b; }

.submission-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.submission-author {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.submission-date {
  font-size: 10px;
  color: var(--text-muted);
}

.submission-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.submission-photo {
  width: 100%;
  max-width: 360px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.submission-photo:hover { opacity: 0.9; }

.submission-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.upvote-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.upvote-btn:hover { border-color: var(--primary); color: var(--primary); }
.upvote-btn.voted { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.verified-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--correct);
}

/* ── Empty state ── */
.community-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Submit Form ── */
.community-form-section {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  background: var(--bg-surface);
}

.community-form-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Type selector */
.submission-type-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.type-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.type-btn:hover { border-color: var(--primary); color: var(--primary); }
.type-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Form fields */
.community-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.form-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--primary);
}

.form-field textarea { min-height: 80px; }

/* Answer options for correction */
.answer-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ans-opt-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.ans-opt-btn:hover { border-color: var(--primary); color: var(--primary); }
.ans-opt-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.photo-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.photo-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.photo-upload-text {
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
}
.photo-upload-text span {
  color: var(--primary);
  font-weight: 600;
}
.photo-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  margin-top: 8px;
  display: none;
}

/* Submit button */
.community-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
}
.community-submit-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.community-submit-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* Login prompt */
.login-prompt {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-prompt a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Success message */
.submit-success {
  display: none;
  text-align: center;
  padding: 16px;
  color: var(--correct);
  font-size: 14px;
  font-weight: 600;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #86efac;
}

/* ── Photo Lightbox ── */
.photo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.photo-lightbox.open { display: flex; }
.photo-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ── Auth Modal ── */
.auth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal-overlay.open { display: flex; }

.auth-modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: inherit;
}

.auth-modal h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-modal p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 11px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--primary); }

.auth-submit-btn {
  padding: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.auth-submit-btn:hover { background: var(--primary-dark); }

.auth-error {
  font-size: 12px;
  color: var(--wrong);
  text-align: center;
  min-height: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.google-btn:hover { border-color: var(--primary); background: var(--primary-light); }

/* Responsive */
@media (max-width: 520px) {
  .form-row { flex-direction: column; }
  .answer-options { gap: 6px; }
  .ans-opt-btn { width: 36px; height: 36px; }
}