:root {
  --bg-color: #f4f6f8;
  --text-color: #2c3e50;
  --card-bg: #ffffff;
  --sidebar-bg: #2c3e50;
  --sidebar-text: #bdc3c7;
  --primary: #007782;
  --accent: #e01936;
  --border: #ecf0f1;
}

body.dark-mode {
  --bg-color: #1a1a1a;
  --text-color: #ecf0f1;
  --card-bg: #2c2c2c;
  --sidebar-bg: #000000;
  --border: #444;
}

/* Utility Classes (Pour remplacer les styles inline) */
.hidden { display: none !important; }
.w-100 { width: 100%; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-small { font-size: 12px; }
.text-muted { color: #999; }
.text-accent { color: var(--accent); }
.opacity-80 { opacity: 0.8; }

body { margin: 0; font-family: 'Inter', 'Segoe UI', sans-serif; display: flex; height: 100vh; background: var(--bg-color); color: var(--text-color); transition: background 0.3s; }

/* Login Screen Styling */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 3000; /* Au-dessus de tout */
  text-align: center;
}

.login-container h1 { color: var(--primary); margin-bottom: 10px; font-size: 2rem; }
.login-container p { margin-bottom: 30px; color: var(--text-color); opacity: 0.8; }

.login-form-box { width: 300px; margin: 0 auto; }
.login-input { 
  width: 100%; 
  padding: 12px; 
  margin-bottom: 10px; 
  border: 1px solid var(--border); 
  border-radius: 5px; 
  background: var(--card-bg); 
  color: var(--text-color); 
  box-sizing: border-box;
}
.login-divider { margin: 20px 0; border-top: 1px solid var(--border); position: relative; }
.login-divider span { 
  background: var(--bg-color); 
  padding: 0 10px; 
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); 
  color: #999; font-size: 12px; 
}
.btn-google { background: #db4437; color: white; border: none; padding: 10px; border-radius: 5px; cursor: pointer; font-weight: bold; }

/* App Container */
#app-container {
  width: 100%;
  height: 100vh;
  display: flex; /* Sera caché par la classe .hidden si besoin */
}

/* Sidebar */
.sidebar { width: 250px; background: var(--sidebar-bg); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar h2 { padding: 20px; margin: 0; background: rgba(0,0,0,0.2); font-size: 18px; }
.nav-link { display: block; padding: 15px 20px; color: var(--sidebar-text); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.05); transition: 0.2s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: white; border-left: 4px solid var(--primary); }
.sidebar .version { margin-top: auto; padding: 10px; font-size: 12px; text-align: center; opacity: 0.5; }

.user-profile {
  margin-top: auto;
  padding: 15px;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-profile img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.user-profile span {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pro-badge {
  color: #f1c40f;
  margin-left: 5px;
}

/* Gamification */
.gamification-box { padding: 15px; background: rgba(0,0,0,0.1); margin: 10px; border-radius: 8px; }
.gamification-box h4 { margin: 0 0 10px 0; font-size: 12px; text-transform: uppercase; opacity: 0.7; }
.badges-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.badge-icon { font-size: 18px; cursor: help; }

/* Main Content */
.main-content { flex: 1; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
h1 { margin: 0; }

/* Tabs */
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* KPI Cards */
.kpi-container { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.kpi-card { flex: 1; min-width: 200px; background: var(--card-bg); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.kpi-card h3 { margin: 0 0 10px 0; font-size: 14px; opacity: 0.7; text-transform: uppercase; }
.kpi-card .value { font-size: 28px; font-weight: bold; color: var(--primary); }
.kpi-card.alert .value { color: var(--accent); }

/* Goals */
.goals-section { background: var(--card-bg); padding: 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.goal-header { display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: bold; font-size: 14px; }
.progress-bar { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
#goal-progress { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), #2ecc71); transition: width 1s; }

/* Charts & Lists */
.charts-row { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.chart-box { background: var(--card-bg); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.half { flex: 1; min-width: 300px; }
.full { width: 100%; }
.chart-full { width: 100%; height: 250px; }
.chart-half { width: 100%; height: 200px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 13px; }

/* Toolbar & Table */
.toolbar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.search-bar { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--card-bg); color: var(--text-color); }
.filter-select { padding: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--card-bg); color: var(--text-color); }

.table-container { background: var(--card-bg); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th { text-align: left; padding: 15px; border-bottom: 2px solid var(--border); opacity: 0.7; font-size: 13px; }
td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 14px; }

/* Images & Badges */
.table-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.no-img { font-size: 20px; opacity: 0.3; }
.badge { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; color: white; display: inline-block; }
.bg-manual { background: #6f42c1; }
.bg-ordered { background: #17a2b8; }
.bg-waiting_shipping { background: #e01936; }
.bg-shipped { background: #007bff; }
.bg-in_transit { background: #fd7e14; }
.bg-delivered { background: #28a745; }
.bg-cancelled { background: #95a5a6; }
.bg-archived { background: #34495e; }

/* Actions & Inputs */
button { padding: 8px 15px; cursor: pointer; border: none; border-radius: 5px; background: var(--primary); color: white; font-weight: bold; transition: 0.2s; }
button:hover { opacity: 0.9; transform: translateY(-1px); }
button:active { transform: translateY(0); }
.btn-danger { background: var(--accent); }
.btn-secondary { background: #7f8c8d; }
.btn-icon { background: transparent; font-size: 20px; padding: 5px; color: var(--text-color); }
.btn-premium { background: linear-gradient(45deg, #f1c40f, #e67e22); color: white; box-shadow: 0 2px 5px rgba(230, 126, 34, 0.3); }
.btn-large { width: 100%; font-size: 16px; }
.action-btn { padding: 4px 8px; font-size: 12px; margin-right: 5px; background: #7f8c8d; }
.editable-price { cursor: pointer; border-bottom: 1px dashed #999; }
.editable-price:hover { background: rgba(0,0,0,0.05); }
.status-select {
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: bold;
  color: white;
  cursor: pointer;
}

.price-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Toast Notifications */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
.toast { padding: 15px 20px; margin-top: 10px; border-radius: 5px; color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.2); animation: slideIn 0.3s; }
.toast.info { background: #3498db; }
.toast.success { background: #2ecc71; }
.toast.error { background: #e74c3c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px; }
#page-info { font-size: 14px; opacity: 0.8; }

/* Settings */
.settings-card { background: var(--card-bg); padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.settings-card h3 { margin-top: 0; }
.settings-card input { padding: 8px; border: 1px solid var(--border); border-radius: 4px; margin-right: 10px; background: var(--bg-color); color: var(--text-color); }
.admin-panel {
  border: 2px solid #e01936;
}
.admin-panel h3 {
  color: #e01936;
}
.link { color: var(--primary); text-decoration: none; }

/* Tags */
.tag { font-size: 10px; background: #eee; color: #555; padding: 2px 5px; border-radius: 3px; margin-right: 3px; }
body.dark-mode .tag { background: #444; color: #ccc; }

/* Watchlist Grid */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.watchlist-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}

.watchlist-card:hover {
  transform: translateY(-5px);
}

.watchlist-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.watchlist-card-details { padding: 10px; }
.watchlist-card-title { font-weight: 600; font-size: 14px; margin-bottom: 5px; height: 40px; overflow: hidden; }
.watchlist-card-price { font-weight: bold; font-size: 16px; color: var(--primary); text-align: right; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 1; transition: opacity 0.3s; }
.modal.hidden { display: none; opacity: 0; pointer-events: none; }
.modal-content { background: var(--card-bg); padding: 30px; border-radius: 10px; width: 400px; max-width: 90%; text-align: center; position: relative; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.close-modal { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: #999; }
.close-modal:hover { color: var(--text-color); }

/* Premium Locks */
.premium-feature { position: relative; overflow: hidden; }
.premium-feature > *:not(.premium-overlay) { filter: blur(4px); pointer-events: none; user-select: none; }
.premium-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; justify-content: center; align-items: center;
  background: rgba(255,255,255,0.1); z-index: 10;
}
body.dark-mode .premium-overlay { background: rgba(0,0,0,0.3); }

/* Scrollbar moderne */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bdc3c7; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #95a5a6; }