/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: #666;
    font-size: 1.2em;
}

p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Формы */
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

button,
.btn {
    background: #667eea;
    color: white;
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

button:hover,
.btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Страница голосования */
.hint {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 25px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-label input {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-label span {
    font-size: 1.1em;
    color: #333;
}

.submit-btn {
    width: 100%;
    margin-top: 20px;
}

/* Страница успеха */
.success-card {
    text-align: center;
}

.success-icon {
    font-size: 5em;
    color: #28a745;
    margin-bottom: 20px;
}

/* Сообщения */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Ссылки */
.admin-link {
    text-align: center;
    margin-top: 20px;
}

.admin-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
}

.admin-link a:hover {
    text-decoration: underline;
}

/* Админ-панель */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.option-input {
    margin-bottom: 10px;
}

#optionsContainer input,
#editOptionsContainer input {
    display: block;
}

.poll-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.poll-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.poll-info h3 {
    margin-bottom: 10px;
}

.poll-code {
    color: #667eea;
    font-size: 1.1em;
}

.poll-date {
    color: #999;
    font-size: 0.9em;
}

.poll-actions {
    display: flex;
    gap: 10px;
}

.poll-actions .btn {
    padding: 10px 20px;
    font-size: 0.9em;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Страница результатов */
.results-body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.results-header {
    text-align: center;
    color: white;
    margin-bottom: 50px;
}

.results-header h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.results-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2em;
}

.poll-code-display {
    color: rgba(255, 255, 255, 0.9);
    margin-top: 10px;
}

.results-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    min-height: 400px;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 15px;
    max-width: 200px;
}

.bar-wrapper {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 15px;
}

.bar {
    width: 80%;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 10px 10px 0 0;
    transition: height 0.5s ease;
    position: relative;
    min-height: 30px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.bar-label {
    color: white;
    font-weight: bold;
    font-size: 1.5em;
    padding: 10px;
}

.bar-info {
    text-align: center;
    width: 100%;
}

.option-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.percentage {
    color: #667eea;
    font-size: 1.3em;
    font-weight: bold;
}

.live-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.live-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .card {
        padding: 20px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
    }

    .poll-item {
        flex-direction: column;
        gap: 15px;
    }

    .poll-actions {
        width: 100%;
        flex-direction: column;
    }

    .poll-actions .btn {
        width: 100%;
    }

    .results-chart {
        flex-wrap: wrap;
        min-height: auto;
    }

    .bar-container {
        margin: 10px;
    }

    .bar-wrapper {
        height: 250px;
    }
}
