/* ==========================================================================
   Artractive Style Sheets - Premium Dark Glassmorphism Theme
   ========================================================================== */

/* Design Tokens & Variables */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  
  --bg-main: #090d16;
  --bg-card: rgba(22, 29, 49, 0.65);
  --bg-card-hover: rgba(30, 39, 65, 0.8);
  --bg-navbar: rgba(15, 22, 38, 0.7);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --color-primary: #6366f1;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-primary: 0 8px 25px -5px rgba(99, 102, 241, 0.4);
  --shadow-danger: 0 8px 25px -5px rgba(239, 68, 68, 0.4);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.glow-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -150px;
  left: -150px;
  animation: float-slow 20s infinite alternate;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: #a855f7;
  bottom: -200px;
  right: -200px;
  animation: float-slow 25s infinite alternate-reverse;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 80px) scale(1.1); }
}

/* Typography & Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-inverse);
  letter-spacing: -0.02em;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  filter: brightness(1.2);
}

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hidden {
  display: none !important;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(25, 33, 53, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* UI Elements & Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(9, 13, 22, 0.8);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  outline: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -5px rgba(99, 102, 241, 0.5);
}

.btn-danger {
  background: var(--danger-gradient);
  color: var(--text-inverse);
  box-shadow: var(--shadow-danger);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -5px rgba(239, 68, 68, 0.5);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

.btn-danger-outline:hover {
  background: var(--color-danger);
  color: var(--text-inverse);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.full-width {
  width: 100%;
}

/* Icon Buttons turned into small Pill Buttons */
.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  cursor: pointer;
  padding: 5px 12px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-primary);
  color: var(--text-inverse);
}

/* Password Toggle Wrapper */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 48px;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
  transition: var(--transition-smooth);
}

.password-toggle-btn:hover {
  color: var(--text-main);
}

/* 1. Login Page Styles */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-main);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.login-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 40px;
  border-color: rgba(99, 102, 241, 0.2);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
}

.logo i {
  color: var(--color-primary);
  background: none;
  -webkit-text-fill-color: initial;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 6px;
  margin-bottom: 30px;
}

.error-text {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-bottom: 16px;
  min-height: 20px;
  text-align: left;
}

/* 2. Main Dashboard Interface */
.dashboard-container {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-container.active {
  opacity: 1;
  pointer-events: all;
}

/* Navigation Header */
.glass-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: var(--bg-navbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-sm {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: 1.2rem;
  box-shadow: var(--shadow-primary);
}

.navbar-brand h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Dashboard Content Grid */
.dashboard-content {
  flex: 1;
  padding: 30px 40px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.grid-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
  align-items: start;
}

/* Side Panel (Project creation and list) */
.side-panel {
  display: flex;
  flex-direction: column;
}

.panel-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Project List Styling */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.project-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateX(4px);
}

.project-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--color-primary);
  box-shadow: 0 0 15px -3px rgba(99, 102, 241, 0.3);
}

.project-info-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-inverse);
}

.project-info-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.project-indicator {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: var(--transition-smooth);
}

.project-item.active .project-indicator {
  color: var(--color-primary);
  transform: translateX(2px);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 10px;
  font-size: 0.9rem;
}

/* Detail Panel Styling */
.detail-panel {
  min-height: 500px;
}

.detail-empty-card {
  height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.4;
}

.detail-empty-card p {
  max-width: 400px;
  margin-top: 10px;
  font-size: 0.9rem;
}

/* Project Detail Card Header */
.detail-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 30px;
}

#current-project-title {
  font-size: 1.8rem;
  font-weight: 700;
}

.api-key-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 8px;
  margin-top: 8px;
}

.api-key-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.api-key-box code {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--color-warning);
  user-select: all;
  letter-spacing: 0.03em;
}

.masked-key {
  color: var(--text-muted) !important;
  font-style: italic;
}

/* Stats Badges Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--text-inverse);
}

.bg-violet {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  box-shadow: 0 8px 20px -4px rgba(139, 92, 246, 0.4);
}

.bg-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.4);
}

.stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 2px;
}

/* Tabs System */
.tabs-container {
  display: flex;
  flex-direction: column;
}

.tabs-header {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-inverse);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 3px 3px 0 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* Responsive Table Layout */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
  flex-wrap: wrap;
}

.table-header h4 {
  font-size: 1.1rem;
  font-weight: 600;
}

.table-search {
  max-width: 250px;
  padding: 8px 14px !important;
  font-size: 0.85rem !important;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.2);
}

tbody tr {
  transition: var(--transition-smooth);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
  border-bottom: none;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #511a00;
}

.rank-badge.silver {
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  color: #1e293b;
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
  color: #ffffff;
}

.rank-badge.other {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.row-actions {
  display: flex;
  gap: 8px;
}

/* Modals Layout */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: rgba(26, 34, 57, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: var(--text-inverse);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Alert Modals styling */
.alert-modal {
  max-width: 400px;
  padding: 30px;
}

.alert-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--color-danger);
  margin: 0 auto;
}

.justify-center {
  justify-content: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: rgba(22, 29, 49, 0.95);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(8px);
}

.toast.toast-success {
  border-left-color: var(--color-success);
}

.toast.toast-danger {
  border-left-color: var(--color-danger);
}

.toast.toast-warning {
  border-left-color: var(--color-warning);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-exit {
  animation: slideOut 0.3s forwards;
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Responsive Adjustments */
@media (max-width: 992px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
  
  .glass-navbar {
    padding: 16px 20px;
  }
  
  .dashboard-content {
    padding: 20px;
  }
}

/* Help Modal Customization */
.help-modal-card {
  max-width: 800px !important;
  width: 90% !important;
}

.help-content-wrapper {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  max-height: 450px;
  overflow-y: auto;
  padding: 18px;
  margin-top: 10px;
}

.help-pre-box {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #a7f3d0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}
