:root {
    --bg-color: #FAFAFA;
    --text-primary: #2C2825;
    --text-secondary: #5C4033;
    --accent-color: #8B5A2B;
    --accent-hover: #704722;
    --surface-color: #FFFFFF;
    --border-color: #E6DFD9;
    --error-color: #D9534F;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 3px rgba(92, 64, 51, 0.08);
    --shadow-md: 0 4px 12px rgba(92, 64, 51, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    font-weight: 600;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2rem;
    color: var(--accent-color);
    font-style: italic;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

#display-username {
    font-weight: 500;
}

/* Buttons */
button {
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.2s ease;
}

.primary-button {
    background-color: var(--accent-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
}

.primary-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.text-button {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.text-button:hover {
    color: var(--accent-color);
}

.icon-button {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: var(--radius-md);
}

.icon-button:hover {
    background-color: var(--border-color);
}

/* Layout & Cards */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-input {
    margin-bottom: 1rem;
}

/* Polls Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.polls-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.poll-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.poll-card:hover {
    box-shadow: var(--shadow-md);
}

.poll-question {
    font-size: 1.25rem;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.poll-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.poll-option:hover {
    border-color: var(--accent-color);
    background-color: rgba(139, 90, 43, 0.03);
}

.poll-option input[type="radio"] {
    accent-color: var(--accent-color);
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    cursor: pointer;
}

.poll-option label {
    flex: 1;
    cursor: pointer;
    z-index: 1;
}

.poll-option-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(139, 90, 43, 0.1);
    z-index: 0;
    transition: width 0.3s ease;
}

.poll-option-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
    z-index: 1;
}

/* Option E Free text */
.free-text-input {
    margin-top: 0.5rem;
    width: 100%;
}

/* Voter list */
.poll-meta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.voters-list {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.voter-tag {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Closed Polls Layout */
.closed-poll-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 1rem;
}

.closed-poll-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.winner-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.expand-icon {
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.expanded .expand-icon {
    transform: rotate(180deg);
}

.closed-poll-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.admin-close-btn {
    font-size: 0.8rem;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
}

.admin-close-btn:hover {
    background-color: var(--error-color);
    color: white;
}

.admin-action-btn {
    font-size: 0.8rem;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-action-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 40, 37, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header .icon-button {
    font-size: 1.5rem;
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 1rem 0;
}

.info-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.error-text {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}