/**
 * Własne style dla systemu głosowania
 */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Navbar */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Nagłówek ze zdjęciem */
.header-section {
    margin-bottom: 0;
}

.header-image-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.header-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    /* Wycentrowane */
    display: block;
    margin: 0 auto;
}

.header-logo {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.header-logos {
    gap: 1.5rem;
}

.forum-banner {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.65));
    padding: 1.5rem 0;
}

.forum-banner-image {
    max-width: min(100%, 800px);
    width: 90%;
    height: auto;
    display: inline-block;
}

.partners-banner {
    background: #f8f9fa;
}

.partners-banner-image {
    max-width: min(100%, 900px);
    width: 90%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.6) 100%);
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.header-fallback {
    padding: 3rem 0;
}

/* Hero Section - Kompaktowa */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hero-section.bg-light {
    background: #f8f9fa !important;
    color: inherit;
    border-bottom: 2px solid #dee2e6;
}

/* Cards */
.card {
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.card-img-wrapper {
    overflow: hidden;
    position: relative;
    width: 100%;
    /* Fallback dla starszych przeglądarek */
    height: 0;
    padding-bottom: 100%;
    /* Tworzy kwadratowy kontener (100% szerokości = 100% wysokości) */
    background-color: #f8f9fa;
    /* Tło na wypadek problemów z ładowaniem */
}

/* Współczesne przeglądarki - aspect-ratio */
@supports (aspect-ratio: 1 / 1) {
    .card-img-wrapper {
        height: auto;
        padding-bottom: 0;
        aspect-ratio: 1 / 1;
        /* Kwadratowy format */
    }
}

/* Większe zdjęcia w liście kandydatów - również kwadratowe */
/* aspect-ratio jest dziedziczone z .card-img-wrapper */

.card-img-top {
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    /* Skupienie na górnej 30% zdjęcia (twarz) */
    position: absolute;
    /* Dla fallback z padding-bottom */
    top: 0;
    left: 0;
}

/* Dla przeglądarek z aspect-ratio */
@supports (aspect-ratio: 1 / 1) {
    .card-img-top {
        position: relative;
        /* Powrót do normalnego pozycjonowania */
    }
}

/* Dla wszystkich zdjęć kandydatów - skupienie na twarzy */
.candidates-section .card-img-top,
#candidatePreview .card-img-top,
.card-img-top {
    object-position: center 30%;
    /* Skupienie na górnej 30% zdjęcia (twarz) */
}

.card:hover .card-img-top {
    transform: scale(1.1);
}

/* Voting Form */
.voting-section {
    min-height: 400px;
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Candidate Preview */
#candidatePreview .card {
    border: 2px solid var(--primary-color) !important;
}

#candidatePreview .card-img-wrapper {
    max-width: 200px;
    /* Maksymalna szerokość dla podglądu */
    margin: 0 auto;
    /* Wyśrodkowanie */
    /* aspect-ratio jest dziedziczone z .card-img-wrapper */
}

@supports (aspect-ratio: 1 / 1) {
    #candidatePreview .card-img-wrapper {
        aspect-ratio: 1 / 1;
        /* Kwadratowy format również w podglądzie */
    }
}

#candidatePreview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}

/* Buttons */
.btn {
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
}

/* Candidates Grid */
.candidates-section .card {
    height: 100%;
}

.candidates-section .card-body {
    display: flex;
    flex-direction: column;
}

.candidates-section .card-footer {
    margin-top: auto;
}

/* Karty kandydatów w układzie jednookienkowym */
.candidate-card {
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.candidate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    border-color: var(--primary-color) !important;
}

.candidate-card.border-primary {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

/* Sticky formularz */
.sticky-top {
    z-index: 1020;
}

/* Karty kandydatów */
.candidate-card-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.candidate-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
}

/* Opis wydarzenia */
.event-description {
    line-height: 1.85;
    font-size: 1.05rem;
    text-align: justify;
}

.event-description p {
    text-align: justify;
    margin-bottom: 1.5rem;
    margin-top: 0;
    color: #495057;
    text-indent: 0;
}

.event-description p:last-of-type {
    margin-bottom: 0;
}

.event-description h5 {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    text-align: left;
    font-size: 1.25rem;
}

.event-description h5:first-child {
    margin-top: 0;
}

/* Status głosowania */
.voting-status {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    margin: 0;
    line-height: 1.6;
}

.voting-status-active {
    color: var(--success-color);
    background-color: rgba(25, 135, 84, 0.1);
    border-radius: 0.375rem;
}

.voting-status-inactive {
    color: #856404;
    background-color: rgba(255, 193, 7, 0.15);
    border-radius: 0.375rem;
}

.voting-status i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.voting-status strong {
    font-weight: 600;
}

/* Modalne okna */
.modal-body img {
    max-width: 100%;
    height: auto;
}

.candidate-description {
    line-height: 1.8;
}

.candidate-description p {
    text-align: justify;
}

.candidate-description h6 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Responsywność */
@media (max-width: 991px) {
    .candidate-card-item {
        margin-bottom: 1rem;
    }

    .event-description {
        text-align: left;
    }
}

@media (max-width: 576px) {
    .candidates-list-section .col-12 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-footer {
        padding: 0.5rem;
    }

    .header-image-wrapper {
        height: 300px;
    }

    .header-overlay h1 {
        font-size: 1.75rem;
    }

    .header-overlay .lead {
        font-size: 1rem;
    }

    .header-logo {
        max-height: 60px;
    }

    .forum-banner {
        padding: 1rem 0;
    }

    .forum-banner-image,
    .partners-banner-image {
        width: 95%;
        max-width: 100%;
    }

    .event-description {
        font-size: 1rem;
        text-align: left;
        line-height: 1.8;
    }

    .event-description p {
        text-align: left;
        margin-bottom: 1.25rem;
    }

    .event-description h5 {
        font-size: 1.15rem;
        margin-top: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .voting-status {
        font-size: 0.95rem;
        padding: 0.6rem 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .voting-status i {
        font-size: 1rem;
        margin-right: 0.4rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section .display-4 {
        font-size: 2rem;
    }

    .candidates-section .col-md-6 {
        margin-bottom: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.candidates-section .card {
    animation: fadeIn 0.5s ease-out;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alerts */
.alert {
    border-radius: 10px;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Utilities */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}