:root {
    /* Цветовая палитра из изображений */
    --primary-red: #B8252E;
    --dark-red: #9B1B23;
    --light-beige: #F5E8D8;
    --beige: #EBD9C3;
    --accent-orange: #FF6B35;
    --accent-pink: #E63946;
    --dark-blue: #1D3557;
    --text-dark: #2c3e50;
    --text-light: #666;
    --white: #ffffff;

    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--light-beige) 0%, var(--beige) 100%);
    min-height: 100vh;
    padding: 0;
    color: var(--text-dark);
    position: relative;
    overflow-x: hidden;
}

/* Декоративные элементы фона */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: repeating-linear-gradient(
        45deg,
        var(--primary-red),
        var(--primary-red) 20px,
        var(--white) 20px,
        var(--white) 40px
    );
    z-index: -1;
    opacity: 0.15;
}

body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: repeating-linear-gradient(
        -45deg,
        var(--primary-red),
        var(--primary-red) 15px,
        var(--white) 15px,
        var(--white) 30px
    );
    z-index: -1;
    opacity: 0.1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: transparent;
    padding: 20px;
}

/* Header с эффектом рваной бумаги */
.header {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
    padding: 60px 40px 50px;
    text-align: center;
    position: relative;
    margin-bottom: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(184, 37, 46, 0.3);
    overflow: hidden;
}

/* Эффект рваной бумаги снизу */
.header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(135deg, var(--light-beige) 0%, var(--beige) 100%);
    clip-path: polygon(
        0% 40%, 3% 50%, 6% 35%, 9% 55%, 12% 30%, 15% 60%, 18% 25%, 21% 65%,
        24% 45%, 27% 70%, 30% 35%, 33% 60%, 36% 40%, 39% 55%, 42% 30%,
        45% 65%, 48% 45%, 51% 70%, 54% 40%, 57% 60%, 60% 35%, 63% 55%,
        66% 30%, 69% 65%, 72% 40%, 75% 60%, 78% 35%, 81% 55%, 84% 45%,
        87% 65%, 90% 40%, 93% 60%, 96% 35%, 100% 50%, 100% 100%, 0% 100%
    );
}

.header h1 {
    font-size: 3em;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.header h2 {
    font-size: 1.6em;
    font-weight: 400;
    opacity: 0.95;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.15);
}

.status-bar {
    margin-top: 30px;
    padding: 18px 25px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.status {
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status.active {
    color: #90EE90;
}

.status.not-started {
    color: #FFD700;
}

.status.finished {
    color: #FFB6C1;
}

/* Download Section */
.download-section {
    margin-bottom: 40px;
}

.download-card {
    background: var(--white);
    border: 3px solid var(--primary-red);
    border-radius: var(--border-radius);
    padding: 40px 35px;
    text-align: center;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.download-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-orange), var(--accent-pink), var(--primary-red));
}

.download-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.download-card h3 {
    font-size: 2em;
    color: var(--primary-red);
    margin-bottom: 15px;
    font-weight: 700;
}

.download-card p {
    color: var(--text-light);
    font-size: 1.1em;
    margin-bottom: 30px;
    line-height: 1.6;
}

.btn-download {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(184, 37, 46, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(184, 37, 46, 0.4);
    background: linear-gradient(135deg, var(--dark-red) 0%, var(--primary-red) 100%);
}

.btn-download:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.3em;
    animation: pulse-icon 1.5s infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Main Content */
.main-content {
    padding: 0;
}

/* Stats Section */
.stats-section {
    margin-bottom: 40px;
}

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

.stat-card {
    background: var(--white);
    border: 3px solid var(--primary-red);
    padding: 35px 25px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-orange), var(--accent-pink));
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(184, 37, 46, 0.2);
}

.stat-label {
    font-size: 1.1em;
    color: var(--text-light);
    margin-bottom: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 3.5em;
    font-weight: 800;
    color: var(--primary-red);
    line-height: 1;
}

/* Votes Log Section */
.votes-log-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--box-shadow);
    position: relative;
}

.votes-log-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-orange), var(--accent-pink), var(--primary-red));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.votes-log-section h3 {
    font-size: 2em;
    color: var(--primary-red);
    margin-bottom: 15px;
    font-weight: 700;
}

.votes-log-section > p {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 1.05em;
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.votes-log-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.votes-log-table thead {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
}

.votes-log-table th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.votes-log-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: var(--transition);
}

.votes-log-table tbody tr:hover {
    background: linear-gradient(90deg, #fff5f5 0%, #fff 100%);
    transform: scale(1.01);
}

.votes-log-table tbody tr:last-child {
    border-bottom: none;
}

.votes-log-table td {
    padding: 15px;
    font-size: 0.95em;
    vertical-align: middle;
}

.votes-log-table a {
    color: var(--primary-red);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.votes-log-table a:hover {
    color: var(--accent-orange);
    text-decoration: underline;
}

.vote-status {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vote-status.counted {
    background: linear-gradient(135deg, #90EE90, #7FD87F);
    color: #1a5c1a;
    box-shadow: 0 2px 8px rgba(144, 238, 144, 0.3);
}

.vote-status.cancelled {
    background: linear-gradient(135deg, #FFB6C1, #FF9AA2);
    color: #8B0000;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.3);
}

/* Results Section */
.results-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 50px 40px;
    margin-bottom: 40px;
    box-shadow: var(--box-shadow);
    position: relative;
}

.results-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-orange), var(--accent-pink), var(--primary-red));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.results-title {
    text-align: center;
    font-size: 2.8em;
    margin-bottom: 40px;
    color: var(--primary-red);
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

.shift-result {
    background: linear-gradient(135deg, #fff 0%, var(--light-beige) 100%);
    border-radius: var(--border-radius);
    padding: 35px;
    margin-bottom: 35px;
    border: 2px solid var(--beige);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.shift-result-header {
    border-bottom: 3px solid var(--primary-red);
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.shift-result-header h3 {
    font-size: 2em;
    color: var(--primary-red);
    margin-bottom: 8px;
    font-weight: 700;
}

.shift-result-stats {
    color: var(--text-light);
    font-size: 1em;
    font-weight: 500;
}

.candidates-list h5 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: var(--primary-red);
    font-weight: 700;
}

.candidate-item {
    background: var(--white);
    padding: 20px 25px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border: 2px solid var(--light-beige);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.candidate-item:hover {
    border-color: var(--primary-red);
    transform: translateX(8px);
    box-shadow: -4px 0 0 var(--primary-red), var(--box-shadow);
}

/* Стили для победителя - инверсия цветов */
.candidate-item.winner {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    border-color: var(--dark-red);
    box-shadow: 0 8px 20px rgba(184, 37, 46, 0.4);
}

.candidate-item.winner:hover {
    transform: translateX(8px);
    box-shadow: -4px 0 0 var(--dark-red), 0 8px 20px rgba(184, 37, 46, 0.5);
}

.candidate-item.winner .candidate-name {
    color: var(--white);
    font-size: 1.3em;
}

.candidate-name {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--text-dark);
}

.candidate-stats-inline {
    display: flex;
    gap: 25px;
    align-items: center;
}

.candidate-votes {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: var(--white);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(184, 37, 46, 0.3);
}

/* Инверсия для победителя */
.candidate-item.winner .candidate-votes {
    background: var(--white);
    color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.candidate-percentage {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--primary-red);
}

/* Инверсия для победителя */
.candidate-item.winner .candidate-percentage {
    color: var(--white);
}

.special-votes {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 3px solid var(--light-beige);
}

.special-votes h5 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--text-light);
    font-weight: 600;
}

.special-votes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.special-vote-item {
    background: linear-gradient(135deg, var(--light-beige), var(--beige));
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid var(--beige);
    transition: var(--transition);
}

.special-vote-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.special-vote-label {
    font-size: 0.95em;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.special-vote-count {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--primary-red);
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
    padding: 30px 40px;
    text-align: center;
    border-radius: var(--border-radius);
    margin-top: 40px;
    box-shadow: 0 -5px 20px rgba(184, 37, 46, 0.2);
}

.footer p {
    margin-bottom: 10px;
    font-size: 1em;
}

.footer a {
    color: var(--light-beige);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.footer a:hover {
    color: var(--white);
    border-bottom-color: var(--white);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2.5em;
    }

    .header h2 {
        font-size: 1.4em;
    }

    .votes-log-section {
        padding: 30px 25px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 40px 25px 35px;
        margin-bottom: 25px;
    }

    .header h1 {
        font-size: 2em;
    }

    .header h2 {
        font-size: 1.2em;
    }

    .status-bar {
        padding: 15px 20px;
    }

    .status {
        font-size: 1em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stat-card {
        padding: 30px 20px;
    }

    .stat-value {
        font-size: 3em;
    }

    .download-card {
        padding: 30px 25px;
    }

    .download-card h3 {
        font-size: 1.6em;
    }

    .download-card p {
        font-size: 1em;
    }

    .btn-download {
        padding: 15px 30px;
        font-size: 1em;
    }

    .votes-log-section {
        padding: 25px 20px;
        border-radius: 8px;
    }

    .votes-log-section h3 {
        font-size: 1.6em;
    }

    .table-container {
        border-radius: 8px;
    }

    .votes-log-table th,
    .votes-log-table td {
        padding: 12px 10px;
        font-size: 0.85em;
    }

    .results-section {
        padding: 35px 25px;
    }

    .results-title {
        font-size: 2em;
    }

    .shift-result {
        padding: 25px 20px;
    }

    .shift-result-header h3 {
        font-size: 1.6em;
    }

    .candidate-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 18px 20px;
    }

    .candidate-stats-inline {
        width: 100%;
        justify-content: space-between;
    }

    .special-votes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .footer {
        padding: 25px 20px;
        margin-top: 25px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.6em;
    }

    .header h2 {
        font-size: 1em;
    }

    .stat-label {
        font-size: 0.95em;
    }

    .stat-value {
        font-size: 2.5em;
    }

    .votes-log-section h3 {
        font-size: 1.4em;
    }

    .votes-log-table th,
    .votes-log-table td {
        padding: 10px 8px;
        font-size: 0.8em;
    }

    .vote-status {
        padding: 5px 12px;
        font-size: 0.75em;
    }

    .results-title {
        font-size: 1.6em;
    }

    .candidate-name {
        font-size: 1.1em;
    }
}

/* ============================================================
   Таймер обратного отсчёта на главной странице
   ============================================================ */
.public-timer {
    margin-top: 20px;
}

.timer-header {
    
    padding: 15px;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

.timer-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-countdown {
    font-size: 5em;
    font-weight: 800;
    text-align: center;
    color: var(--primary-red);
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 8px;
    padding: 30px 20px;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Мобильная адаптация для таймера */
@media (max-width: 768px) {
    .timer-header h3 {
        font-size: 0.9em;
        letter-spacing: 0.5px;
    }

    .timer-countdown {
        font-size: 2.5em;
        letter-spacing: 4px;
        padding: 20px 10px;
    }
}

@media (max-width: 480px) {
    .timer-header {
        padding: 12px;
    }

    .timer-header h3 {
        font-size: 0.8em;
    }

    .timer-countdown {
        font-size: 2em;
        letter-spacing: 2px;
        padding: 15px 8px;
    }
}
