/*
 * ============================================================================
 * PUBLIC VOTING SYSTEM - STYLES
 * ============================================================================
 * Created: 2025-10-28
 * Author: Khalid Puerto
 * Purpose: Styles for anonymous public voting interface
 * ============================================================================
 */

/* ============================================================================
 * VOTING CONTAINER
 * ============================================================================ */

.public-vote-wrapper {
  background: #FFF;
  border: 1px solid #E7E7E7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.public-vote-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #F7F7F7;
}

.public-vote-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
  font-family: "Raleway", sans-serif;
}

.public-vote-header p {
  font-size: 14px;
  color: #666;
  margin: 0;
  line-height: 1.6;
}

.public-vote-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #FFF;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.5); }
  50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.8); }
}

/* ============================================================================
 * VOTING OPTIONS
 * ============================================================================ */

.public-vote-options {
  margin: 20px 0;
}

.public-vote-option {
  position: relative;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.public-vote-option:hover {
  transform: translateX(4px);
}

.public-vote-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.public-vote-option label {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: #FAFAFA;
  border: 2px solid #E7E7E7;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  position: relative;
  overflow: hidden;
}

.public-vote-option label:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(244, 52, 56, 0.05), rgba(244, 52, 56, 0.02));
  transition: width 0.3s ease;
  z-index: 0;
}

.public-vote-option:hover label {
  border-color: #f43438;
  background: #FFF;
}

.public-vote-option:hover label:before {
  width: 100%;
}

.public-vote-option input[type="radio"]:checked + label {
  background: #FFF;
  border-color: #f43438;
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(244, 52, 56, 0.1);
}

.public-vote-option-radio {
  width: 22px;
  height: 22px;
  border: 2px solid #CCC;
  border-radius: 50%;
  margin-right: 14px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
  z-index: 1;
}

.public-vote-option input[type="radio"]:checked + label .public-vote-option-radio {
  border-color: #f43438;
  background: #f43438;
}

.public-vote-option input[type="radio"]:checked + label .public-vote-option-radio:after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: #FFF;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: radio-pop 0.3s ease forwards;
}

@keyframes radio-pop {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.public-vote-option-text {
  flex: 1;
  z-index: 1;
}

/* ============================================================================
 * SUBMIT BUTTON
 * ============================================================================ */

.public-vote-submit {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #f43438 0%, #d42226 100%);
  color: #FFF;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(244, 52, 56, 0.3);
  position: relative;
  overflow: hidden;
}

.public-vote-submit:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.public-vote-submit:hover:before {
  width: 300px;
  height: 300px;
}

.public-vote-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 52, 56, 0.4);
}

.public-vote-submit:active {
  transform: translateY(0);
}

.public-vote-submit:disabled {
  background: #CCC;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.public-vote-submit-text {
  position: relative;
  z-index: 1;
}

/* ============================================================================
 * LOADING STATE
 * ============================================================================ */

.public-vote-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #FFF;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================================
 * RESULTS DISPLAY
 * ============================================================================ */

.public-vote-results {
  margin-top: 24px;
}

.public-vote-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #F7F7F7;
}

.public-vote-results-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.public-vote-results-count {
  font-size: 14px;
  color: #666;
  background: #F7F7F7;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
}

.public-vote-result-item {
  margin-bottom: 20px;
}

.public-vote-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.public-vote-result-label {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  flex: 1;
}

.public-vote-result-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-vote-result-percentage {
  font-size: 18px;
  font-weight: 700;
  color: #f43438;
  min-width: 50px;
  text-align: right;
}

.public-vote-result-count {
  font-size: 13px;
  color: #999;
  background: #F7F7F7;
  padding: 4px 10px;
  border-radius: 12px;
}

.public-vote-result-bar-container {
  height: 32px;
  background: #F7F7F7;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.public-vote-result-bar {
  height: 100%;
  background: linear-gradient(90deg, #f43438 0%, #ff6b6e 100%);
  border-radius: 16px;
  transition: width 1s ease-out;
  position: relative;
  overflow: hidden;
}

.public-vote-result-bar:before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.public-vote-result-bar-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #FFF;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

/* Winner badge */
.public-vote-result-item.winner .public-vote-result-label:after {
  content: "🏆";
  margin-left: 8px;
  font-size: 16px;
  animation: trophy-bounce 1s ease infinite;
}

@keyframes trophy-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ============================================================================
 * ALERTS & MESSAGES
 * ============================================================================ */

.public-vote-alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  animation: slide-down 0.3s ease;
}

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

.public-vote-alert-icon {
  margin-right: 12px;
  font-size: 18px;
  flex-shrink: 0;
}

.public-vote-alert-content {
  flex: 1;
}

.public-vote-alert-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.public-vote-alert-message {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.public-vote-alert.success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.public-vote-alert.error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.public-vote-alert.warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.public-vote-alert.info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

/* ============================================================================
 * STATISTICS
 * ============================================================================ */

.public-vote-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid #F7F7F7;
}

.public-vote-stat {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #F7F7F7 0%, #FAFAFA 100%);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.public-vote-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.public-vote-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #f43438;
  margin-bottom: 4px;
  font-family: "Raleway", sans-serif;
}

.public-vote-stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ============================================================================
 * RESPONSIVE DESIGN
 * ============================================================================ */

@media (max-width: 768px) {
  .public-vote-wrapper {
    padding: 16px;
  }

  .public-vote-header h3 {
    font-size: 18px;
  }

  .public-vote-option label {
    padding: 12px 16px;
    font-size: 14px;
  }

  .public-vote-option-radio {
    width: 20px;
    height: 20px;
  }

  .public-vote-submit {
    padding: 12px 20px;
    font-size: 15px;
  }

  .public-vote-results-title {
    font-size: 16px;
  }

  .public-vote-result-percentage {
    font-size: 16px;
    min-width: 45px;
  }

  .public-vote-result-bar-container {
    height: 28px;
  }

  .public-vote-stat-value {
    font-size: 24px;
  }

  .public-vote-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .public-vote-wrapper {
    padding: 12px;
    border-radius: 6px;
  }

  .public-vote-header h3 {
    font-size: 16px;
  }

  .public-vote-header p {
    font-size: 13px;
  }

  .public-vote-option {
    margin-bottom: 10px;
  }

  .public-vote-option label {
    padding: 10px 14px;
    font-size: 13px;
  }

  .public-vote-option-radio {
    width: 18px;
    height: 18px;
    margin-right: 12px;
  }

  .public-vote-result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .public-vote-result-stats {
    width: 100%;
    justify-content: space-between;
  }

  .public-vote-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
 * ANIMATIONS & TRANSITIONS
 * ============================================================================ */

.fade-in {
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slide-up 0.5s ease;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
 * ACCESSIBILITY
 * ============================================================================ */

.public-vote-option input[type="radio"]:focus + label {
  outline: 2px solid #f43438;
  outline-offset: 2px;
}

.public-vote-submit:focus {
  outline: 2px solid #f43438;
  outline-offset: 4px;
}

/* ============================================================================
 * PRINT STYLES
 * ============================================================================ */

@media print {
  .public-vote-submit,
  .public-vote-options {
    display: none;
  }

  .public-vote-results {
    display: block;
  }

  .public-vote-wrapper {
    box-shadow: none;
    border: 1px solid #CCC;
  }
}
