@import 'variables.css';

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  transition: var(--transition);
}

/* HEADER */
header {
  background: var(--gradient-header);
  color: var(--color-text-inverse);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
}

/* NAV */
nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.nav-btn:hover { color: white; }
.nav-btn.active {
  color: white;
  border-bottom-color: white;
  font-weight: 600;
}

/* THEME TOGGLE */
.theme-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover { background: rgba(255,255,255,0.3); }

/* USER MENU */
.user-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-btn:hover { background: rgba(255,255,255,0.3); }

/* CONTAINER */
.container {
  max-width: 960px;
  margin: 30px auto;
  padding: 0 20px;
}

/* CARD */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--color-border);
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-state h2 { font-size: 2.5rem; margin-bottom: 10px; }

/* LOADING */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--color-text-muted);
}

/* BUTTONS */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary {
  background: var(--gradient-header);
  color: white;
  border: none;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-danger {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.btn-danger:disabled { opacity: 0.3; cursor: not-allowed; }

/* CATEGORY BUTTONS */
.cat-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: var(--transition);
}

.cat-btn.active-besoin { background: var(--color-danger); color: white; border-color: var(--color-danger); }
.cat-btn.active-plaisir { background: var(--color-warning); color: white; border-color: var(--color-warning); }
.cat-btn.active-epargne { background: var(--color-success); color: white; border-color: var(--color-success); }
.cat-btn:hover:not(.active-besoin):not(.active-plaisir):not(.active-epargne) { border-color: var(--color-primary); color: var(--color-primary); }

/* TAG BUTTONS */
.tag-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
  color: var(--color-text-muted);
}

.tag-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tag-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* FORM */
.form-group { margin-bottom: 16px; }

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

.form-control {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* BADGE */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-malou { background: #fce4ec; color: #c2185b; }
.badge-jeremy { background: #e3f2fd; color: #1565c0; }
.badge-valide { background: #e8f5e9; color: var(--color-success); }
.badge-pending { background: #fff3e0; color: var(--color-warning); }

/* COMMUNE ROW */
.commune-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-secondary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  cursor: pointer;
  border: 1px solid var(--color-border);
}

.commune-row input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

/* PROGRESS */
.progress-bar {
  background: var(--color-border);
  border-radius: 10px;
  height: 6px;
}

.progress-fill {
  background: var(--gradient-header);
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .container { padding: 0 12px; margin: 16px auto; }
  .card { padding: 16px; }
  header { padding: 0 16px; }
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.success-msg {
  color: var(--color-success);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 20px;
}

.error-msg {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 20px;
}