/* ==========================================================================
   Church Assembly Voting System (Загальні Збори Церкви)
   Palette:
   - Primary: #527bbf
   - Primary Accent / Light: #64a2e5
   - Light Background: #f4f4f2
   - Dark Text / Charcoal: #2d2c2a
   - Accent Orange / Coral: #ec744a
   - Success Green: #4caf50
   - Danger Red: #e53935
   ========================================================================== */

:root {
  --primary: #527bbf;
  --primary-hover: #4369a8;
  --primary-light: #64a2e5;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-alt: #eaeaea;
  --text: #2d2c2a;
  --text-muted: #6b6a67;
  --border: #dcdcd8;
  
  --coral: #ec744a;
  --coral-hover: #db6137;
  --green: #4caf50;
  --green-dark: #388e3c;
  --red: #e53935;
  --red-dark: #d32f2f;
  --amber: #f57c00;
  
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  
  --shadow-sm: 0 2px 8px rgba(45, 44, 42, 0.05);
  --shadow: 0 6px 20px rgba(45, 44, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(45, 44, 42, 0.12);
}

[data-theme="dark"], body.dark-theme {
  --primary: #64a2e5;
  --primary-hover: #7bb3ed;
  --primary-light: #527bbf;
  --bg: #2d2c2a;
  --surface: #383734;
  --surface-alt: #444340;
  --text: #f4f4f2;
  --text-muted: #b5b4b0;
  --border: #4d4b47;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wide-container {
  max-width: 1200px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 18px;
  gap: 12px;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-green {
  background: rgba(76, 175, 80, 0.15);
  color: var(--green);
  border: 1px solid var(--green);
}

.badge-red {
  background: rgba(229, 57, 53, 0.15);
  color: var(--red);
  border: 1px solid var(--red);
}

.badge-coral {
  background: rgba(236, 116, 74, 0.15);
  color: var(--coral);
  border: 1px solid var(--coral);
}

.badge-blue {
  background: rgba(82, 123, 191, 0.15);
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Buttons */
button {
  font-family: inherit;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-coral {
  background: var(--coral);
}
.btn-coral:hover {
  background: var(--coral-hover);
}

.btn-red {
  background: var(--red);
}
.btn-red:hover {
  background: var(--red-dark);
}

.btn-green {
  background: var(--green);
}
.btn-green:hover {
  background: var(--green-dark);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(82, 123, 191, 0.05);
}

/* Voting Buttons for Voters */
.btn-vote {
  width: 100%;
  padding: 18px 22px;
  border-radius: var(--radius);
  font-size: 1.2rem;
  font-weight: 800;
  border: 2.5px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
  background: var(--surface-alt);
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.btn-vote:active {
  transform: scale(0.97);
}

.btn-vote-for {
  border-color: rgba(76, 175, 80, 0.35);
}
.btn-vote-for:hover {
  border-color: var(--green);
}
.btn-vote-for.selected {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.45);
}

.btn-vote-against {
  border-color: rgba(229, 57, 53, 0.35);
}
.btn-vote-against:hover {
  border-color: var(--red);
}
.btn-vote-against.selected {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.45);
}

.btn-vote-abstain {
  border-color: rgba(82, 123, 191, 0.35);
}
.btn-vote-abstain:hover {
  border-color: var(--primary);
}
.btn-vote-abstain.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(82, 123, 191, 0.45);
}

.choice-marker {
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Progress bar */
.progress-container {
  background: var(--surface-alt);
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
  position: relative;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Quorum Banner */
.quorum-banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border: 1.5px solid transparent;
  gap: 12px;
}

.quorum-banner.ok {
  background: rgba(76, 175, 80, 0.12);
  border-color: var(--green);
  color: var(--green);
}

.quorum-banner.no {
  background: rgba(236, 116, 74, 0.12);
  border-color: var(--coral);
  color: var(--coral);
}

/* Pulse animation */
.pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 8px;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(0.95); opacity: 1; }
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.result-card {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
}

.result-num {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  margin: 4px 0;
}

/* Verdict box */
.verdict-box {
  padding: 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 800;
  margin-top: 14px;
  letter-spacing: -0.2px;
}

.verdict-box.approved {
  background: rgba(76, 175, 80, 0.15);
  border: 2px solid var(--green);
  color: var(--green);
}

.verdict-box.rejected {
  background: rgba(229, 57, 53, 0.15);
  border: 2px solid var(--red);
  color: var(--red);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

/* Print Styles for Protocol */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print, header, footer, button, .admin-grid, #admQuorumBanner {
    display: none !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .modal-content {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .protocol-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
}
