@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a78bfa;
  --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  --gradient-2: linear-gradient(135deg, #0ea5e9, #6366f1);
  --gradient-3: linear-gradient(135deg, #f43f5e, #ec4899);
  --gradient-hero: linear-gradient(160deg, #0a0e1a 0%, #1a1040 40%, #0f172a 70%, #0a0e1a 100%);
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ===== Background Decoration ===== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.04) 0%, transparent 60%);
  z-index: -1;
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-20px, 20px) rotate(1deg); }
  66% { transform: translate(20px, -20px) rotate(-1deg); }
}

/* ===== Container ===== */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Header ===== */
.survey-header {
  text-align: center;
  padding: 60px 20px 40px;
  position: relative;
}

.survey-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--gradient-1);
  border-radius: 2px;
}

.survey-header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.survey-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== Survey Card ===== */
.survey-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.survey-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: var(--transition);
}

.survey-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.survey-card:hover::before {
  opacity: 1;
}

/* ===== Question Styling ===== */
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gradient-1);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.8;
}

/* ===== Form Elements ===== */
.text-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Noto Sans Malayalam', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.text-input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(99, 102, 241, 0.05);
}

.text-input::placeholder {
  color: var(--text-muted);
}

textarea.text-input {
  min-height: 120px;
  resize: vertical;
}

/* ===== Radio Options ===== */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  position: relative;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.radio-option label::before {
  content: '';
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
  position: relative;
}

.radio-option label::after {
  content: '';
  position: absolute;
  left: 24px;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  transform: scale(0);
  transition: var(--transition);
}

.radio-option label:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
}

.radio-option input[type="radio"]:checked + label {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-1);
  color: var(--text-primary);
}

.radio-option input[type="radio"]:checked + label::before {
  border-color: var(--accent-1);
  background: var(--accent-1);
}

.radio-option input[type="radio"]:checked + label::after {
  transform: scale(1);
}

/* ===== Submit Button ===== */
.submit-section {
  text-align: center;
  padding: 20px 0 60px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 48px;
  background: var(--gradient-1);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  font-family: 'Noto Sans Malayalam', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s;
}

.btn-submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-submit:hover::before {
  left: 100%;
}

.btn-submit:active {
  transform: translateY(-1px);
}

/* ===== Success Overlay ===== */
.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.success-overlay.active {
  opacity: 1;
  visibility: visible;
}

.success-content {
  text-align: center;
  transform: scale(0.8) translateY(20px);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 20px;
}

.success-overlay.active .success-content {
  transform: scale(1) translateY(0);
}

.success-icon {
  width: 100px;
  height: 100px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 48px;
  animation: successPulse 2s ease-in-out infinite;
}

@keyframes successPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
}

.success-content h2 {
  font-size: 1.6rem;
  margin-bottom: 10px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-content p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 30px;
}

.btn-new-survey {
  padding: 12px 36px;
  background: transparent;
  color: var(--accent-3);
  border: 1px solid var(--accent-1);
  border-radius: var(--radius-xl);
  font-family: 'Noto Sans Malayalam', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-new-survey:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: all 0.5s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  margin: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

.login-card .lock-icon {
  width: 64px;
  height: 64px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 28px;
}

.login-field {
  margin-bottom: 16px;
  text-align: left;
}

.login-field label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.login-field input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--gradient-1);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
}

.login-error.show {
  display: block;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== Report Dashboard ===== */
.report-header {
  text-align: center;
  padding: 40px 20px 30px;
}

.report-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.report-header p {
  color: var(--text-secondary);
}

.report-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0 30px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-action:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-1);
  color: var(--text-primary);
}

.btn-action.danger:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ===== Chart Cards ===== */
.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  transition: var(--transition);
}

.chart-card:hover {
  border-color: rgba(99, 102, 241, 0.15);
}

.chart-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

/* ===== Response Table ===== */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 40px;
  overflow-x: auto;
}

.table-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.response-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 900px;
}

.response-table th {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--glass-border);
}

.response-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.response-table tr:hover td {
  background: rgba(99, 102, 241, 0.03);
  color: var(--text-primary);
}

.no-data {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-data .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-data p {
  font-size: 1rem;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--glass-border);
}

.footer a {
  color: var(--accent-3);
  text-decoration: none;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .survey-header h1 {
    font-size: 1.5rem;
  }

  .survey-card {
    padding: 24px 20px;
  }

  .container {
    padding: 12px;
  }

  .login-card {
    padding: 36px 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-wrapper {
    height: 250px;
  }

  .report-header h1 {
    font-size: 1.4rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }
.delay-6 { animation-delay: 0.6s; opacity: 0; }
.delay-7 { animation-delay: 0.7s; opacity: 0; }
.delay-8 { animation-delay: 0.8s; opacity: 0; }
.delay-9 { animation-delay: 0.9s; opacity: 0; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
