/* phonevote-polls.css
   Frontend styles for PhoneVote Polls
   - responsive
   - RTL-friendly
   - accessible-ish: focus states, aria-live messages
*/

/* Reset small things inside poll */
.pvp-poll * {
  box-sizing: border-box;
}

/* Dashboard layout */
.pvp-dashboard {
  --pvp-bg: #05070d;
  --pvp-surface: #0f121b;
  --pvp-muted-surface: #131726;
  --pvp-text: #f6f7fb;
  --pvp-muted: #9ca3af;
  --pvp-accent: #30ff7d;
  width: 100%;
  margin: 2rem auto;
  padding: clamp(1.5rem, 3vw, 3rem);
  background: radial-gradient(circle at top, rgba(48, 255, 125, 0.08), transparent 55%),
    var(--pvp-bg);
  border-radius: 32px;
  color: var(--pvp-text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  box-shadow: 0 30px 70px rgba(4, 6, 18, 0.7);
  direction: rtl;
  text-align: right;
}

.pvp-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: stretch;
}

.pvp-chart-card,
.pvp-poll-card {
  border-radius: 26px;
  padding: clamp(1.25rem, 2.5vw, 2.25rem);
  background: var(--pvp-muted-surface);
  box-shadow: 0 20px 50px rgba(5, 7, 17, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.pvp-chart-card {
  background: var(--pvp-muted-surface);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pvp-chart-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pvp-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.68rem;
  color: var(--pvp-muted);
  margin: 0 0 0.4rem 0;
}

.pvp-chart-card__title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.pvp-chart-card__subtitle {
  margin: 0;
  color: rgba(246, 247, 251, 0.7);
}

.pvp-chart-card__meta {
  text-align: left;
  direction: ltr;
}

.pvp-chart-card__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--pvp-accent);
  display: block;
}

.pvp-chart-canvas {
  width: 100%;
  height: clamp(260px, 45vh, 420px);
}

.pvp-chart-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.pvp-poll-card {
  background: var(--pvp-surface);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.pvp-poll-card__title {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
}

.pvp-poll-card__subtitle {
  margin: 0;
  color: rgba(246, 247, 251, 0.7);
  line-height: 1.5;
  font-size: 0.95rem;
}

.pvp-participate-btn {
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #04070f;
  background: var(--pvp-accent);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, background 200ms ease;
  box-shadow: 0 22px 45px rgba(48, 255, 125, 0.4);
}

.pvp-participate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 55px rgba(48, 255, 125, 0.5);
}

.pvp-participate-btn:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.pvp-input-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: opacity 200ms ease, transform 200ms ease;
}

.pvp-input-stack label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pvp-muted);
}

.pvp-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(4, 7, 15, 0.6);
  padding: 0.85rem 1rem;
  font-size: 1rem;
  color: var(--pvp-text);
  transition: border 180ms ease, box-shadow 180ms ease;
  direction: ltr;
  text-align: left;
}

.pvp-input:focus {
  outline: none;
  border-color: rgba(48, 255, 125, 0.7);
  box-shadow: 0 0 0 3px rgba(48, 255, 125, 0.16);
}

.pvp-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pvp-status {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.95rem;
  color: var(--pvp-muted);
}

.pvp-status.pvp-status--success {
  color: var(--pvp-accent);
}

.pvp-status.pvp-status--error {
  color: #f87171;
}

.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

@media (max-width: 900px) {
  .pvp-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .pvp-dashboard {
    padding: 1.25rem;
    border-radius: 24px;
  }

  .pvp-chart-card,
  .pvp-poll-card {
    padding: 1.35rem;
    border-radius: 20px;
  }

  .pvp-chart-canvas {
    height: 260px;
  }
}

/* Container */
.pvp-poll {
  direction: rtl; /* Persian/RTL support */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  max-width: 820px;
  margin: 1rem auto;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(18, 18, 18, 0.03);
}

/* Poll title */
.pvp-poll-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 1.2rem 0;
  color: #111827;
  text-align: center;
}

/* Admin total votes display */
.pvp-admin-total {
  font-size: 0.95rem;
  color: #111827;
  margin-bottom: 1rem;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 6px;
}

/* Authentication Section */
.pvp-auth-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.pvp-phone-step,
.pvp-otp-step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pvp-phone-step label,
.pvp-otp-step label {
  font-weight: 600;
  color: #374151;
  font-size: 0.95rem;
}

.pvp-phone-input,
.pvp-otp-input {
  padding: 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  direction: ltr;
  text-align: left;
}

.pvp-phone-input:focus,
.pvp-otp-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pvp-send-otp-btn,
.pvp-verify-otp-btn {
  appearance: none;
  border: none;
  background: #2563eb;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.06s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.pvp-send-otp-btn:hover,
.pvp-verify-otp-btn:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.pvp-send-otp-btn:disabled,
.pvp-verify-otp-btn:disabled,
.pvp-send-otp-btn.disabled,
.pvp-verify-otp-btn.disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Poll form */
.pvp-poll-form {
  margin-bottom: 1rem;
}

/* Options list */
.pvp-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

/* Single option */
.pvp-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, transform 0.1s ease, border-color 0.2s ease;
  background: rgba(4, 7, 15, 0.6);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* Mini bar chart inside option */
.pvp-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100%;
  background: rgba(48, 255, 125, 0.15);
  border-radius: 14px;
  transition: width 0.6s ease;
  z-index: 0;
  pointer-events: none;
}

/* Hover / focus */
.pvp-option:hover {
  background: rgba(4, 7, 15, 0.8);
  transform: translateY(-1px);
  border-color: rgba(48, 255, 125, 0.2);
}

.pvp-option:has(input:checked) {
  border-color: rgba(48, 255, 125, 0.4);
  background: rgba(48, 255, 125, 0.08);
}

/* Radio + title + percentage */
.pvp-option label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  cursor: pointer;
  width: 100%;
  justify-content: space-between;
}

/* Radio and checkbox inputs */
.pvp-option input[type="radio"],
.pvp-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--pvp-accent);
  cursor: pointer;
}

.pvp-option input[type="radio"]:disabled,
.pvp-option input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Title */
.pvp-title {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--pvp-text);
  display: inline-block;
  font-weight: 500;
  flex: 1 1 auto;
}

/* Percent text badge */
.pvp-percent {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--pvp-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  direction: ltr;
  text-align: center;
  min-width: 50px;
}

/* Chart wrapper */
.pvp-chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  margin-top: 1rem;
}

/* Responsive chart */
.pvp-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Submit button */
.pvp-submit {
  display: block;
  width: 100%;
  appearance: none;
  border: none;
  background: var(--pvp-accent);
  color: #04070f;
  padding: 0.9rem 1.35rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  box-shadow: 0 22px 45px rgba(48, 255, 125, 0.4);
}

.pvp-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 28px 55px rgba(48, 255, 125, 0.5);
}

.pvp-submit:disabled,
.pvp-submit.disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 22px 45px rgba(48, 255, 125, 0.2);
}

/* Message area (aria-live) */
.pvp-message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  text-align: right;
}

.pvp-msg-success {
  color: var(--pvp-accent);
  background: rgba(48, 255, 125, 0.1);
  border: 1px solid rgba(48, 255, 125, 0.2);
}

.pvp-msg-error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.pvp-msg-info {
  color: var(--pvp-muted);
  background: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(156, 163, 175, 0.2);
}

/* Hidden utility */
.pvp-hidden {
  display: none !important;
}

/* Small screens: stack nicely */
@media (max-width: 560px) {
  .pvp-option {
    padding: 0.85rem 1rem;
  }
  .pvp-chart-wrap {
    height: 260px;
  }
  .pvp-poll {
    padding: 1rem;
    margin: 0.75rem;
  }
  .pvp-auth-section {
    padding: 0.75rem;
  }
  .pvp-phone-step,
  .pvp-otp-step {
    gap: 0.5rem;
  }
}

/* Ensure links/buttons look ok inside poll */
.pvp-poll a {
  color: #2563eb;
  text-decoration: none;
}

.pvp-poll a:hover {
  text-decoration: underline;
}

/* Accessibility: focus outlines */
.pvp-option:focus-within {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  outline: none;
  border-color: rgba(37, 99, 235, 0.12);
}

.pvp-phone-input:focus,
.pvp-otp-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error message styling */
.pvp-error {
  padding: 1rem;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  text-align: center;
  margin: 1rem 0;
}

/* End of phonevote-polls.css */
