@import './tokens.css';
@import './base.css';
@import './components.css';
@import './utilities.css';

/* TextFancy PWA - Mobile-Optimized Styles */

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

:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --background: #ffffff;
  --surface: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --error: #f87171;
  --warning: #fbbf24;
}

/* Dark theme - Professional Design */
[data-theme="dark"] {
  --background: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .page-loader {
  background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .page-loader-spinner {
  border-color: #334155;
}

/* Dark theme - Inputs and Form Controls */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background: #1e293b;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748b;
}

/* Dark theme - Buttons */
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

[data-theme="dark"] .btn-secondary {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #475569;
  border-color: #64748b;
}

/* Dark theme - Cards and Surfaces */
[data-theme="dark"] .login-container,
[data-theme="dark"] .card,
[data-theme="dark"] .page-content {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Dark theme - User Dropdown */
[data-theme="dark"] .user-dropdown {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .user-dropdown-item {
  color: #f1f5f9;
}

[data-theme="dark"] .user-dropdown-item:hover {
  background: #334155;
}

[data-theme="dark"] .user-dropdown-divider {
  background: #334155;
}

[data-theme="dark"] .user-dropdown-logout {
  color: #f87171;
}

[data-theme="dark"] .user-dropdown-logout:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #ef4444;
}

.user-dropdown-section {
  padding: 12px 16px;
}

.user-dropdown-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.user-dropdown-language-select,
#languageSelect,
.language-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23667eea' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

#languageSelect,
.language-select {
  width: auto;
  min-width: 120px;
  margin-right: 8px;
}

.user-dropdown-language-select:hover,
#languageSelect:hover,
.language-select:hover {
  border-color: var(--primary);
}

.user-dropdown-language-select:focus,
#languageSelect:focus,
.language-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

[data-theme="dark"] .user-dropdown-language-select,
[data-theme="dark"] #languageSelect,
[data-theme="dark"] .language-select {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23667eea' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

[data-theme="dark"] .user-dropdown-language-select:hover,
[data-theme="dark"] #languageSelect:hover,
[data-theme="dark"] .language-select:hover {
  border-color: #667eea;
  background-color: #1e293b;
}

[data-theme="dark"] .user-dropdown-language-select:focus,
[data-theme="dark"] #languageSelect:focus,
[data-theme="dark"] .language-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
  background-color: #1e293b;
}

[data-theme="dark"] .user-dropdown-section-title {
  color: #94a3b8;
}

/* Dark theme - Chips */
[data-theme="dark"] .chip {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .chip:hover {
  border-color: #475569;
  background: #334155;
}

[data-theme="dark"] .chip.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
}

/* Dark theme - Social Buttons */
[data-theme="dark"] .btn-social {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .btn-social:hover {
  background: #334155;
  border-color: #475569;
}

/* Dark theme - Status Messages */
[data-theme="dark"] .status.error {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .status:not(.error) {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Dark theme - Links */
[data-theme="dark"] a {
  color: #93c5fd;
}

[data-theme="dark"] a:hover {
  color: #60a5fa;
}

/* Dark theme - Login Tabs */
[data-theme="dark"] .login-tabs {
  border-bottom-color: #334155;
}

[data-theme="dark"] .login-tab {
  color: #94a3b8;
}

[data-theme="dark"] .login-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

/* Dark theme - Result Section */
[data-theme="dark"] .result-section {
  background: #1e293b;
  border-color: #334155;
}

/* Dark theme - Settings */
[data-theme="dark"] .settings-section,
[data-theme="dark"] .form-group {
  background: transparent;
}

[data-theme="dark"] .form-control {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .form-control:focus {
  background: #1e293b;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .form-note {
  color: #94a3b8;
}

/* Dark theme - Result Box */
[data-theme="dark"] .result-box {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

/* Dark theme - Error Messages */
[data-theme="dark"] .error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

/* Dark theme - Toast */
[data-theme="dark"] .toast {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Dark theme - Footer */
[data-theme="dark"] .footer {
  background: #0f172a;
  border-top-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .footer a {
  color: #93c5fd;
}

[data-theme="dark"] .footer a:hover {
  color: #60a5fa;
}

/* Dark theme - Loading Spinner */
[data-theme="dark"] .spinner {
  border-color: #334155;
  border-top-color: #667eea;
}

[data-theme="dark"] .loading {
  color: #94a3b8;
}

/* Dark theme - Tables */
[data-theme="dark"] table,
[data-theme="dark"] th,
[data-theme="dark"] td {
  border-color: #334155;
}

[data-theme="dark"] th {
  background: #1e293b;
  color: #f1f5f9;
}

[data-theme="dark"] tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] td {
  color: #f1f5f9;
}

/* Dark theme - Pricing Cards */
[data-theme="dark"] .pricing-card,
[data-theme="dark"] .plan-card {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .pricing-card:hover,
[data-theme="dark"] .plan-card:hover {
  border-color: #475569;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Dark theme - Analytics Charts */
[data-theme="dark"] .chart-container {
  background: #1e293b;
  border-color: #334155;
}

/* Dark theme - Profile Section */
[data-theme="dark"] .profile-section,
[data-theme="dark"] .profile-card {
  background: #1e293b;
  border-color: #334155;
}

/* Dark theme - Text Input Focus */
[data-theme="dark"] .text-input:focus {
  background: #1e293b;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Dark theme - Page Content */
[data-theme="dark"] .page-content {
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Dark theme - Main Content */
[data-theme="dark"] .main-content {
  background: var(--background);
}

/* Dark theme - Section Labels */
[data-theme="dark"] .label,
[data-theme="dark"] .section-title,
[data-theme="dark"] .settings-title {
  color: #f1f5f9;
}

/* Dark theme - Help/Policy Pages */
[data-theme="dark"] .help-content,
[data-theme="dark"] .policy-content {
  color: #f1f5f9;
}

[data-theme="dark"] .help-content h2,
[data-theme="dark"] .policy-content h2 {
  color: #f1f5f9;
}

[data-theme="dark"] .help-content h3,
[data-theme="dark"] .policy-content h3 {
  color: #e2e8f0;
}

/* Dark theme - Code Blocks */
[data-theme="dark"] code,
[data-theme="dark"] pre {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
}

/* Dark theme - Blockquotes */
[data-theme="dark"] blockquote {
  border-left-color: #475569;
  background: rgba(30, 41, 59, 0.5);
  color: #cbd5e1;
}

/* Dark theme - Pricing Page Authenticated Sections */
[data-theme="dark"] #currentPlanStatus,
[data-theme="dark"] #paymentFormCard,
[data-theme="dark"] #paymentHistoryCard {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] #currentPlanStatus h3,
[data-theme="dark"] #paymentFormCard h3,
[data-theme="dark"] #paymentHistoryCard h3 {
  color: #f1f5f9;
}

[data-theme="dark"] #currentPlanStatus p,
[data-theme="dark"] #paymentFormCard p {
  color: #cbd5e1;
}

[data-theme="dark"] #cancellationWarning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] #cancellationWarning h4 {
  color: #fbbf24;
}

[data-theme="dark"] #cancellationWarning p {
  color: #fcd34d;
}

[data-theme="dark"] #paymentFormCard input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] #paymentFormCard input:disabled {
  background: #1e293b;
  color: #94a3b8;
}

[data-theme="dark"] #paymentFormCard label {
  color: #e2e8f0;
}

[data-theme="dark"] #paymentFormCard .payment-instructions {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] #paymentFormCard .payment-instructions p,
[data-theme="dark"] #paymentFormCard .payment-instructions li {
  color: #93c5fd;
}

[data-theme="dark"] #paymentHistoryCard table thead {
  background: #0f172a;
}

[data-theme="dark"] #paymentHistoryCard table thead th {
  color: #94a3b8;
}

[data-theme="dark"] #paymentHistoryCard table tbody td {
  color: #f1f5f9;
  border-color: #334155;
}

[data-theme="dark"] #paymentHistoryCard table tbody tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.5);
}

/* Page Loader */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.active {
  opacity: 1;
  visibility: visible;
}

.page-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.page-loader-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  font-display: swap;
}

.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  position: relative;
}

/* Content wrapper for pages that need max-width */
.content-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* For main app (index.html) - keep mobile-first but allow wider on desktop */
.app-main-container {
  width: 100%;
  max-width: 800px;
  margin: 32px auto;
  padding: 32px 20px;
  flex: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (min-width: 768px) {
  .app-main-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px 24px;
  }
}

@media (min-width: 1024px) {
  .app-main-container {
    max-width: 1000px;
    margin: 48px auto;
    padding: 48px 32px;
  }
}

/* Header - Premium AI-themed Design */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  color: white;
  padding: 20px 24px;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 80px;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  position: relative;
  overflow: visible;
  z-index: 1000;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0.6;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

[data-theme="dark"] .header {
  background: linear-gradient(135deg, #4c63d2 0%, #5a3d8e 50%, #4c63d2 100%);
  background-size: 200% 200%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

[data-theme="dark"] .header::before {
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
}

.header-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1001;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.header-nav {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.header-nav a {
  color: white;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  transition: all 0.3s;
  white-space: nowrap;
  position: relative;
  backdrop-filter: blur(10px);
}

.header-nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s;
}

.header-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-nav a.active {
  background: rgba(255, 255, 255, 0.25);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
  z-index: 1000;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu a {
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  background: rgba(255, 255, 255, 0.15);
}

.mobile-menu-signin {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2) !important;
}

.mobile-menu-signin:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.header {
  position: relative;
}

/* Show navigation on wider screens */
@media (min-width: 768px) {
  .header-nav {
    display: flex;
  }
  
  .header {
    padding: 16px 24px;
  }
}

@media (min-width: 1024px) {
  .header {
    padding: 16px 32px;
  }
  
  .header-nav {
    gap: 32px;
  }
}

/* Mobile menu on small screens */
@media (max-width: 767px) {
  .header-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
    justify-content: space-between;
  }
  
  /* Guest users: show burger menu next to sign in button */
  .header-wrapper.header-guest .mobile-menu-btn {
    display: block;
    order: 2; /* Logo (1), Burger (2), Sign In (3) */
    margin-left: auto; /* Push burger and sign in to right */
  }
  
  /* Group burger menu and sign in button together for guest */
  .header-wrapper.header-guest .header-actions {
    order: 3;
    margin-left: 8px; /* Small gap between burger and sign in */
  }
  
  /* Authenticated users: hide burger menu */
  .header-wrapper.header-authenticated .mobile-menu-btn {
    display: none;
  }
  
  .header-content {
    flex: 0 0 auto;
    min-width: 0;
    order: 1; /* Logo always first */
  }
  
  .header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    order: 3; /* Actions always last */
  }
  
  .header-nav {
    display: none;
  }
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s;
  color: white;
  position: relative;
  z-index: 1;
}

.logo-link:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.logo-link h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.3px;
}

.logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s;
}

.logo-link:hover .logo {
  transform: scale(1.05);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.notifications-menu-container {
  position: relative;
}

.notifications-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.notifications-button:hover {
  background: rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.notifications-icon {
  font-size: 18px;
  line-height: 1;
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  max-height: 420px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(148, 163, 184, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: all 0.2s ease;
  overflow: hidden;
  z-index: 10000;
}

.notifications-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.notifications-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.04));
}

.notifications-dropdown-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.notifications-mark-all {
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.notifications-mark-all:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #111827;
}

.notifications-dropdown-body {
  padding: 8px 8px 8px 10px;
  max-height: 360px;
  overflow-y: auto;
}

.notifications-view-all-link {
  display: block;
  padding: 8px 12px 10px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
  border-top: 1px solid rgba(229, 231, 235, 0.9);
  background: #f9fafb;
  transition: background 0.15s ease, color 0.15s ease;
}

.notifications-view-all-link:hover {
  background: #eef2ff;
  color: #3730a3;
}

.notifications-empty {
  padding: 16px 10px 18px 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notification-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px 8px 6px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.notification-indicator {
  width: 6px;
  border-radius: 999px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-message {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
  max-height: 3.2em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-date {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}

[data-theme='dark'] .notifications-button {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
}

[data-theme='dark'] .notifications-button:hover {
  background: rgba(30, 64, 175, 0.6);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
}

[data-theme='dark'] .notifications-dropdown {
  background: #020617;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.9), 0 0 0 1px rgba(30, 64, 175, 0.5);
}

[data-theme='dark'] .notifications-dropdown-header {
  border-bottom-color: #1f2937;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.3), rgba(30, 64, 175, 0.2));
}

[data-theme='dark'] .notifications-dropdown-title {
  color: #e5e7eb;
}

[data-theme='dark'] .notifications-mark-all {
  color: #9ca3af;
}

[data-theme='dark'] .notifications-mark-all:hover {
  background: rgba(55, 65, 81, 0.6);
  color: #f9fafb;
}

[data-theme='dark'] .notifications-dropdown-body {
  background: #020617;
}

[data-theme='dark'] .notifications-view-all-link {
  border-top-color: #1f2937;
  background: #020617;
  color: #9ca3af;
}

[data-theme='dark'] .notifications-view-all-link:hover {
  background: rgba(30, 64, 175, 0.6);
  color: #e5e7eb;
}

[data-theme='dark'] .notifications-empty {
  color: #9ca3af;
}

[data-theme='dark'] .notification-item {
  background: rgba(15, 23, 42, 0.95);
  border-color: #1f2937;
}

[data-theme='dark'] .notification-title {
  color: #e5e7eb;
}

[data-theme='dark'] .notification-message {
  color: #9ca3af;
}

[data-theme='dark'] .notification-date {
  color: #6b7280;
}

/* User menu container */
.user-menu-container {
  position: relative;
  z-index: 10000;
}

/* User avatar button */
.user-avatar-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  padding: 0;
  color: white;
  font-weight: 600;
  font-size: 17px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-avatar {
  display: block;
  line-height: 1;
}

/* User dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
  min-width: 240px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

[dir="rtl"] .user-dropdown {
  right: auto;
  left: 0;
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.user-dropdown-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.user-dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-dropdown-info {
  flex: 1;
  min-width: 0;
}

.user-dropdown-email {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.user-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #111827;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.user-dropdown-item:hover {
  background: #f3f4f6;
}

.user-dropdown-item span {
  display: block;
}

.user-dropdown-logout {
  color: #dc2626;
  font-weight: 500;
}

.user-dropdown-logout:hover {
  background: #fee2e2;
  color: #991b1b;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.08) translateY(-1px) rotate(15deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: white;
}

.theme-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  transition: transform 0.3s;
}

.theme-toggle-btn:hover .theme-icon svg {
  transform: rotate(15deg) scale(1.1);
}

/* Guest sign in button */
.header-signin-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-signin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.15);
}

/* Legacy user-info styles (for backward compatibility) */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
}

.plan-badge-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
  transition: opacity 0.2s;
}

.plan-badge-link:hover {
  opacity: 0.8;
}

.plan-badge {
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  display: inline-block;
  cursor: pointer;
}

.plan-badge.pro {
  background: rgba(255, 215, 0, 0.3);
  color: #ffd700;
}

.usage-text {
  font-size: 12px;
  opacity: 0.95;
  font-weight: 500;
}

.header-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
  white-space: nowrap;
}

/* Responsive header */
@media (max-width: 480px) {
  .header {
    padding: 12px 16px;
    min-height: 56px;
  }
  
  .header-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    justify-content: space-between;
  }
  
  .header-content {
    flex: 0 0 auto;
    min-width: 0;
    order: 1;
  }
  
  .logo {
    width: 32px;
    height: 32px;
  }
  
  .header h1 {
    font-size: 18px;
  }
  
  .header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    order: 3;
  }
  
  .user-avatar-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
    flex-shrink: 0;
  }
  
  .user-menu-container {
    position: relative;
    z-index: 1000;
  }
  
  .user-dropdown {
    min-width: 180px;
    right: -8px;
  }
  
  [dir="rtl"] .user-dropdown {
    right: auto;
    left: -8px;
  }
  
  /* Guest: show burger menu next to sign in button */
  .header-wrapper.header-guest .mobile-menu-btn {
    flex-shrink: 0;
    z-index: 10;
    order: 2;
    margin-left: auto; /* Push burger and sign in to right */
  }
  
  /* Group burger and sign in together */
  .header-wrapper.header-guest .header-actions {
    order: 3;
    margin-left: 4px;
  }
  
  /* Authenticated: hide burger menu */
  .header-wrapper.header-authenticated .mobile-menu-btn {
    display: none;
  }
  
  .mobile-menu {
    z-index: 999;
  }
  
  .user-info {
    padding: 6px 10px;
    font-size: 11px;
    gap: 6px;
  }
  
  .plan-badge {
    font-size: 11px;
    padding: 2px 8px;
  }
  
  .usage-text {
    font-size: 11px;
  }
  
  .header-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .header-signin-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* Login View - AI-themed with proper spacing */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 32px 20px;
  width: 100%;
  max-width: 100%;
  background: var(--background);
  opacity: 1;
  transform: scale(1);
  position: relative;
}

@media (min-width: 768px) {
  .login-view {
    padding: 48px 24px;
  }
}

@media (min-width: 1024px) {
  .login-view {
    padding: 64px 32px;
  }
}

.login-view.show {
  opacity: 1;
  transform: scale(1);
}

.login-container {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  padding: 32px;
  width: 100%;
  max-width: 450px;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  opacity: 0.8;
}

@media (min-width: 768px) {
  .login-container {
    padding: 40px;
    max-width: 500px;
  }
}

.login-container h2 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--text);
  font-size: 24px;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: -2px;
  text-decoration: none;
  text-align: center;
  display: block;
}

.login-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.login-tab:hover {
  color: var(--primary);
  opacity: 0.8;
}

.privacy-link-top {
  display: none; /* Hidden - privacy link is in footer */
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 200px; /* Prevent layout shift */
}

.login-form > * {
  margin: 0; /* Reset margins to ensure consistent spacing */
}

/* Ensure inputs have proper spacing */
.login-form input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box;
  margin: 0; /* Ensure no margin */
  flex-shrink: 0; /* Prevent shrinking */
}

/* Ensure buttons maintain spacing */
.login-form .btn {
  flex-shrink: 0; /* Prevent shrinking */
  margin: 0; /* Ensure no margin override */
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form .status {
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  margin: 0; /* Ensure no margin */
}

.login-form .status.show {
  display: block;
}

.login-form .status.error {
  background: #fee2e2;
  color: var(--error);
  border: 1px solid var(--error);
}

.login-form .status:not(.error) {
  background: #d1fae5;
  color: var(--success);
  border: 1px solid var(--success);
}

.forgot-password-link {
  text-align: center;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  margin-top: -8px;
  transition: opacity 0.2s;
}

.forgot-password-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.reset-info {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.divider span {
  padding: 0 12px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s;
}

.btn-social:hover {
  background: var(--background);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-google {
  border-color: #db4437;
}

.btn-google:hover {
  border-color: #db4437;
  background: #fef5f4;
}

.btn-facebook {
  border-color: #1877f2;
  color: #1877f2;
}

.btn-facebook:hover {
  border-color: #1877f2;
  background: #f0f7ff;
}


/* Main Content */
.main-content {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}
.app-main-container.show {
  opacity: 1;
  transform: translateY(0);
}

.privacy-link-main {
  display: none; /* Hidden - privacy link is in footer */
}

/* Sections */
.input-section,
.intention-section,
.language-section,
.style-section,
.result-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 140px;
  transition: all 0.2s ease;
  background: var(--background);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.word-count {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

.word-count.warning {
  color: var(--warning);
  font-weight: 600;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.chip:active {
  transform: scale(0.95);
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Buttons */
.action-buttons,
.result-actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

/* Buttons in action containers should flex */
.action-buttons .btn,
.result-actions .btn {
  flex: 1;
}

/* Login form buttons should be full width but not flex */
.login-form .btn {
  flex: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:active {
  background: var(--background);
}

/* Result Box */
.result-box {
  padding: 16px;
  background: #f8f9fa;
  border: 2px solid var(--border);
  border-radius: 8px;
  min-height: 120px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 16px;
  line-height: 1.6;
  margin-top: 8px;
  margin-bottom: 12px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error */
.error {
  padding: 16px;
  background: #fee2e2;
  border: 2px solid var(--error);
  border-radius: 8px;
  color: var(--error);
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10000;
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer - Premium AI-themed Design */
.footer {
  padding: 0;
  margin-top: auto;
  position: relative;
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--background) 0%, rgba(102, 126, 234, 0.03) 100%);
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 30%, var(--primary-dark) 50%, var(--primary) 70%, transparent 100%);
  opacity: 0.4;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 768px) {
  .footer-container {
    grid-template-columns: 1.5fr 1fr;
    gap: 60px;
    padding: 56px 32px 32px;
  }
}

/* Brand Section */
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
  width: fit-content;
}

.footer-logo-link:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.footer-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.footer-brand-name {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Links Section */
.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

@media (min-width: 768px) {
  .footer-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

.footer-link-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
  opacity: 0.9;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  padding: 4px 0;
  position: relative;
  width: fit-content;
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  transition: width 0.3s ease;
}

.footer-link:hover {
  color: var(--primary);
  transform: translateX(4px);
}

.footer-link:hover::after {
  width: 100%;
}

.footer-link.active {
  color: var(--primary);
  font-weight: 600;
}

.footer-link.active::after {
  width: 100%;
}

/* Bottom Bar */
.footer-bottom {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
  }
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.8;
}

.footer-powered {
  font-size: 12px;
  color: var(--primary);
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
  position: relative;
  padding-left: 20px;
}

.footer-powered::before {
  content: '✨';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* Dark Theme Footer */
[data-theme="dark"] .footer {
  background: linear-gradient(to bottom, var(--background) 0%, rgba(102, 126, 234, 0.08) 100%);
  border-top-color: #334155;
}

[data-theme="dark"] .footer::before {
  background: linear-gradient(90deg, transparent 0%, rgba(102, 126, 234, 0.6) 30%, rgba(118, 75, 162, 0.6) 50%, rgba(102, 126, 234, 0.6) 70%, transparent 100%);
  opacity: 0.5;
}

[data-theme="dark"] .footer-logo {
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .footer-bottom {
  border-top-color: #334155;
}

[data-theme="dark"] .footer-group-title {
  color: #e2e8f0;
}

[data-theme="dark"] .footer-link {
  color: #cbd5e1;
}

[data-theme="dark"] .footer-link:hover {
  color: #93c5fd;
}

[data-theme="dark"] .footer-copyright {
  color: #94a3b8;
}

/* Responsive */
@media (max-width: 480px) {
  .main-content {
    padding: 16px;
  }
  
  .header {
    padding: 16px;
  }
  
  .header h1 {
    font-size: 20px;
  }
  
  .chips {
    gap: 6px;
  }
  
  .chip {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* RTL Support */
.result-box.rtl {
  direction: rtl;
  text-align: right;
}

/* Shared Page Layout Styles */
.page-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.page-content-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.page-content {
  flex: 1;
  background: var(--tf-color-surface);
  border-radius: var(--tf-radius-lg);
  padding: var(--tf-space-8);
  box-shadow: var(--tf-shadow-md);
  border: 1px solid var(--tf-color-border-subtle);
  width: 100%;
  max-width: 100%;
  position: relative;
  transition: all var(--tf-transition-normal);
}

.page-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--tf-color-brand-gradient);
  background-size: 200% 100%;
  border-radius: var(--tf-radius-lg) var(--tf-radius-lg) 0 0;
  opacity: 0.9;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@media (min-width: 768px) {
  .page-container {
    padding: 32px 24px;
  }
  
  .page-content {
    padding: 40px;
  }
}

@media (min-width: 1024px) {
  .page-container {
    padding: 40px 32px;
  }
  
  .page-content {
    padding: 48px;
  }
}

.page-title {
  font-size: var(--tf-font-size-3xl);
  font-weight: var(--tf-font-weight-bold);
  color: var(--tf-color-text);
  margin-bottom: var(--tf-space-2);
  line-height: var(--tf-line-height-tight);
}

.page-subtitle {
  font-size: var(--tf-font-size-md);
  color: var(--tf-color-text-soft);
  margin-bottom: var(--tf-space-8);
  line-height: var(--tf-line-height-relaxed);
}

.page-section {
  margin-bottom: var(--tf-space-8);
}

.page-section:last-child {
  margin-bottom: 0;
}

.page-section h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.page-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
}

.page-section p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
}

.page-section ul,
.page-section ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.page-section li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 8px;
}

.page-section a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.page-section a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.page-section-header {
  margin-bottom: var(--tf-space-8);
}

.page-section-header .page-title {
  font-size: var(--tf-font-size-3xl);
  font-weight: var(--tf-font-weight-bold);
  color: var(--tf-color-text);
  margin-bottom: var(--tf-space-2);
  background: var(--tf-color-brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-section-header .page-subtitle {
  font-size: var(--tf-font-size-md);
  color: var(--tf-color-text-soft);
  line-height: var(--tf-line-height-relaxed);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--tf-space-6);
  margin-bottom: var(--tf-space-6);
}

.tf-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .usage-grid {
    grid-template-columns: 1fr;
  }
  
  .page-section-header .page-title {
    font-size: var(--tf-font-size-2xl);
  }
}

.usage-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.usage-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(102, 126, 234, 0.12), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.usage-card-label {
  position: relative;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 6px;
}

.usage-card-value {
  position: relative;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.usage-card-value--success {
  color: var(--success);
}

.usage-card-meta {
  position: relative;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

.usage-panel {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.usage-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.usage-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.usage-panel-body {
  min-height: 96px;
}

.usage-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.usage-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.usage-list-item:last-child {
  border-bottom: none;
}

.usage-list-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.usage-list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.usage-list-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.usage-list-date {
  font-size: 11px;
  color: var(--text-secondary);
}

.usage-list-amount {
  font-weight: 600;
  color: var(--primary);
  font-size: 14px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .usage-list-item {
    align-items: flex-start;
  }

  .usage-list-amount {
    font-size: 13px;
  }
}

/* Collapsible help items */
.help-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.help-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.help-question {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: color 0.2s;
}

.help-question:hover {
  color: var(--primary);
}

.help-question::after {
  content: '▼';
  font-size: 14px;
  opacity: 0.6;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.help-item.collapsed .help-question::after {
  transform: rotate(-90deg);
}

.help-answer {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 1;
}

.help-item.collapsed .help-answer {
  max-height: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden;
}

.help-answer p,
.help-answer ul,
.help-answer ol {
  margin-bottom: 12px;
}

.help-answer p:last-child,
.help-answer ul:last-child,
.help-answer ol:last-child {
  margin-bottom: 0;
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-top: 32px;
  transition: opacity 0.2s;
}

.page-back-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Responsive page layout */
@media (max-width: 768px) {
  .page-container {
    padding: 16px;
  }
  
  .page-content {
    padding: 24px;
  }
  
  .page-title {
    font-size: 28px;
  }
  
  .page-section h2 {
    font-size: 20px;
  }
  
  .page-section h3 {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 12px;
  }
  
  .page-content {
    padding: 20px;
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .page-section {
    margin-bottom: 24px;
  }
}

/* Enhanced Responsive Footer */
@media (max-width: 768px) {
  .footer-container {
    flex-direction: column;
    gap: 32px;
    text-align: center;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 24px;
    width: 100%;
  }
  
  .footer-link-group {
    width: 100%;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .footer {
    padding: 32px 16px 24px;
  }
  
  .footer-brand {
    margin-bottom: 8px;
  }
  
  .footer-tagline {
    font-size: 13px;
  }
  
  .footer-group-title {
    font-size: 14px;
  }
  
  .footer-link {
    font-size: 13px;
    padding: 8px 0;
  }
  
  .footer-copyright,
  .footer-powered {
    font-size: 12px;
  }
}

/* Touch-friendly UI elements */
@media (hover: none) and (pointer: coarse) {
  .btn,
  button,
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
  }
  
  .footer-link,
  .header-nav a,
  .mobile-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 12px 16px;
  }
  
  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
  }
  
  .user-avatar-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

.logo,
.footer-logo {
  max-width: 100%;
  height: auto;
}

/* Prevent horizontal scroll on mobile */
body {
  overflow-x: hidden;
}

.app-container {
  overflow-x: hidden;
  width: 100%;
}

/* Better spacing on small screens */
@media (max-width: 480px) {
  .app-main-container {
    padding: 16px 12px;
    margin: 16px auto;
  }
  
  .input-section,
  .result-section {
    margin-bottom: 20px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-actions .btn {
    width: 100%;
  }
}