/* ============================================
   TOOLS DU SILEX – Dashboard Dark Premium
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #05060f;
  --bg-section: #0a0b17;
  --bg-card: linear-gradient(225deg, #1a1e49, #0a0b17);
  --blue-primary: #0c67ff;
  --blue-dark: #0448b9;
  --gradient-cta: linear-gradient(230deg, #0c67ff, #0448b9);
  --text-primary: #f3f2ff;
  --text-muted: rgba(149, 157, 240, 0.4);
  --text-muted-solid: #5a5f8a;
  --border-color: rgba(149, 157, 240, 0.1);
  --accent: #949df0;
  --green: #00b94a;
  --red: #ff4757;
  --orange: #ffa502;
  --surface: rgba(243, 242, 255, 0.1);
  --surface-light: rgba(243, 242, 255, 0.05);
  --radius-card: 16px;
  --radius-btn: 999px;
  --font: 'Inter', sans-serif;
  --glow-blue: 0 0 30px rgba(12, 103, 255, 0.3);
  --glow-blue-strong: 0 0 50px rgba(12, 103, 255, 0.5);
  --sidebar-width: 260px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 1rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--blue-primary); }
ul { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

::selection {
  background: var(--blue-primary);
  color: #fff;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 1.5rem;
}

.login-container {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  width: 180px;
  margin: 0 auto 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 2.5rem 2rem;
  backdrop-filter: blur(10px);
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--text-muted-solid);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(12, 103, 255, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted-solid);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 2rem;
  background: var(--gradient-cta);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-blue);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: var(--surface-light);
  border-color: var(--accent);
}

.btn-small {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

.login-error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-lockout {
  background: rgba(255, 165, 2, 0.1);
  border: 1px solid rgba(255, 165, 2, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--orange);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.login-lockout.visible {
  display: block;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-section);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  color: var(--text-muted-solid);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--surface-light);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--blue-primary);
  background: rgba(12, 103, 255, 0.08);
  border-left-color: var(--blue-primary);
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted-solid);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

/* --- Top Header --- */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(5, 6, 15, 0.7);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: rgba(255, 71, 87, 0.1);
  border-color: var(--red);
  color: var(--red);
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  padding: 2rem;
}

/* --- Sections --- */
.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

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

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow-blue);
}

.stat-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted-solid);
}

/* ============================================
   RECENT ACTIVITY
   ============================================ */
.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.5rem;
}

.activity-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-light);
  border-radius: 10px;
  font-size: 0.9rem;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-primary);
  flex-shrink: 0;
}

.activity-dot.green { background: var(--green); }
.activity-dot.orange { background: var(--orange); }

.activity-text {
  flex: 1;
  color: rgba(243, 242, 255, 0.8);
}

.activity-time {
  font-size: 0.8rem;
  color: var(--text-muted-solid);
  white-space: nowrap;
}

/* ============================================
   CREATE SITE FORM
   ============================================ */
.create-form {
  max-width: 700px;
}

.create-form .form-group {
  margin-bottom: 1.5rem;
}

.create-form .form-group label {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23949df0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.form-select option {
  background: #0a0b17;
  color: var(--text-primary);
}

.form-select:focus {
  border-color: var(--blue-primary);
}

.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.3s ease;
}

.form-textarea:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(12, 103, 255, 0.15);
}

.form-textarea::placeholder,
.form-select::placeholder {
  color: var(--text-muted-solid);
}

.custom-design-field {
  display: none;
  margin-top: 0.75rem;
}

.custom-design-field.visible {
  display: block;
}

.custom-pages-field {
  display: none;
  margin-top: 0.75rem;
}

.custom-pages-field.visible {
  display: block;
}

/* Confirmation modal */
.confirmation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 15, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

.confirmation-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.confirmation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  text-align: center;
}

.confirmation-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.confirmation-card .recap {
  text-align: left;
  background: var(--surface-light);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.recap-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border-color);
}

.recap-row:last-child {
  border-bottom: none;
}

.recap-label {
  color: var(--text-muted-solid);
}

.recap-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.confirmation-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.success-message {
  display: none;
  background: rgba(0, 185, 74, 0.1);
  border: 1px solid rgba(0, 185, 74, 0.3);
  border-radius: 10px;
  padding: 1rem;
  color: var(--green);
  font-size: 0.95rem;
  margin-top: 1rem;
  text-align: center;
}

.success-message.visible {
  display: block;
}

/* ============================================
   MY SITES
   ============================================ */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}

.site-card:hover {
  transform: translateY(-3px);
}

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

.site-domain {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.site-status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-btn);
}

.status-live {
  background: rgba(0, 185, 74, 0.15);
  color: var(--green);
}

.status-pending {
  background: rgba(255, 165, 2, 0.15);
  color: var(--orange);
}

.status-error {
  background: rgba(255, 71, 87, 0.15);
  color: var(--red);
}

.site-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted-solid);
}

.site-info span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-actions {
  display: flex;
  gap: 0.75rem;
}

/* ============================================
   CHAT
   ============================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.85rem 1.15rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--blue-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble .chat-time {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 0.35rem;
  display: block;
}

.chat-input-area {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-section);
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--blue-primary);
}

.btn-send {
  padding: 0.75rem 1.5rem;
  background: var(--gradient-cta);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
  white-space: nowrap;
}

.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow-blue);
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 2rem;
  max-width: 500px;
}

.settings-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.settings-section {
  margin-bottom: 2rem;
}

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

.settings-info {
  background: var(--surface-light);
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.9rem;
}

.settings-info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.settings-info-label {
  color: var(--text-muted-solid);
}

.settings-info-value {
  color: var(--text-primary);
  font-weight: 500;
}

.settings-success {
  display: none;
  background: rgba(0, 185, 74, 0.1);
  border: 1px solid rgba(0, 185, 74, 0.3);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--green);
  font-size: 0.85rem;
  margin-top: 1rem;
  text-align: center;
}

.settings-success.visible {
  display: block;
}

.settings-error {
  display: none;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 1rem;
  text-align: center;
}

.settings-error.visible {
  display: block;
}

/* ============================================
   OVERLAY (sidebar mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 15, 0.7);
  z-index: 99;
}

.sidebar-overlay.visible {
  display: block;
}

/* ============================================
   SECTION HEADER
   ============================================ */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.section-header p {
  color: var(--text-muted-solid);
  font-size: 0.9rem;
  margin: 0;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted-solid);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .hamburger {
    display: block;
  }

  .content-area {
    padding: 1.25rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sites-grid {
    grid-template-columns: 1fr;
  }

  .chat-container {
    height: calc(100vh - 120px);
  }

  .chat-bubble {
    max-width: 90%;
  }

  .top-header {
    padding: 0.75rem 1rem;
  }

  .confirmation-card {
    padding: 1.5rem;
  }
}

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

  .login-card {
    padding: 2rem 1.5rem;
  }
}
