/* Modern Student Voting System Styles */

:root {
  --primary-color: #4f46e5;
  --primary-dark: #4338ca;
  --secondary-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --purple: #9333ea;
  --purple-dark: #7e22ce;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Admin theme */
body.admin-theme {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: white;
  padding: 20px 30px;
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary-color), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-theme .header h1 {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-name {
  font-weight: 600;
  color: var(--text-dark);
}

/* Cards */
.card {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Forms */
.form-container {
  max-width: 500px;
  margin: 50px auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.admin-theme .form-group input:focus,
.admin-theme .form-group textarea:focus,
.admin-theme .form-group select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-purple {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: white;
}

.btn-purple:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-success {
  background: var(--secondary-color);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--text-light);
  color: white;
}

.btn-secondary:hover {
  background: var(--text-dark);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  width: 100%;
  padding: 10px 20px;
  margin-top: 15px;
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

/* Alert Messages */
.alert {
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 2px solid #10b981;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid #ef4444;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 2px solid #3b82f6;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 2px solid #f59e0b;
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

/* Candidate Card */
.candidate-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.candidate-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.candidate-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  margin: 25px auto 0;
  display: block;
  border: 4px solid var(--bg-light);
  box-shadow: var(--shadow);
}

.candidate-content {
  padding: 20px;
  text-align: center;
}

.candidate-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.candidate-position {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  font-size: 0.875rem;
}

.admin-theme .candidate-position {
  color: var(--purple);
}

.candidate-description {
  color: var(--text-light);
  margin-bottom: 15px;
  line-height: 1.5;
}

.candidate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center; /* Center the buttons */
}

/* Results */
.result-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex; /* Ensure flex is active */
  flex-direction: row; /* Explicitly horizontal */
  align-items: center;
  border: 1px solid var(--border-color);
}

.result-candidate-img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 20px;
  border: none;
  flex-shrink: 0; /* Prevent image from squishing or growing */
  align-self: flex-start; /* Align to top if content is tall */
  margin-top: 5px;
}

.result-content-col {
  flex-grow: 1; /* Take remaining width */
  min-width: 0; /* specific flexbox fix for nested overflowing text */
}

.result-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: nowrap; /* Keep name and votes on one line if possible */
}

.result-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-right: 10px;
}

.result-votes {
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 700;
  white-space: nowrap; /* Keep "2 votes" together */
}

.progress-bar-container {
  width: 100%;
}

.progress-bar {
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: #9ca3af; /* Default grey for 0 votes or inactive */
  border-radius: 6px;
  transition: width 0.5s ease;
}

/* Add a class via JS or inline if votes > 0 to change color, 
   but for now we can rely on standard color or make it purple always */
.progress-fill[style*="width: 0%"] {
    background: #e5e7eb;
}
.progress-fill:not([style*="width: 0%"]) {
   background: linear-gradient(90deg, var(--primary-color), var(--purple));
}

.result-percentage {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 5px;
  font-weight: 500;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
}

.admin-theme .stat-value {
  color: var(--purple);
}

.stat-label {
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  margin-top: 5px;
}

/* Links */
.text-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.text-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.admin-theme .text-link {
  color: var(--purple);
}

.admin-theme .text-link:hover {
  color: var(--purple-dark);
}

/* Center text */
.text-center {
  text-align: center;
}

/* Margin utilities */
.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* Voted indicator */
.voted-indicator {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .candidate-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Icon Colors */
.fa-user {
  color: #6366f1; /* Indigo */
}

.fa-user-edit,
.fa-user-cog {
  color: #8b5cf6; /* Violet */
}

.fa-user-shield {
  color: #9333ea; /* Purple */
}

.fa-user-graduate {
  color: #06b6d4; /* Cyan */
}

.fa-user-plus {
  color: #22c55e; /* Green */
}

.fa-users,
.fa-users-cog {
  color: #3b82f6; /* Blue */
}

.fa-chart-pie,
.fa-chart-bar {
  color: #f59e0b; /* Amber */
}

.fa-sign-out-alt {
  color: #ef4444; /* Red */
}

.fa-sign-in-alt {
  color: #10b981; /* Emerald */
}

.fa-vote-yea {
  color: #8b5cf6; /* Violet */
}

.fa-check-circle {
  color: #22c55e; /* Green */
}

.fa-id-card {
  color: #0ea5e9; /* Sky */
}

.fa-lock {
  color: #f97316; /* Orange */
}

.fa-plus-circle {
  color: #22c55e; /* Green */
}

.fa-edit {
  color: #3b82f6; /* Blue */
}

.fa-trash {
  color: #ef4444; /* Red */
}

.fa-times-circle {
  color: #ef4444; /* Red */
}

.fa-exclamation-triangle {
  color: #f59e0b; /* Amber/Warning */
}

.fa-info-circle {
  color: #3b82f6; /* Blue */
}

.fa-envelope {
  color: #ec4899; /* Pink */
}

.fa-phone {
  color: #14b8a6; /* Teal */
}

.fa-key {
  color: #eab308; /* Yellow */
}

.fa-save {
  color: #22c55e; /* Green */
}

.fa-arrow-left {
  color: #6b7280; /* Gray */
}

.fa-home {
  color: #6366f1; /* Indigo */
}

.fa-cog,
.fa-cogs {
  color: #64748b; /* Slate */
}

.fa-calendar,
.fa-calendar-alt {
  color: #8b5cf6; /* Violet */
}

/* Icons inside buttons should inherit button text color */
.btn i {
  margin-right: 8px;
  color: inherit;
}

/* Icons inside stat cards */
.stat-value i {
  margin-right: 10px;
}

/* Icons inside labels - subtle colors */
.form-group label i {
  margin-right: 8px;
  opacity: 0.9;
}

/* Voted indicator icon */
.voted-indicator i {
  color: inherit;
  margin-right: 8px;
}

/* Header user info icons */
.user-info i {
  margin-right: 5px;
}

/* ============================================
   Footer Styles
   ============================================ */
.footer {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 20px;
  text-align: center;
  margin-top: 40px;
  border-radius: 15px 15px 0 0;
}

.footer-content {
  color: rgba(255, 255, 255, 0.9);
}

.footer-content p {
  margin: 5px 0;
}

.footer-version {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ============================================
   Button Loading State
   ============================================ */
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Alert Animations
   ============================================ */
.alert {
  animation: slideIn 0.3s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Alert icon styling */
.alert i {
  margin-right: 8px;
}

/* ============================================
   Enhanced Card Animations
   ============================================ */
.card {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Table Hover Effects
   ============================================ */
.student-table tbody tr {
  transition: background-color 0.2s ease;
}

.student-table tbody tr:hover {
  background-color: rgba(79, 70, 229, 0.05);
}

.admin-theme .student-table tbody tr:hover {
  background-color: rgba(147, 51, 234, 0.05);
}

/* ============================================
   Progress Bar Animation
   ============================================ */
.progress-fill {
  animation: progressGrow 1s ease-out;
}

@keyframes progressGrow {
  from {
    width: 0 !important;
  }
}

/* ============================================
   Input Focus Glow
   ============================================ */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  animation: inputGlow 0.3s ease;
}

@keyframes inputGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  }
}

/* ============================================
   Glassmorphism Effect for Cards
   ============================================ */
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

/* ============================================
   Exclamation circle icon color
   ============================================ */
.fa-exclamation-circle {
  color: #ef4444;
}

.alert-success .fa-exclamation-circle,
.alert-success .fa-check-circle {
  color: inherit;
}

/* ============================================
   Additional Icon Colors
   ============================================ */
.fa-search {
  color: #6366f1;
}

.fa-file-export,
.fa-download {
  color: #10b981;
}

.fa-print {
  color: #6b7280;
}

