:root {
    --primary-color: #3b5998; /* Plava, moderna boja */
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --danger-color: #dc3545;
    --bg-light: #f4f7f9; /* Svijetlo siva pozadina */
    --bg-card: #ffffff;
    --border-color: #e9ecef;
    --text-color: #333;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-top: 0;
    font-size: 2.2em;
    font-weight: 600;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.separator {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

/* --- Utility klase (za dinamički JS) --- */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.p-3 { padding: 1rem; }
.bg-light { background-color: #f8f9fa !important; }
.rounded { border-radius: 0.25rem; }
.shadow-sm { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.text-danger { color: var(--danger-color); }
.text-secondary { color: var(--secondary-color); }

/* --- Opći Stilovi za Kartice i Naslove --- */
.card {
    background-color: var(--bg-card);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    transition: box-shadow 0.3s ease;
}

.shadow {
    box-shadow: var(--shadow-light);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.8em;
}

h2 i {
    margin-right: 10px;
}

/* --- Forma i Inputi --- */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.2);
    outline: none;
}

/* --- Gumbi (Buttons) --- */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, opacity 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-sm { padding: 5px 10px; font-size: 0.9em; }


.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1e7e34;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
}

.btn-full-width {
    width: 100%;
    text-transform: uppercase;
    font-size: 1.1em;
    padding: 15px;
}

.btn:disabled {
    background-color: var(--secondary-color);
    opacity: 0.6;
    cursor: not-allowed;
}

.error-text {
    color: var(--danger-color);
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 0.95em;
    font-weight: 600;
}

/* --- Dinamički Unos Pitanja i Opcija --- */
.question-card {
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 8px;
}

.question-text-input {
    width: 100%;
    margin-bottom: 10px;
}

.option-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.option-input-group input {
    flex-grow: 1;
}

.options-preview-list {
    list-style: none;
    padding: 0;
}

.options-preview-list li {
    background-color: var(--bg-light);
    padding: 8px 15px;
    border-left: 3px solid var(--accent-color);
    border-radius: 5px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-option-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.1em;
}


/* --- Prikaz Aktivnih Anketa (Grid) --- */
.polls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.poll-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow-light);
}

.poll-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.poll-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: var(--primary-color);
    line-height: 1.3;
}

h4 {
    color: #495057;
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 10px;
}

/* --- Prikaz Pitanja i Opcija (Question Display Area) --- */
.question-display-area {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 20px;
}

.poll-option {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 5px 0;
}

.vote-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    margin-right: 15px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vote-btn:hover {
    background-color: #2d4573;
}

.results-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
    width: 100%;
    margin-left: 5px;
}

.results-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.5s ease-in-out;
}

.results-text {
    font-size: 0.9em;
    color: var(--secondary-color);
    margin-left: 15px;
    min-width: 60px;
    text-align: right;
}

/* Edit State Inputi */
.edit-title-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-color);
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}
.edit-question-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-color);
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
}
.poll-option input[type="text"] {
    flex-grow: 1;
    padding: 5px;
    border: 1px solid var(--primary-color);
    margin-right: 10px;
}
.remove-edit-option-btn {
    margin-right: 5px;
}


#no-polls-message {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--secondary-color);
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    font-size: 1.1em;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 50px;
    background-color: #343a40;
    color: #ccc;
}