/* ElectVote - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --blue-primary: #1d4ed8;
  --blue-light:   #3b82f6;
  --blue-dark:    #1e3a8a;
  --red-primary:  #dc2626;
  --red-light:    #ef4444;
  --red-dark:     #991b1b;
  --white:        #ffffff;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-800:     #1f2937;
  --gray-900:     #111827;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 380px;
  min-width: 280px;
}

.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}

.toast-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.toast-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.toast-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.toast-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* Animated progress bar */
.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--blue-primary), var(--blue-light));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: progressShine 2s infinite;
}

@keyframes progressShine {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.closing {
  animation: fadeOut 0.2s ease forwards;
}

.modal-box {
  background: white;
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  animation: scaleIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.closing .modal-box {
  animation: scaleOut 0.2s ease forwards;
}

@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes scaleIn  { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes scaleOut { from { transform: scale(1);    opacity: 1; } to { transform: scale(0.85); opacity: 0; } }

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.625rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-link:hover {
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
}

.sidebar-link.active {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: white;
  box-shadow: 0 4px 12px rgba(29,78,216,0.35);
}

/* Cards */
.stat-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: white;
  box-shadow: 0 2px 8px rgba(29,78,216,0.3);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(29,78,216,0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  box-shadow: 0 2px 8px rgba(220,38,38,0.3);
}
.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(220,38,38,0.45);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  box-shadow: 0 2px 8px rgba(22,163,74,0.3);
}
.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(22,163,74,0.45);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid #e5e7eb;
  color: #374151;
}
.btn-outline:hover:not(:disabled) {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59,130,246,0.05);
}

.btn-ghost {
  background: transparent;
  color: #6b7280;
}
.btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  color: #374151;
}

/* Form inputs */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  outline: none;
  background: white;
  color: #111827;
}

.form-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background 0.15s;
}
.data-table tbody tr:hover { background: #f9fafb; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-gray    { background: #f3f4f6; color: #6b7280; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: #9ca3af;
  text-align: center;
}

.empty-state svg {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

/* Vote option card */
.vote-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  user-select: none;
}

.vote-option:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.15);
}

.vote-option.selected {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 4px 16px rgba(29,78,216,0.2);
}

.vote-option .radio-circle {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vote-option.selected .radio-circle {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.vote-option.selected .radio-circle::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

/* Countdown */
.countdown-digit {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .dark-auto body      { background: #0f172a; color: #f1f5f9; }
  .dark-auto .stat-card { background: #1e293b; }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.bounce-in {
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Pulse dot */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(34,197,94,0.4);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.5); opacity: 0; }
}

/* Responsive sidebar */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
}
