/* =========================================
   PROMĚNNÉ A ZÁKLAD
   ========================================= */
:root {
    --color-bg: #f3f7f4;
    --color-surface: #ffffff;
    --color-primary: #2d7a31;
    --color-primary-hover: #225e25;
    --color-text: #2a332a;
    --color-text-light: #5f7060;
    --color-border: #e2ebe3;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(45, 122, 49, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

p,
h1,
h2,
h3,
td,
th {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

h1,
h2,
h3 {
    line-height: 1.3;
}

/* =========================================
   HLAVNÍ LAYOUT (GRID)
   ========================================= */
.layout-wrapper {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 300px;
    gap: 30px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    align-items: start;
}

/* =========================================
   KOMPONENTY (KARTY A PANELY)
   ========================================= */
.sidebar-left,
.content-main,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Identické bílé karty jako na indexu */
.content-card,
.form-card,
.contact-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

/* =========================================
   LEVÝ PANEL
   ========================================= */
.nav-logo {
    display: block;
    max-width: 130px;
    margin: 0 auto 20px;
}

.nav-list {
    list-style: none;
    padding: 15px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.nav-list li {
    margin-bottom: 5px;
}

.nav-list li:last-child {
    margin-bottom: 0;
}

.nav-list a {
    display: block;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
}

.nav-list a:hover {
    background: #f0f7f1;
    color: var(--color-primary);
}

.nav-list a.active {
    background: var(--color-primary);
    color: #fff;
}

.search-box input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-family: inherit;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
}

.contact-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.contact-card p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-bottom: 10px;
}

.contact-card a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.map-container iframe {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    display: block;
}

/* =========================================
   STŘEDNÍ PANEL (VÝBOR A KARTY ČLENŮ)
   ========================================= */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.member-card-box {
    background-color: #fbfcfb;
    /* Lehce odlišné pozadí, aby karta vylezla z bílého content-card */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 25px 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.member-card-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
    background-color: var(--color-surface);
}

.member-photo {
    width: 110px;
    height: 110px;
    object-fit: cover;
    /* Garantuje perfektní kruh */
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.member-photo:hover {
    transform: scale(1.05);
}

.member-card-box h3 {
    color: var(--color-text);
    font-size: 1.25rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.member-card-box .role {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    min-height: 25px;
}

.member-card-box .contact {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 600;
    background-color: #eaf2eb;
    padding: 8px 15px;
    border-radius: 20px;
    white-space: nowrap;
}

/* =========================================
   TABULKA ČLENŮ (Pevný layout proti posouvání)
   ========================================= */
.table-responsive {
    width: 100%;
    overflow: hidden; /* Žádný posuvník na PC */
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    box-sizing: border-box;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Uzamčené sloupce, tabulka drží tvar */
}

/* Poměry sloupců: Jméno 40%, Zvířata 60% */
.modern-table th:nth-child(1), .modern-table td:nth-child(1) { width: 40%; }
.modern-table th:nth-child(2), .modern-table td:nth-child(2) { width: 60%; }

.modern-table thead {
    background: #eaf2eb;
}

.modern-table th {
    text-align: left;
    padding: 15px;
    color: var(--color-primary);
    font-weight: 700;
    border-bottom: 2px solid var(--color-border);
}

.modern-table td {
    padding: 15px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
    white-space: normal; /* Dlouhý text se zalomí, neroztáhne tabulku */
    word-break: normal;
}

.modern-table tbody tr:hover {
    background: #f9fbf9;
}

/* =========================================
   MODÁLNÍ OKNO PRO ZVĚTŠENÍ FOTEK (OPRAVA DEFORMACE)
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 30, 22, 0.95);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    display: block;
    width: auto !important;
    /* ZABRAŇUJE ROZTAŽENÍ DO ŠÍŘKY */
    height: auto !important;
    /* ZABRAŇUJE ROZTAŽENÍ DO VÝŠKY */
    max-width: 100%;
    /* Nepřeteče displej na šířku */
    max-height: 80vh;
    /* Nepřeteče displej na výšku */
    object-fit: contain;
    /* Pojistka: Zachová správný poměr stran i při zvětšování/zmenšování */
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoom 0.3s ease-out;
}

#caption {
    margin-top: 15px;
    color: #fff;
    font-weight: 600;
    font-size: 1.2rem;
    text-align: center;
}

@keyframes zoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.close:hover {
    color: var(--color-primary);
}

/* =========================================
   PRAVÝ PANEL (FORMULÁŘ)
   ========================================= */
.form-card h2 {
    color: var(--color-primary);
    margin-bottom: 5px;
}

.form-desc {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    background: #fbfcfb;
    transition: border-color 0.2s;
    font-size: 16px;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: var(--color-primary-hover);
}

.confirmation {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: #eaf2eb;
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
}

/* =========================================
   PATIČKA
   ========================================= */
.footer-modern {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 40px 20px;
    margin-top: 40px;
    width: 100%;
    display: block;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #f0f7f1;
    color: var(--color-primary);
    font-size: 22px;
    text-decoration: none;
    transition: transform 0.2s, background 0.2s;
}

.social-links a:hover {
    transform: translateY(-3px);
    background: var(--color-primary);
    color: #fff;
}

.copyright {
    margin: 20px 0;
    color: var(--color-text-light);
    font-size: 0.95rem;
}

.partners-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.partner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.partner-title {
    font-size: 0.85rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.partner-item img {
    height: 35px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.partner-item a:hover img {
    opacity: 1;
}

/* =========================================
   RESPONZIVITA (MOBILY A TABLETY)
   ========================================= */
.mobile-header,
.mobile-nav-overlay {
    display: none;
}

@media (max-width: 1200px) {
    .layout-wrapper {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .sidebar-right {
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 992px) {
    .layout-wrapper {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        margin-top: 80px;
        padding: 0 15px;
        gap: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .content-main {
        order: 1;
        width: 100%;
    }

    .sidebar-right {
        order: 2;
        width: 100%;
    }

    .sidebar-left {
        order: 3;
        width: 100%;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--color-surface);
        padding: 15px 20px;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        box-shadow: var(--shadow-sm);
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-title {
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--color-primary);
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        padding: 5px;
    }

    .hamburger span {
        width: 25px;
        height: 3px;
        background: var(--color-text);
        border-radius: 2px;
        transition: all 0.3s;
    }

    .mobile-nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--color-surface);
        z-index: 1001;
        transition: left 0.3s ease;
        padding: 20px;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
    }

    .mobile-nav-overlay.active {
        left: 0;
    }

    .close-btn {
        position: absolute;
        top: 15px;
        right: 20px;
        font-size: 32px;
        cursor: pointer;
        color: var(--color-text);
        line-height: 1;
    }

    .mobile-nav-logo {
        max-width: 100px;
        margin: 30px auto;
        display: block;
    }

    .mobile-nav-list {
        list-style: none;
        padding: 0;
    }

    .mobile-nav-list a {
        display: block;
        padding: 15px;
        color: var(--color-text);
        text-decoration: none;
        font-weight: 600;
        border-bottom: 1px solid var(--color-border);
        transition: color 0.2s;
    }

    .mobile-nav-list a.active,
    .mobile-nav-list a:hover {
        color: var(--color-primary);
    }

    .content-card,
    .form-card,
    .contact-card {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {

    /* Tabulka jako karty na telefonu (pro Kontrolní komisi) */
    .table-responsive {
        border: none;
        background: transparent;
        padding: 0;
        overflow: visible;
    }

    .modern-table,
    .modern-table tbody,
    .modern-table tr,
    .modern-table td {
        display: block;
        width: 100%;
        min-width: unset;
    }

    .modern-table thead {
        display: none;
    }

    .modern-table tr {
        background: #fff;
        border: 1px solid var(--color-primary);
        border-radius: var(--radius-md);
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: var(--shadow-sm);
    }

    .modern-table td {
        padding: 5px 0;
        border: none;
        text-align: left;
    }

    /* Vytvoření falešných hlaviček pro tabulku Členů na telefonu */
    .modern-table td:nth-child(1)::before {
        content: "Jméno: ";
        font-weight: 700;
        color: var(--color-primary);
        display: block;
        margin-bottom: 2px;
    }

    .modern-table td:nth-child(2)::before {
        content: "Chovaná zvířata: ";
        font-weight: 700;
        color: var(--color-primary);
        display: block;
        margin-bottom: 2px;
        margin-top: 10px;
    }
}

@media (max-width: 576px) {
    .members-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .member-card-box {
        padding: 20px 10px;
    }

    .member-photo {
        width: 90px;
        height: 90px;
    }

    .member-card-box h3 {
        font-size: 1.1rem;
    }

    .member-card-box .contact {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
}