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

:root {
  --bg-primary: #000000;
  --bg-secondary: #111111;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --accent: #98ff98;
  --accent-hover: #7ae87a;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.03);
  --danger: #ff4444;
  --success: #00C851;
  --warning: #ffbb33;
}

.light-mode {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --text-primary: #333333;
  --text-secondary: #666666;
  --accent: #00cc66;
  --accent-hover: #00994d;
  --border: rgba(0, 0, 0, 0.1);
  --card-bg: #f0f0f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 90px 16px 80px; /* Increased top padding for top bar */
  position: relative;
  min-height: 100vh;
}

/* ==================== TOP BAR (LOGO + INSTALL BUTTON) ==================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1001;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(152, 255, 152, 0.3);
}

.logo-text {
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 2px 5px rgba(152, 255, 152, 0.3);
}

.install-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 30px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(152, 255, 152, 0.3);
}

.install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(152, 255, 152, 0.5);
}

.install-btn:active {
  transform: translateY(0);
}

.install-btn i {
  font-size: 18px;
}

/* ==================== BOTTOM NAVIGATION ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  z-index: 1000;
  max-width: 480px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 12px;
  gap: 4px;
  transition: color 0.3s;
  flex: 1;
  cursor: pointer;
}

.nav-item i {
  font-size: 24px;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active i {
  text-shadow: 0 0 10px rgba(152, 255, 152, 0.5);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  padding-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

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

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(152, 255, 152, 0.3);
  text-align: center;
}

/* ==================== HOME PAGE ==================== */
.hero-section {
  text-align: center;
  margin: 20px 0 32px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
}

.hero-title {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-title i {
  color: var(--accent);
  font-size: 32px;
  background: linear-gradient(45deg, #f09433, #d62976, #962fbf, #4f5bd5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 16px;
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  background: var(--accent);
  color: #000;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(152, 255, 152, 0.3);
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(152, 255, 152, 0.5);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(152, 255, 152, 0.3);
}

.btn-secondary {
  background: #333;
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover {
  background: #444;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
  max-width: 100px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 18px;
  max-width: 320px;
}

.btn-full {
  width: 100%;
  max-width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==================== FEATURES GRID ==================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 32px 0;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}

.feature-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  background: linear-gradient(45deg, #f09433, #d62976);
  box-shadow: 0 5px 15px rgba(240, 148, 51, 0.3);
}

.feature-icon.posts {
  background: linear-gradient(45deg, #833ab4, #fd1d1d);
}

.feature-icon.stories {
  background: linear-gradient(45deg, #4c68d7, #c32aa3);
}

.feature-card h3 {
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--accent);
}

.feature-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==================== HOW IT WORKS ==================== */
.how-it-works {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  margin-top: 32px;
}

.section-title {
  color: var(--accent);
  text-align: center;
  margin-bottom: 24px;
  font-size: 22px;
  font-weight: bold;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-primary);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.step-number {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(152, 255, 152, 0.3);
}

.step-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.step-content i {
  font-size: 22px;
  color: var(--accent);
}

.step-content p {
  font-size: 14px;
  font-weight: 500;
}

/* ==================== DOWNLOAD PAGE ==================== */
.download-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  margin-top: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

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

.input-label {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 16px;
}

.input-field {
  width: 100%;
  padding: 18px;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.3s;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(152, 255, 152, 0.2);
}

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

.input-hint {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-hint i {
  color: var(--accent);
  font-size: 14px;
}

/* ==================== LOADING STATE ==================== */
.loading-state {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  padding: 30px;
  border-radius: 20px;
  z-index: 9999;
  text-align: center;
  min-width: 220px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state p {
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
}

/* ==================== RESULT AREA / PREVIEW CARD ==================== */
.preview-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  margin-top: 20px;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to right, var(--card-bg), transparent);
}

.preview-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(45deg, #f09433, #d62976, #962fbf, #4f5bd5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.preview-info {
  flex: 1;
}

.preview-info h4 {
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 18px;
}

.preview-info p {
  color: var(--text-secondary);
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 8px;
}

.preview-info span {
  font-size: 13px;
}

.preview-media {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-primary);
}

.preview-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 16px;
  object-fit: contain;
  margin: 0 auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.preview-media video {
  max-height: 400px;
  width: 100%;
  border-radius: 16px;
  background: #000;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.preview-actions {
  padding: 20px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.preview-actions button {
  flex: 1;
  margin: 0;
}

/* ==================== GALLERY STYLES ==================== */
.gallery-container {
  margin-top: 20px;
  padding: 0 16px 16px;
}

.gallery-title {
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #222;
  cursor: pointer;
  transition: transform 0.3s;
  border: 1px solid var(--border);
}

.gallery-item:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  display: flex;
  justify-content: flex-end;
}

.gallery-download-btn {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: black;
  font-size: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 28px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== HISTORY PAGE ==================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.history-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
  cursor: pointer;
}

.history-item:hover {
  transform: translateX(5px);
  border-color: var(--accent);
  background: rgba(152, 255, 152, 0.05);
}

.history-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(45deg, var(--accent), #00cc66);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 28px;
  box-shadow: 0 4px 15px rgba(152, 255, 152, 0.3);
}

.history-details {
  flex: 1;
}

.history-url {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 15px;
}

.history-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.history-meta span {
  background: var(--bg-primary);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.empty-state {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 60px 20px;
  text-align: center;
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(152, 255, 152, 0.2); }
  70% { box-shadow: 0 0 0 10px rgba(152, 255, 152, 0); }
  100% { box-shadow: 0 0 0 0 rgba(152, 255, 152, 0); }
}

.empty-icon {
  font-size: 80px;
  color: var(--border);
}

.empty-state h3 {
  color: var(--accent);
  font-size: 24px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 16px;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s;
}

.setting-item:hover {
  border-color: var(--accent);
}

.setting-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.setting-info i {
  font-size: 28px;
  color: var(--accent);
  background: rgba(152, 255, 152, 0.1);
  padding: 12px;
  border-radius: 16px;
}

.setting-info h3 {
  font-size: 17px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.setting-info p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(30px);
}

/* Quality Selector */
.quality-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.quality-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.quality-btn.active {
  background: var(--accent);
  color: #000;
  box-shadow: 0 4px 10px rgba(152, 255, 152, 0.3);
}

/* About Section */
.about-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  margin-top: 16px;
}

.about-section h3 {
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 20px;
}

.about-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.about-text i {
  color: var(--accent);
  font-size: 40px;
  background: linear-gradient(45deg, #f09433, #d62976, #962fbf, #4f5bd5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
  display: none !important;
}

.mt-4 {
  margin-top: 24px;
}

.mb-4 {
  margin-bottom: 24px;
}

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

.text-accent {
  color: var(--accent);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 380px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .preview-actions {
    flex-direction: column;
  }
  
  .setting-info i {
    display: none;
  }
  
  .history-meta {
    flex-direction: column;
    gap: 4px;
  }
  
  .hero-title {
    font-size: 24px;
  }
  
  .logo-text {
    font-size: 16px;
  }
  
  .install-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 90px 12px 80px;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 15px;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .top-bar {
    padding: 8px 12px;
  }
  
  .nav-logo {
    width: 32px;
    height: 32px;
  }
}

/* ==================== SCROLLBAR STYLING ==================== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* ==================== ANIMATIONS ==================== */
@keyframes glow {
  0% { box-shadow: 0 0 5px var(--accent); }
  50% { box-shadow: 0 0 20px var(--accent); }
  100% { box-shadow: 0 0 5px var(--accent); }
}

.glow-effect {
  animation: glow 2s infinite;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.swal2-popup {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 16px !important;
}

.swal2-title {
  color: var(--accent) !important;
  font-size: 16px !important;
}

.swal2-timer-progress-bar {
  background: var(--accent) !important;
}

/* ==================== VIDEO PLAYER ==================== */
video {
  outline: none;
}

video::-webkit-media-controls-panel {
  background: rgba(0, 0, 0, 0.7);
}

video::-webkit-media-controls-play-button {
  background-color: var(--accent);
  border-radius: 50%;
}

/* ==================== ACTIVE STATES ==================== */
.active-page {
  color: var(--accent);
}

/* ==================== INSTALL BUTTON ANIMATION ==================== */
@keyframes pulse-install {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.install-btn {
  animation: pulse-install 2s infinite;
}

.install-btn:hover {
  animation: none;
}
