@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-color: #0b0f19;
  --surface-color: rgba(22, 28, 45, 0.45);
  --surface-hover: rgba(30, 37, 59, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
  
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  --glow-primary: 0 0 15px rgba(99, 102, 241, 0.4);
  --glow-secondary: 0 0 15px rgba(6, 182, 212, 0.4);
  --glow-accent: 0 0 15px rgba(236, 72, 153, 0.4);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Background Animated Blobs */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg-color);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  mix-blend-mode: screen;
  animation: moveBlob 25s infinite alternate ease-in-out;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: #6366f1;
  top: -10%;
  left: -5%;
  animation-duration: 22s;
}

.blob-2 {
  width: 550px;
  height: 550px;
  background: #06b6d4;
  bottom: -10%;
  right: -5%;
  animation-duration: 28s;
  animation-delay: -5s;
}

.blob-3 {
  width: 380px;
  height: 380px;
  background: #ec4899;
  top: 35%;
  left: 45%;
  animation-duration: 20s;
  animation-delay: -10s;
}

@keyframes moveBlob {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(80px, 60px) scale(1.15);
  }
  100% {
    transform: translate(-40px, 100px) scale(0.9);
  }
}

/* Header with Glassmorphism */
header {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background-color: rgba(11, 15, 25, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary-gradient);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-inverse);
  box-shadow: var(--glow-primary);
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(4px);
}

/* Common button styles */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.35rem;
  border-radius: 0.8rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-bounce);
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.6);
  filter: brightness(1.1);
}

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

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.6);
  filter: brightness(1.1);
}

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

/* Layout container */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  z-index: 1;
}

/* Auth Cards styling */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.card {
  background: var(--surface-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 60%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Form inputs */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 0.8rem;
  padding: 0.85rem 1.1rem;
  font-family: inherit;
  color: var(--text-main);
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

/* Dashboard & Voting panels */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

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

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

.panel-title {
  font-size: 2.25rem;
  font-weight: 850;
  letter-spacing: -0.035em;
  background: linear-gradient(135deg, #ffffff 60%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Project Cards */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.project-card {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  padding: 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-bounce), border-color 0.3s;
}

.project-card:hover {
  background: var(--surface-hover);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3), 0 0 15px rgba(99, 102, 241, 0.1);
}

/* Shimmer effect on hover */
.project-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.03) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  transition: 0.75s;
}

.project-card:hover::after {
  left: 150%;
  transition: 0.75s;
}

.project-info {
  flex: 1;
}

.project-title {
  font-size: 1.35rem;
  font-weight: 750;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Voter Controls */
.vote-controls {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.5rem 0.65rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
}

.btn-circle {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-weight: bold;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.btn-circle:hover:not(:disabled) {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  transform: scale(1.1);
}

.btn-circle:active:not(:disabled) {
  transform: scale(0.95);
}

.btn-circle:disabled {
  opacity: 0.15;
  cursor: not-allowed;
}

.vote-number {
  font-size: 1.35rem;
  font-weight: 800;
  width: 2.2rem;
  text-align: center;
  font-family: monospace;
}

/* Floating Wallet Info Panel */
.wallet-card {
  position: sticky;
  top: 6.5rem;
  background: rgba(22, 28, 45, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 2.25rem;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.wallet-header {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.075em;
}

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.coin-amount {
  font-size: 3.75rem;
  font-weight: 850;
  line-height: 1;
  background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.25));
}

.coin-unit {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.wallet-progress-bar {
  background: rgba(255, 255, 255, 0.04);
  height: 0.65rem;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.wallet-progress {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4 0%, #6366f1 100%);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
  width: 100%;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Alert dialogs */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.9rem;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

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

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.alert-info {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Admin Dashboard Table */
.admin-actions {
  display: flex;
  gap: 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 2rem;
}

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

.score-table-card {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 2.25rem;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.admin-section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 60%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.scores-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  transition: var(--transition-bounce);
}

.score-row:hover {
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.score-rank {
  font-size: 1.25rem;
  font-weight: 850;
  color: var(--text-muted);
  width: 2.2rem;
}

.score-rank-1 {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.4));
}

.score-rank-2 {
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-rank-3 {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-info {
  flex: 1;
  padding-left: 0.5rem;
}

.score-amount {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.score-points {
  font-size: 1.35rem;
  font-weight: 800;
  color: #06b6d4;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

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

/* Modals with scale-up */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal .card {
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .card {
  transform: scale(1);
}

/* Project Actions */
.project-actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  font-size: 0.75rem !important;
  padding: 0.35rem 0.65rem !important;
  margin: 0 !important;
  border-radius: 0.5rem;
}

/* Badges definitions */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.badge-investor {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.badge-pending {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* Select stylisé dans la table */
.role-select {
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.role-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Users table */
#usersTable th {
  padding: 1rem 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

#usersTable td {
  padding: 1rem 0.75rem;
}

/* Animations fade-in-up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Spinner and Loaders */
.loader {
  border: 3.5px solid rgba(255, 255, 255, 0.05);
  border-top: 3.5px solid #6366f1;
  border-radius: 50%;
  width: 1.6rem;
  height: 1.6rem;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}
