/* Flow Prompt Studio - Main Styles */
/* Optimized for Performance */

:root {
  --bg-main: #0a0a0f;
  --bg-grad-1: #0a0a0f;
  --bg-grad-2: #0f1419;
  --bg-grad-3: #0a0a0f;
  --card-bg: rgba(18, 24, 38, 0.95);
  --card-border: rgba(99, 102, 241, 0.3);
  --card-glow: rgba(99, 102, 241, 0.15);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-tertiary: #ec4899;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --text-main: #f1f5f9;
  --text-soft: #b8c5d6;
  --text-muted: #8899aa;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glow-primary: 0 0 20px rgba(99, 102, 241, 0.5), 0 0 40px rgba(99, 102, 241, 0.3);
  --glow-secondary: 0 0 15px rgba(139, 92, 246, 0.4);
  --glow-success: 0 0 15px rgba(16, 185, 129, 0.4);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.2), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(236, 72, 153, 0.12), transparent),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2) 50%, var(--bg-grad-3));
  color: var(--text-main);
  font-family: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glow Effects */
.glow-text { text-shadow: 0 0 10px rgba(99, 102, 241, 0.6), 0 0 20px rgba(99, 102, 241, 0.4); }
.glow-text-pink { text-shadow: 0 0 10px rgba(236, 72, 153, 0.6), 0 0 20px rgba(236, 72, 153, 0.4); }
.glow-text-green { text-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 0 20px rgba(16, 185, 129, 0.4); }
.glow-box { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3), 0 0 40px rgba(99, 102, 241, 0.15); }

/* Navbar */
.navbar {
  background: rgba(18, 24, 38, 0.98);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.navbar-brand {
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-logo {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}
.navbar-brand i { color: var(--accent-primary); font-size: 1.1rem; }
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--accent-primary);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* Key Status Bar */
.key-status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 100px;
  font-size: 0.75rem;
}
.key-status-bar .key-name { color: #10b981; font-weight: 600; }
.key-status-bar .key-expiry { color: var(--text-soft); padding-left: 0.75rem; border-left: 1px solid rgba(255,255,255,0.15); }
.key-status-bar .btn-release-key {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 0.5rem;
}
.key-status-bar .btn-release-key:hover { background: rgba(239, 68, 68, 0.25); }

/* Settings Button */
.btn-settings {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.btn-settings:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.25));
  border-color: var(--accent-primary);
  color: #fff;
}

/* Social Links */
.social-links { display: flex; gap: 0.5rem; }
.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  font-size: 1rem;
  transition: all 0.3s ease;
}
.social-link:hover { transform: translateY(-2px); }
.social-link.fb:hover { background: rgba(24, 119, 242, 0.2); border-color: #1877f2; color: #1877f2; }
.social-link.line:hover { background: rgba(0, 185, 0, 0.2); border-color: #00b900; color: #00b900; }

/* Hero Section */
.hero { padding: 2rem 0 1.5rem; position: relative; }
.hero h1 {
  font-weight: 800;
  font-size: 2rem;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
.hero-lead { color: var(--text-soft); max-width: 680px; font-size: 0.95rem; line-height: 1.7; }
.hero-lead strong { color: var(--accent-primary); font-weight: 600; }

/* Tag Pills */
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}
.pill-tag:hover { border-color: var(--accent-primary); transform: translateY(-1px); }
.pill-tag i { color: var(--accent-primary); font-size: 0.7rem; }

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card:hover { border-color: rgba(99, 102, 241, 0.5); }
.card-header {
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
}
.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.card-title i {
  font-size: 0.85rem;
  color: var(--accent-primary);
  padding: 0.4rem;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 8px;
}
.card-body { padding: 1.25rem; }

/* Badge */
.badge-soft {
  background: rgba(16, 185, 129, 0.15);
  border-radius: 100px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  color: var(--accent-success);
}

/* Form Elements */
label.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.form-control, .form-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.65rem 0.9rem;
  transition: all 0.2s ease;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus, .form-select:focus {
  background: rgba(15, 23, 42, 0.95);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  color: var(--text-main);
}
.form-select option { background: #1e293b; color: var(--text-main); }
textarea.form-control {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  resize: vertical;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5); }
.btn-outline-light {
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--accent-primary); color: var(--accent-primary); }
.btn-outline-success { font-size: 0.78rem; font-weight: 600; border-color: rgba(16, 185, 129, 0.5); color: var(--accent-success); }
.btn-outline-success:hover { background: rgba(16, 185, 129, 0.15); border-color: var(--accent-success); }

/* Output Label */
.output-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Small Pills */
.small-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  background: var(--glass-bg);
}

/* Scene Cards */
.scene-card {
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.6);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}
.scene-card:hover { border-color: var(--accent-primary); background: rgba(15, 23, 42, 0.8); }
.scene-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; font-size: 0.78rem; color: var(--text-soft); }
.scene-card-header strong { color: var(--accent-primary); }

/* Hints */
.hint { font-size: 0.75rem; color: #a0aec0; line-height: 1.5; }
.required-star { color: var(--accent-tertiary); font-weight: 700; }

/* Footer */
.footer-note { font-size: 0.75rem; color: var(--text-muted); padding: 1.5rem 0 1rem; border-top: 1px solid var(--glass-border); margin-top: 1.5rem; line-height: 1.8; }
.footer-note strong { color: var(--text-soft); }

/* Utilities */
.text-soft { color: var(--text-soft); }
.text-muted-soft { color: var(--text-muted); }
hr { border-color: var(--glass-border); opacity: 1; }

/* Modal */
.modal-content { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; }
.modal-header { border-bottom: 1px solid var(--glass-border); padding: 1.25rem 1.5rem; }
.modal-title { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.modal-title i { color: var(--accent-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--glass-border); padding: 1rem 1.5rem; }
.btn-close { filter: invert(1); }

/* API Key Items */
.api-key-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: all 0.2s ease;
}
.api-key-item:hover { border-color: var(--accent-primary); }
.api-key-item .form-control { flex: 1; background: transparent; border: none; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.api-key-item .form-control:focus { box-shadow: none; }
.api-key-item .key-status { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.api-key-item .key-status.active { background: var(--accent-success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.api-key-item .key-status.exhausted { background: var(--accent-danger); }
.api-key-item .key-status.unknown { background: var(--accent-warning); }
.btn-remove-key {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.btn-remove-key:hover { background: rgba(239, 68, 68, 0.2); }
.btn-add-key {
  width: 100%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  color: var(--accent-primary);
  padding: 0.75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.btn-add-key:hover { background: rgba(99, 102, 241, 0.2); border-style: solid; }

/* API Status */
.api-status { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.75rem; border-radius: 100px; font-size: 0.68rem; font-weight: 600; }
.api-status.active { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--accent-success); }
.api-status.warning { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: var(--accent-warning); }
.api-status.error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--accent-danger); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.5); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-secondary); }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.5rem; }
  .hero-lead { font-size: 0.85rem; }
  .card-body { padding: 1rem; }
}

/* ========================================
   📱 MOBILE RESPONSIVE - FULL WINDOW
   ======================================== */

/* Navbar Full Window ทุกขนาดจอ */
.navbar {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.navbar .container-fluid {
  width: 100%;
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  flex-wrap: wrap;
}

.navbar .d-flex.ms-auto {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Key Status Bar - Full Width */
.key-status-bar {
  flex-wrap: wrap;
  max-width: 100%;
}

@media (max-width: 1200px) {
  .brand-pill {
    display: none !important;
  }
  
  .navbar .small-pill {
    display: none !important;
  }
}

@media (max-width: 991px) {
  .navbar {
    padding: 0.5rem 0;
  }
  
  .navbar-brand {
    font-size: 0.85rem;
    gap: 0.5rem;
    flex-shrink: 1;
    min-width: 0;
  }
  
  .navbar-brand .brand-logo svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }
  
  .navbar-brand .glow-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Key Status Bar - ย้ายมาบรรทัดใหม่ */
  .key-status-bar {
    order: 10;
    width: 100%;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.65rem;
    border-radius: 12px;
  }
  
  .key-status-bar .key-name,
  .key-status-bar .key-id,
  .key-status-bar .key-expiry,
  .key-status-bar .key-devices {
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    white-space: nowrap;
  }
  
  .key-status-bar .key-expiry {
    border-left: none;
  }
  
  .btn-settings {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .btn-settings span {
    display: none;
  }
  
  .social-links {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .navbar .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .navbar-brand {
    font-size: 0.75rem;
  }
  
  .key-status-bar {
    font-size: 0.6rem;
    padding: 0.4rem 0.5rem;
    gap: 0.3rem;
  }
  
  .key-status-bar .key-name,
  .key-status-bar .key-id,
  .key-status-bar .key-expiry,
  .key-status-bar .key-devices {
    padding: 0.2rem 0.4rem;
    font-size: 0.6rem;
  }
  
  .key-status-bar .btn-release-key {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
  }
  
  .api-status {
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
  }
}

@media (max-width: 576px) {
  .navbar {
    padding: 0.4rem 0;
  }
  
  .navbar .container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .navbar-brand .glow-text {
    font-size: 0.7rem;
    max-width: 120px;
  }
  
  .navbar-brand .brand-logo svg {
    width: 24px;
    height: 24px;
  }
  
  .key-status-bar {
    font-size: 0.55rem;
  }
  
  .key-status-bar .key-id {
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .btn-settings {
    padding: 0.3rem 0.4rem;
  }
  
  .api-status {
    font-size: 0.55rem;
    padding: 0.15rem 0.4rem;
  }
}

@media (max-width: 400px) {
  .navbar-brand .glow-text {
    display: none;
  }
  
  .key-status-bar .key-id {
    max-width: 50px;
  }
  
  .key-status-bar .key-name i,
  .key-status-bar .key-expiry i,
  .key-status-bar .key-devices i {
    display: none;
  }
}

/* Hero Section Mobile */
@media (max-width: 768px) {
  .hero {
    padding: 1rem;
  }
  
  .hero h1 {
    font-size: 1.4rem;
  }
  
  .hero-lead {
    font-size: 0.8rem;
  }
}

@media (max-width: 576px) {
  .hero {
    padding: 0.75rem 0.5rem;
  }
  
  .hero h1 {
    font-size: 1.2rem;
  }
  
  .hero-lead {
    font-size: 0.75rem;
  }
  
  .tag-row {
    gap: 0.3rem;
    flex-wrap: wrap;
  }
  
  .pill-tag {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
  }
  
  .section-subtitle {
    font-size: 0.7rem;
  }
}

/* Container Full Width */
@media (max-width: 768px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .card {
    border-radius: 12px;
  }
  
  .card-body {
    padding: 0.75rem;
  }
}
