/* ================================================================
   Vien Feedback – Frontend Styles
   ================================================================ */

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

:root {
  --fb-primary:      #2563eb;
  --fb-primary-dark: #1d4ed8;
  --fb-accent:       #f59e0b;
  --fb-success:      #10b981;
  --fb-danger:       #ef4444;
  --fb-bg:           #ffffff;
  --fb-overlay:      rgba(15, 23, 42, 0.6);
  --fb-shadow:       0 25px 60px rgba(0,0,0,0.2);
  --fb-radius:       16px;
  --fb-font:         'Inter', sans-serif;
}

/* ── Floating Button ──────────────────────────────────────── */
#vien-feedback-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--fb-primary), #7c3aed);
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: var(--fb-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.45);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s;
  animation: vfb-pulse 3s ease-in-out infinite;
}

#vien-feedback-btn svg {
  flex-shrink: 0;
}

#vien-feedback-btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 40px rgba(37, 99, 235, 0.55);
  animation: none;
}

@keyframes vfb-pulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 8px 30px rgba(37,99,235,0.45); }
  50%       { transform: translateY(-4px); box-shadow: 0 14px 40px rgba(37,99,235,0.55); }
}

/* ── Overlay ──────────────────────────────────────────────── */
#vien-feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--fb-overlay);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: vfb-fade-in 0.25s ease;
}

#vien-feedback-overlay.active {
  display: flex;
}

@keyframes vfb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Popup Modal ──────────────────────────────────────────── */
#vien-feedback-modal {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 16px;
  background: var(--fb-bg);
  border-radius: var(--fb-radius);
  box-shadow: var(--fb-shadow);
  overflow: hidden;
  animation: vfb-slide-up 0.35s cubic-bezier(.34,1.56,.64,1);
}

@keyframes vfb-slide-up {
  from { transform: translateY(40px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Header */
.vfb-header {
  background: linear-gradient(135deg, var(--fb-primary), #7c3aed);
  padding: 28px 28px 24px;
  color: #fff;
  text-align: center;
}

.vfb-header h2 {
  margin: 0 0 6px;
  font-family: var(--fb-font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.vfb-header p {
  margin: 0;
  font-family: var(--fb-font);
  font-size: 13.5px;
  opacity: 0.88;
}

.vfb-emoji {
  font-size: 40px;
  margin-bottom: 10px;
  display: block;
}

/* Close button */
#vien-feedback-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 32px;
  text-align: center;
  transition: background 0.2s;
}

#vien-feedback-close:hover {
  background: rgba(255,255,255,0.35);
}

/* Body */
.vfb-body {
  padding: 28px 28px 24px;
}

/* Row */
.vfb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Form groups */
.vfb-group {
  margin-bottom: 16px;
}

.vfb-group label {
  display: block;
  font-family: var(--fb-font);
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.vfb-group input,
.vfb-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-family: var(--fb-font);
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  outline: none;
}

.vfb-group input:focus,
.vfb-group textarea:focus {
  border-color: var(--fb-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.vfb-group textarea {
  resize: vertical;
  min-height: 90px;
}

/* Star Rating */
.vfb-stars-label {
  display: block;
  font-family: var(--fb-font);
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.vfb-stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 18px;
}

.vfb-stars input[type="radio"] {
  display: none;
}

.vfb-stars label {
  font-size: 32px;
  color: #d1d5db;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}

.vfb-stars label:hover,
.vfb-stars label:hover ~ label,
.vfb-stars input[type="radio"]:checked ~ label {
  color: var(--fb-accent);
}

.vfb-stars label:hover {
  transform: scale(1.2);
}

/* Submit button */
.vfb-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--fb-primary), #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--fb-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 4px;
}

.vfb-submit:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.vfb-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Messages */
.vfb-msg {
  display: none;
  padding: 11px 16px;
  border-radius: 9px;
  font-family: var(--fb-font);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 14px;
}

.vfb-msg.success {
  background: #d1fae5;
  color: #065f46;
  display: block;
}

.vfb-msg.error {
  background: #fee2e2;
  color: #991b1b;
  display: block;
}

/* Success screen */
#vfb-success-screen {
  display: none;
  text-align: center;
  padding: 40px 28px 36px;
  animation: vfb-fade-in 0.4s ease;
}

#vfb-success-screen .vfb-success-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

#vfb-success-screen h3 {
  font-family: var(--fb-font);
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px;
}

#vfb-success-screen p {
  font-family: var(--fb-font);
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .vfb-row {
    grid-template-columns: 1fr;
  }
  #vien-feedback-btn span.vfb-btn-text {
    display: none;
  }
  #vien-feedback-btn {
    width: 54px;
    height: 54px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

/* ── Required star ────────────────────────────────────────── */
.vfb-req {
  color: var(--fb-danger);
}

/* ── Extra questions section ─────────────────────────────── */
.vfb-extra-questions {
  border-bottom: 1.5px dashed #e5e7eb;
  margin-bottom: 18px;
  padding-bottom: 4px;
}

/* Mô tả câu hỏi */
.vfb-q-desc {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  padding: 5px 10px;
  border-radius: 4px;
  margin: 4px 0 10px;
  line-height: 1.5;
}

/* Radio ngang hàng */
.vfb-radio-row {
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 8px 16px !important;
}

/* Textarea ghi chú dưới radio_text */
.vfb-radio-text-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
}

.vfb-note-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.vfb-radio-text-note textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-family: var(--fb-font);
  font-size: 13.5px;
  color: #111827;
  background: #f9fafb;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
  outline: none;
}

.vfb-radio-text-note textarea:focus {
  border-color: var(--fb-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Select dropdown in popup */
.vfb-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-family: var(--fb-font);
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.vfb-group select:focus {
  border-color: var(--fb-primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Radio / Checkbox options */
.vfb-option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vfb-option-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13.5px !important;
  font-weight: 400 !important;
  color: #374151;
  cursor: pointer;
  margin-bottom: 0 !important;
}

.vfb-option-label input[type="radio"],
.vfb-option-label input[type="checkbox"] {
  width: auto !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  accent-color: var(--fb-primary);
  width: 16px !important;
  height: 16px !important;
  cursor: pointer;
  flex-shrink: 0;
}

/* Make modal scrollable when there are many questions */
#vien-feedback-modal {
  max-height: 92vh;
  overflow-y: auto;
}

/* ── Urgent Banner ──────────────────────────────────────────── */
#vfb-urgent-banner {
  position: fixed;
  bottom: -100px;           /* ẩn bên dưới, JS thêm .visible để hiện */
  left: 0;
  right: 0;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: #fff;
  font-family: var(--fb-font);
  font-size: 14px;
  box-shadow: 0 -4px 24px rgba(220, 38, 38, 0.35);
  transition: bottom 0.4s cubic-bezier(.34,1.3,.64,1);
}

#vfb-urgent-banner.visible {
  bottom: 0;
}

.vfb-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
  animation: vfb-bell 1.2s ease-in-out infinite;
}

@keyframes vfb-bell {
  0%, 100% { transform: rotate(0); }
  20%       { transform: rotate(-15deg); }
  40%       { transform: rotate(15deg); }
  60%       { transform: rotate(-10deg); }
  80%       { transform: rotate(10deg); }
}

.vfb-banner-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
}

.vfb-banner-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  background: #fff;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  font-family: var(--fb-font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.vfb-banner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.vfb-banner-close {
  flex-shrink: 0;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  line-height: 28px;
  text-align: center;
  transition: background 0.2s;
}

.vfb-banner-close:hover {
  background: rgba(255,255,255,0.35);
}

@media (max-width: 480px) {
  #vfb-urgent-banner {
    flex-wrap: wrap;
    gap: 8px;
  }
  .vfb-banner-text { width: 100%; }
}
