/* CSS Reset & Variables */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #0f1424;
  --bg-card: rgba(20, 26, 42, 0.6);
  --bg-card-hover: rgba(28, 36, 58, 0.7);
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-glow: rgba(6, 182, 212, 0.15);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  
  --sidebar-width: 260px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR STYLES */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding: 0.5rem;
}

.logo-icon {
  font-size: 1.5rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.5));
}

.logo-area h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  transition: transform var(--transition-fast);
}

.nav-item:hover .nav-icon {
  transform: translateX(2px);
}

.nav-item.active .nav-icon {
  stroke: var(--primary-light);
  filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
}

.credentials-badge-card {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem;
}

.badge-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.badge-status-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* MAIN CONTENT STYLES */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
}

/* TOP BAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.current-section-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
}

.current-section-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.realtime-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.5rem 0.85rem;
  border-radius: 50px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--success);
  letter-spacing: 1px;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.live-tag::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse-glow 1.5s infinite;
}

.update-timer {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* SECTIONS ROUTING */
.content-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.content-section.active {
  display: block;
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-info h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
}

/* COLOR BORDERS ON CARDS */
.stat-card.blue { border-left: 4px solid var(--info); }
.stat-card.purple { border-left: 4px solid var(--secondary); }
.stat-card.cyan { border-left: 4px solid var(--primary); }
.stat-card.orange { border-left: 4px solid var(--warning); }
.stat-card.yellow { border-left: 4px solid #eab308; }
.stat-card.green { border-left: 4px solid var(--success); }
.stat-card.red { border-left: 4px solid var(--danger); }

/* GLASS CARDS */
.dashboard-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.dashboard-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .dashboard-controls-grid {
    grid-template-columns: 1fr;
  }
}

/* QUOTA STYLES */
.quota-progress-container {
  margin: 1rem 0;
}

.progress-bar-bg {
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.quota-numbers {
  display: flex;
  justify-content: flex-end;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.quota-helper-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* CONTROL CARD & ANIMATIONS */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.queue-running-animation {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--primary-light);
}

.wave {
  width: 4px;
  height: 12px;
  background: var(--primary-light);
  border-radius: 4px;
  animation: wave-motion 1.2s ease-in-out infinite;
}
.wave:nth-child(2) { animation-delay: 0.15s; }
.wave:nth-child(3) { animation-delay: 0.3s; }

@keyframes wave-motion {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2); }
}

/* FORM STYLES */
.modern-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.form-group small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-group.check-group {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  margin: 0.5rem 0;
}

.form-group.check-group input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-group.check-group label {
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}

/* BUTTONS */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
}

.btn-warning-outline {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.btn-warning-outline:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warning);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.link-btn {
  color: var(--primary-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.link-btn:hover {
  color: #ffffff;
}

/* TABLES STYLES */
.table-card {
  padding: 0;
  overflow: hidden;
}

.flex-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.table-container {
  overflow-x: auto;
  min-height: 250px;
}

.table-container-mini {
  overflow-x: auto;
  max-height: 350px;
}

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

.modern-table th {
  background: rgba(0, 0, 0, 0.15);
  padding: 0.9rem 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.modern-table td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modern-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.actions-col {
  text-align: right;
  width: 140px;
}

.actions-cell {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.loading-td {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-muted);
  font-style: italic;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.blue {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.2);
  color: var(--info);
}

.badge.green {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge.orange {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge.red {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge.grey {
  background: rgba(156, 163, 175, 0.1);
  border-color: rgba(156, 163, 175, 0.2);
  color: var(--text-muted);
}

/* SITES & SITEMAPS LAYOUT */
.settings-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
}

@media (max-width: 1100px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
}

.settings-form-column,
.settings-list-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* PAGINATION */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.1);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

/* LOG STREAM */
.log-stream-mini {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.01);
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
}

.log-item.info { border-left-color: var(--info); }
.log-item.success { border-left-color: var(--success); }
.log-item.warning { border-left-color: var(--warning); }
.log-item.error { border-left-color: var(--danger); }

.log-time {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 0.75rem;
  white-space: nowrap;
}

.log-content {
  flex: 1;
}

.log-url {
  font-family: monospace;
  color: var(--primary-light);
  word-break: break-all;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  display: block;
}

.log-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-style: italic;
}

/* LOGS PAGE FULL */
.logs-container-full {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

.log-stream-full {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 550px;
  overflow-y: auto;
  padding: 1.25rem;
}

/* SETTINGS PAGE */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 950px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.credentials-detail-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-row .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-row .value {
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-all;
}

.text-highlight {
  color: var(--primary-light);
}

.warning-alert-box {
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.warning-alert-box h4 {
  color: var(--warning);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.warning-alert-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* PULSE INDICATOR */
.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.pulse-indicator.green {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-glow-green 2s infinite;
}

.pulse-indicator.red {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse-glow-red 2s infinite;
}

@keyframes pulse-glow-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-glow-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
  max-width: 320px;
}

.toast {
  background: rgba(20, 26, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
  overflow: hidden;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warning { border-left: 4px solid var(--warning); }

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

.toast.fade-out {
  animation: fadeOutLeft 0.3s ease-out forwards;
}

@keyframes fadeOutLeft {
  to {
    transform: translateX(30px);
    opacity: 0;
  }
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state, .loading-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* SCROLLBAR CUSTOMIZATION */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
