/* --- ZÁKLADNÍ NASTAVENÍ --- */
body {
    background-color: #f4f7f6;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
}

/* --- HLAVIČKA --- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background-color: #e6f0ea;
    gap: 20px;
    flex-wrap: wrap;
}

header h1 {
    font-size: 36px;
    margin: 0;
    margin-bottom: 8px;
    line-height: 1.2;
    font-weight: bold;
    background: linear-gradient(
        90deg,
        #ff6b6b,
        #ffd93d,
        #6bcB77,
        #4d96ff,
        #c77dff
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.intro-text {
    max-width: 500px;
    margin: 10px 0 0 0;
    line-height: 1.6;
}

.header-text {
    max-width: 600px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-left: auto;
}

.header-actions button {
    min-width: 120px;
    height: 48px;
}

.header-note {
    width: 100%;
    margin: 6px 0 0 0;
    font-size: 14px;
    color: #667;
}

/* --- OBECNÁ POLE --- */
input,
select,
textarea,
button {
    box-sizing: border-box;
    font-family: inherit;
}

input,
select {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background-color: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #a5d6a7;
    box-shadow: 0 0 0 3px rgba(165, 214, 167, 0.18);
}

/* --- FILTRY --- */
.filters {
    background-color: #ffffff;
    margin: 20px 40px;
    padding: 18px;
    border-radius: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.filters select,
.filters input {
    min-height: 44px;
    min-width: 150px;
    flex: 1 1 160px;
}

#genderFilter {
    min-width: 150px;
}

#ageMinFilter,
#ageMaxFilter {
    max-width: 130px;
}

#regionFilter {
    min-width: 220px;
}

#lookingForFilter {
    min-width: 180px;
}

/* --- TLAČÍTKA --- */
#loginBtn,
#myListingsBtn,
#addListingBtn,
#logoutBtn,
.detail-btn,
.reply-btn,
.delete-btn,
#saveListingBtn {
    background-color: #f0f2f5;
    color: #555;
    border: 1px solid #dcdfe3;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

#loginBtn:hover,
#logoutBtn:hover,
#myListingsBtn:hover,
#addListingBtn:hover,
.detail-btn:hover,
.reply-btn:hover,
.delete-btn:hover,
#saveListingBtn:hover {
    background-color: #e4e6e9;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#loginBtn {
    min-width: 220px;
    background-color: transparent;
    border: 1px solid #c0c4cc;
    color: #606266;
}

#clearFiltersBtn {
    background-color: transparent;
    color: #888;
    border: 1px solid #dcdfe3;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#clearFiltersBtn:hover {
    color: #555;
    border-color: #ccc;
    background-color: #f7f7f7;
}

/* --- INZERÁTY --- */
.listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 20px 40px 40px;
}

.listing-card {
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.listing-card:hover {
    transform: translateY(-5px);
}

.listing-card h2 {
    margin-top: 0;
    font-size: 20px;
    color: #2c3e50;
    line-height: 1.3;
}

.listing-card p {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.45;
}

.listing-preview {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- MODÁLNÍ OKNA --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-content {
    background-color: #ffffff;
    padding: 28px;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 30px 5px 0;
    color: #2c3e50;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #bdc3c7;
    line-height: 1;
}

.close:hover {
    color: #e74c3c;
}

textarea {
    width: 100%;
    min-height: 140px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    resize: vertical;
    line-height: 1.5;
}

/* --- BARVA INZERÁTU --- */
.color-picker-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 2px;
}

.color-picker-wrap label {
    font-size: 14px;
    font-weight: 600;
    color: #4a4a4a;
}

#newColor {
    width: 70px;
    height: 42px;
    padding: 4px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid #d9d9d9;
    background: #fff;
}

/* --- LOGIN INFO TEXT --- */
#loginRequiredMessage {
    margin: 0 0 6px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background-color: #f7faf8;
    border: 1px solid #e2ece6;
    font-size: 14px;
    color: #556;
}

/* --- POMOCNÉ TŘÍDY --- */
.hidden {
    display: none !important;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    header {
        padding: 20px;
    }

    .filters {
        margin: 20px;
    }

    .listings {
        padding: 20px;
    }
}

@media (max-width: 700px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .header-actions button {
        min-width: unset;
    }

    #loginBtn {
        min-width: unset;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters select,
    .filters input,
    #clearFiltersBtn {
        width: 100%;
        max-width: none;
    }

    .listings {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 22px;
    }
}