/* UZH Style-Inspired CSS */

:root {
  --uzh-blue: #0028A5;
  --uzh-cyan: #4AC9E3;
  --uzh-apple: #A5D233;
  --uzh-gold: #FFC845;
  --uzh-orange: #FC4C02;
  --uzh-berry: #BF0D3E;
  --uzh-grey: #666666;
  --uzh-light-grey: #FAFAFA;
  --btn-bg: #2b2b2b; /* dark grey, slightly softer than black */
  --btn-text: #ffffff;
  font-family: 'Source Sans Pro', sans-serif;
}

body {
  margin: 0;
  background-color: var(--uzh-light-grey);
  font-family: 'Source Sans Pro', sans-serif;
  color: var(--uzh-grey);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  width: 100%;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card.hidden {
  display: none;
}

button {
  font-family: 'Source Sans Pro', sans-serif;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
  width: 100%;
  box-sizing: border-box;
}

button:hover {
  background: var(--uzh-blue);
}

button:active {
  filter: brightness(0.95);
}

/* focus outline for keyboard users */
button:focus {
  outline: 3px solid rgba(0,40,165,0.15);
  box-shadow: 0 0 0 3px rgba(0,40,165,0.08);
}

button:disabled {
  background: var(--uzh-grey);
  cursor: not-allowed;
}

h1, h2, h3 {
  font-family: 'Source Sans Pro', sans-serif;
  margin: 0;
  color: var(--uzh-blue);
}

h1 {
  margin-top: 0;
  margin-bottom: 0;
}

input, select {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--uzh-grey);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: opacity 0.3s ease-in-out;
}

/* For admin card: show paired buttons on the same row for the first two
   form groups (Open/Close Pot and Open/Close Voting). Keep other admin
   form groups (e.g. Trigger/Refresh) unchanged so they remain full-width.
   Buttons will shrink equally to fit the row. On small screens they will
   stack again for better usability. */
.card#admin-card .form-group:nth-of-type(1),
.card#admin-card .form-group:nth-of-type(2) {
  flex-direction: row;
  gap: 0.5rem;
}

.card#admin-card .form-group:nth-of-type(1) button,
.card#admin-card .form-group:nth-of-type(2) button {
  width: auto; /* allow buttons to size to their content */
  flex: 1;     /* make paired buttons share available space evenly */
}

/* Responsive: stack the paired buttons vertically on narrow viewports */
@media (max-width: 520px) {
  .card#admin-card .form-group:nth-of-type(1),
  .card#admin-card .form-group:nth-of-type(2) {
    flex-direction: column;
  }
  .card#admin-card .form-group:nth-of-type(1) button,
  .card#admin-card .form-group:nth-of-type(2) button {
    width: 100%;
    flex: none;
  }
}

/* Smooth transition for hidden form groups */
.form-group.hidden {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-item {
  background: var(--uzh-light-grey);
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
}

.info-box {
  padding: 1rem;
  background: var(--uzh-light-grey);
  border-radius: 6px;
  border: 1px solid #ddd;
}

/* Section Header with Status Indicator */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--uzh-light-grey);
  border-radius: 20px;
  border: 1px solid #ddd;
  min-width: 100px;
}

.status-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--uzh-grey);
  position: relative;
  flex-shrink: 0;
}

.status-light.open {
  background: var(--uzh-apple);
  box-shadow: 0 0 8px rgba(165, 210, 51, 0.6);
}

.status-light.closed {
  background: var(--uzh-grey);
}

.status-light.loading {
  background: var(--uzh-gold);
}

.status-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--uzh-grey);
  text-transform: capitalize;
}

.message {
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.card-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.message.success {
  background: var(--uzh-apple);
  color: white;
}

.message.error {
  background: var(--uzh-berry);
  color: white;
}

.message.info {
  background: var(--uzh-cyan);
  color: white;
}

/* Vote Chart Styles */
#vote-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.vote-bar-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vote-bar-label {
  font-size: 0.9rem;
  color: var(--uzh-grey);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vote-bar-wrapper {
  width: 100%;
  background: var(--uzh-light-grey);
  border-radius: 4px;
  height: 30px;
  position: relative;
  overflow: hidden;
}

.vote-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--uzh-blue), var(--uzh-cyan));
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

.vote-bar.winning {
  background: linear-gradient(90deg, var(--uzh-apple), var(--uzh-gold));
}

/* Form sections */
#vote-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
