/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Light theme (day) colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f0f0;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e0e0e0;
  --border-light: #f0f0f0;
  --shadow-color: rgba(0,0,0,0.1);
  --shadow-light: rgba(0,0,0,0.05);
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --success-color: #51cf66;
  --error-color: #ff6b6b;
  --warning-color: #ffd43b;
  --info-color: #74b9ff;
  /* Glass variables */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

/* Dark theme (night) colors */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --border-light: #505050;
    --shadow-color: rgba(0,0,0,0.3);
    --shadow-light: rgba(0,0,0,0.2);
    --card-bg: #2d2d2d;
    --input-bg: #2d2d2d;
    --success-color: #40c057;
    --error-color: #ee5a52;
    --warning-color: #fcc419;
    --info-color: #0984e3;
    --glass-bg: rgba(20, 20, 20, 0.35);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  transition: all 0.3s ease;
}

/* Navbar Styles */
.navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 20px var(--shadow-color);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
}

.nav-logo i {
  margin-right: 0.5rem;
  font-size: 1.8rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

/* Main Content */
.main-content {
  margin-top: 80px;
  min-height: calc(100vh - 80px);
}

/* Home Section */
.home-section {
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.hero-container {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 3rem;
  align-items: center;
  margin-bottom: 4rem;
  padding: 2rem;
  background: var(--glass-bg);
  border-radius: 20px;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.hero-content {
  text-align: left;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.greeting {
  color: #667eea;
  font-weight: 300;
}

.time {
  color: #764ba2;
  font-weight: 700;
  font-size: 2.5rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Weather Widget */
.weather-widget {
  background: linear-gradient(135deg, rgba(116, 185, 255, 0.25) 0%, rgba(9, 132, 227, 0.25) 100%);
  color: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  text-align: center;
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid var(--glass-border);
}

.weather-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.weather-icon {
  font-size: 3rem;
}

.weather-info {
  text-align: left;
}

.temperature {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.weather-desc {
  font-size: 1rem;
  opacity: 0.9;
}

.weather-location {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 1rem;
  text-align: center;
  font-style: italic;
}

.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.weather-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.weather-item i {
  opacity: 0.8;
}

.weather-actions {
  margin-top: 1rem;
  text-align: center;
}

.weather-test-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.weather-test-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.weather-test-btn i {
  font-size: 0.9rem;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.feature-card {
  background: var(--glass-bg);
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px var(--shadow-color);
}

.feature-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: white;
  font-size: 2rem;
}

.feature-card h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Quick Actions */
.quick-actions {
  text-align: center;
  margin-bottom: 4rem;
}

.quick-actions h2 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 2rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  color: var(--warning-color);
  padding: 12px 10px;
  margin: 20px;
  border: none;
  border-radius: 50px;
  font-size: 17.6px;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.action-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.action-btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.action-btn.secondary {
  background: var(--card-bg);
  color: #667eea;
  border: 2px solid #667eea;
}

.action-btn.secondary:hover {
  background: #667eea;
  color: white;
  transform: translateY(-3px);
}

/* Question Processor Section */
.question-processor-section {
  padding: 2rem;
  background: transparent;
  min-height: calc(100vh - 80px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.question-processor-section h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 2.5rem;
  text-align: center;
}

.description {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

/* Data frames styles */
.data-frames-container {
  width: 100%;
}
.data-frame {
  width: 100%;
}
.frame-textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: var(--input-bg);
  color: var(--text-primary);
}

.data-frames-controls .frames-header h3 {
  margin: 0;
}
.data-frames-controls .action-btn {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* Make input-group and data-frame consistent */
.input-group, .data-frame {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.input-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

#jsonInput {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--input-bg);
  color: var(--text-primary);
  resize: vertical;
  font-family: monospace;
  font-size: 0.95rem;
}

/* File upload area styling to match frames */
.file-upload-section .file-upload-area {
  background: linear-gradient(180deg, rgba(102,126,234,0.06), rgba(118,75,162,0.04));
  border: 2px dashed rgba(102,126,234,0.35);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.file-upload-section .file-upload-area:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(102,126,234,0.06);
}

.file-upload-section .file-upload-area i {
  font-size: 2.4rem;
  color: #667eea;
  display:block;
  margin-bottom: 0.6rem;
}

.data-frame .frame-textarea, .input-group .frame-textarea, #jsonInput.frame-textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: var(--input-bg);
  color: var(--text-primary);
}

.frames-header h3 {
  font-size: 1.05rem;
}

.data-frame .action-btn, .frames-header .action-btn, .input-section > div > .action-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.data-frame .action-btn:hover, .frames-header .action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Ensure new frames appear above file upload visually (container order handled in HTML) */
.data-frames-container {
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* Input Section */
.input-section {
  background: var(--glass-bg);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: var(--glass-shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}

.input-group {
  margin-bottom: 0px;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.input-group textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: var(--input-bg);
  color: var(--text-primary);
}

.input-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

/* File Upload */
.file-upload-section {
  margin-bottom: 2rem;
}

.file-upload-area {
  border: 2px dashed #667eea;
  border-radius: 15px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--glass-bg);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}

.file-upload-area:hover {
  background: var(--bg-secondary);
  border-color: #764ba2;
}

.file-upload-area i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.file-upload-area p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.click-upload {
  color: #667eea;
  font-weight: 600;
  text-decoration: underline;
}

/* Processing Options */
.processing-options {
  margin-bottom: 2rem;
}

.processing-options h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  color: var(--text-primary);
}

.option-item:hover {
  background: var(--bg-tertiary);
}

.option-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #667eea;
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
}

.option-item input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #667eea;
  font-weight: bold;
}

/* Process Button */
.process-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 auto;
}

.process-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Results Section */
.results-section {
  background: var(--glass-bg);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}

.results-section h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.summary-item {
  text-align: center;
}

.summary-item .label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.summary-item .value {
  display: block;
  color: #667eea;
  font-size: 1.5rem;
  font-weight: 700;
}

.questions-list {
  margin-bottom: 2rem;
}

.export-section {
  text-align: center;
}

.export-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.export-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--glass-bg);
  margin: 15% auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--glass-shadow);
  animation: modalSlideIn 0.3s ease;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 15px 15px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.close {
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.close:hover {
  opacity: 0.7;
}

.modal-body {
  padding: 2rem;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-options .export-btn {
  width: 100%;
  justify-content: center;
}

/* Background Animation */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

/* New multi-layer starry sky */
.sky-gradient,
.stars-small,
.stars-medium,
.stars-large,
.shooting-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.sky-gradient {
  background: radial-gradient(ellipse at 50% 20%, #0b1026 0%, #090f20 45%, #070b16 100%);
  animation: skyDrift 60s ease-in-out infinite alternate;
}

.stars-small {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="10" cy="20" r="0.6" fill="white"/><circle cx="35" cy="40" r="0.6" fill="white"/><circle cx="60" cy="15" r="0.6" fill="white"/><circle cx="85" cy="55" r="0.6" fill="white"/><circle cx="25" cy="75" r="0.6" fill="white"/><circle cx="70" cy="85" r="0.6" fill="white"/></svg>');
  background-repeat: repeat;
  background-size: 300px 300px;
  opacity: 0.45;
  animation: twinkleA 14s linear infinite;
}

.stars-medium {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="30" r="1" fill="white"/><circle cx="55" cy="60" r="1" fill="white"/><circle cx="80" cy="25" r="1" fill="white"/><circle cx="40" cy="85" r="1" fill="white"/></svg>');
  background-repeat: repeat;
  background-size: 400px 400px;
  opacity: 0.35;
  animation: twinkleB 22s linear infinite;
}

.stars-large {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="30" cy="20" r="1.6" fill="white"/><circle cx="75" cy="45" r="1.6" fill="white"/><circle cx="50" cy="80" r="1.6" fill="white"/></svg>');
  background-repeat: repeat;
  background-size: 600px 600px;
  opacity: 0.25;
  animation: twinkleC 32s linear infinite;
}

.shooting-stars::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -10%;
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow: 50vw 10vh #ffffff, 20vw 60vh #ffffff, 80vw 30vh #ffffff;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.7));
  animation: shoot 6s linear infinite;
}

@keyframes skyDrift {
  0% { filter: hue-rotate(0deg) brightness(1); }
  100% { filter: hue-rotate(-5deg) brightness(1.05); }
}

@keyframes twinkleA {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 0.6; transform: translateY(-2px); }
}

@keyframes twinkleB {
  0%, 100% { opacity: 0.25; transform: translateX(0); }
  50% { opacity: 0.45; transform: translateX(-4px); }
}

@keyframes twinkleC {
  0%, 100% { opacity: 0.2; transform: translate(0,0); }
  50% { opacity: 0.35; transform: translate(-6px, 3px); }
}

@keyframes shoot {
  0% { transform: translate(0,0) rotate(20deg); opacity: 0; }
  5% { opacity: 1; }
  50% { transform: translate(120vw, 60vh) rotate(20deg); opacity: 0; }
  100% { opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .time {
    font-size: 2rem;
  }
  
  .nav-container {
    padding: 0 1rem;
  }
  
  .nav-menu {
    gap: 1rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
  }
}

/* Time-based theme switching */
@media (prefers-color-scheme: dark) {
  .background-animation .stars {
    opacity: 0.6;
  }
  
  .background-animation .clouds {
    opacity: 0.05;
  }
  
  .hero-container {
    background: rgba(45, 45, 45, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Additional color adjustments for better contrast */
.feature-card:hover {
  border-color: var(--border-color);
}

.option-item:hover {
  background: var(--bg-tertiary);
}

.file-upload-area:hover {
  background: var(--bg-secondary);
}

/* Notification styles for better visibility */
.notification {
  box-shadow: 0 5px 20px var(--shadow-color);
  border: 1px solid var(--border-light);
}
