/* dashboard.css - Premium Dashboard UI */

:root {
  /* Default Dark Mode Theme variables based on user prompt */
  --bg-color: #0f172a;
  --sidebar-bg: #1e293b;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary: #4F46E5;
  --primary-hover: #4338ca;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --input-bg: #0f172a;
}

.light-mode {
  --bg-color: #f3f4f6;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --input-bg: #f9fafb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
}

a { text-decoration: none; color: inherit; }

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}
.logo span {
  color: var(--primary);
}

.badge {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}
.nav-item:hover {
  background-color: rgba(255,255,255,0.05);
  color: var(--text-main);
}
.light-mode .nav-item:hover { background-color: rgba(0,0,0,0.05); }

.nav-item.active {
  background-color: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}
.nav-item .icon { font-size: 16px; }

.nav-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 16px 0;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border-color);
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: bold; font-size: 14px;
}
.user-info { display: flex; flex-direction: column; }
.name { font-size: 14px; font-weight: 600; }
.email { font-size: 12px; color: var(--text-muted); }

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Topbar */
.topbar {
  height: 64px;
  min-height: 64px;
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle { background: none; border: none; color: var(--text-main); font-size: 20px; cursor: pointer; display: none; }
.breadcrumbs { font-size: 14px; color: var(--text-muted); display: flex; gap: 8px; }
.breadcrumbs .current { color: var(--text-main); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.portail-btn { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.portail-btn:hover { color: var(--text-main); }
.theme-toggle { background: none; border: none; font-size: 20px; cursor: pointer; }
.avatar-small {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 600;
}

/* Content Area */
.content {
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-title h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-title p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* Form layout */
.creation-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}

.settings-panel { display: flex; flex-direction: column; gap: 24px; }

/* Cards */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}
.card-header h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.card-header p { font-size: 13px; color: var(--text-muted); }

.card-body { padding: 24px; }

/* Forms Elements */
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; color: var(--text-main);
}
.input-field {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-picker {
  height: 40px; width: 100%; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; padding: 2px; background: none;
}

/* Fields List (Drag & Drop UI) */
.field-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
}
.drag-handle { color: var(--text-muted); cursor: grab; font-size: 16px;}
.field-content { flex: 1; }
.field-label-input {
  background: transparent; border: none; font-size: 14px; font-weight: 500; color: var(--text-main); width: 100%; outline: none;
}
.badge.required {
  background-color: rgba(239, 68, 68, 0.1); color: #ef4444; font-size: 11px; padding: 4px 8px; border-radius: 12px; font-weight: 600;
}

/* Buttons */
.btn {
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; text-align: center;
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background-color: rgba(100,100,100,0.1); }
.w-full { width: 100%; }
.mt-3 { margin-top: 12px; }

.action-buttons {
  display: flex; justify-content: flex-end; gap: 16px; margin-top: 8px; padding-bottom: 40px;
}

/* Switch Toggle */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-color); transition: .4s; }
.slider.round { border-radius: 24px; }
.slider.round:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* Live Preview Panel */
.preview-sticky {
  position: sticky;
  top: 88px;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.preview-header {
  background-color: var(--card-bg);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
.preview-body {
  background-color: #f8fafc;
  padding: 32px 16px;
  min-height: 500px;
  color: #0f172a;
}
.dark-mode .preview-body {
  background-color: #e2e8f0; /* Keep preview bright conceptually representing landing page */
}
.preview-product {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
  color: #0f172a;
}
.preview-form-box {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.preview-form-box h3 { font-size: 18px; text-align: center; margin-bottom: 8px; color: #1e293b;}
.preview-form-box p { font-size: 12px; text-align: center; color: #64748b; margin-bottom: 20px; }
.preview-input {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #94a3b8;
}
.preview-btn {
  background-color: var(--primary);
  color: white;
  text-align: center;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-top: 16px;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 900px) {
  .creation-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: 0.3s; }
  .menu-toggle { display: block; }
}
