/* ==========================================
   ZENTRALES CSS FÜR CHEMNITZ-LIEBE
   ========================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f7f6;
    color: #333;
}

/* KOPFZEILE (Header) */
.main-header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 24px;
    color: #e53e3e;
}

.logo span {
    color: #718096;
    font-size: 16px;
}

.top-nav a {
    text-decoration: none;
    color: #4a5568;
    margin-left: 20px;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.top-nav a:hover, .top-nav a.active {
    background-color: #fed7d7;
    color: #9b2c2c;
}

/* LAYOUT-CONTAINER */
.main-container {
    max-width: 1200px;
    margin: 30px auto;
    display: flex;
    gap: 30px;
    padding: 0 20px;
}

/* LINKE SIDEBAR */
.sidebar-left {
    width: 250px;
    flex-shrink: 0;
}

.widget {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.widget h3 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 12px;
    border-bottom: 2px solid #e53e3e;
    padding-bottom: 5px;
}

.widget ul {
    list-style: none;
}

.widget ul li {
    margin-bottom: 10px;
}

.widget ul li a {
    text-decoration: none;
    color: #4a5568;
    font-size: 14px;
    display: block;
    padding: 4px 0;
}

.widget ul li a:hover {
    color: #e53e3e;
    padding-left: 5px;
    transition: all 0.2s;
}

/* CONTENT-MITTE (Single-Karten) */
.content-center {
    flex-grow: 1;
}

.content-center h2 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 22px;
}

.singles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.single-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.single-card:hover {
    transform: translateY(-5px);
}

.profile-img-container {
    width: 100%;
    height: 240px;
    background-color: #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.single-info {
    padding: 15px;
}

.single-info h3 {
    font-size: 18px;
    color: #2d3748;
    margin-bottom: 5px;
}

.single-info .age {
    font-weight: normal;
    color: #4a5568;
}

.location {
    font-size: 13px;
    color: #718096;
    margin-bottom: 10px;
}

.bio {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.4;
    margin-bottom: 15px;
    font-style: italic;
    min-height: 40px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons button {
    flex-grow: 1;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-dislike {
    background-color: #edf2f7;
    color: #4a5568;
}

.btn-dislike:hover {
    background-color: #e2e8f0;
}

.btn-like {
    background-color: #e53e3e;
    color: #fff;
}

.btn-like:hover {
    background-color: #c53030;
}

.no-singles {
    grid-column: 1 / -1;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    border: 1px dashed #cbd5e0;
    color: #718096;
}

/* CHATBOT (AMOR) */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 1000;
}

.chatbot-header {
    background-color: #e53e3e;
    color: #fff;
    padding: 12px 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-body {
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chat-logs {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f7fafc;
}

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-msg.bot {
    background-color: #edf2f7;
    color: #2d3748;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.chat-msg.user {
    background-color: #fed7d7;
    color: #9b2c2c;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex-grow: 1;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
}

.chat-input-area button {
    background-color: #e53e3e;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* ==========================================
   PROFIL-, MATCH- UND MESSAGES-STYLES
   ========================================== */

/* PROFILBEARBEITUNG (`profile.php`) */
.profile-box {
    max-width: 600px;
    margin: 30px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 14px;
}

.form-group input[type="text"], .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
}

.current-pic-box {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.current-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e53e3e;
    background: #cbd5e0;
}

.alert-error { background: #fed7d7; color: #9b2c2c; padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #c6f6d5; color: #22543d; padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }

.btn-save {
    background: #e53e3e;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
}

.btn-save:hover { background: #c53030; }

/* MATCHES-LISTE (`matches.php`) */
.list-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.list-section h2 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e53e3e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.contact-card {
    border: 1px solid #edf2f7;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    background: #f8fafc;
    transition: transform 0.2s;
}

.contact-card:hover { transform: scale(1.03); }

.contact-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: #cbd5e0;
    margin: 0 auto 12px;
    border: 2px solid #e53e3e;
}

.contact-name {
    font-weight: bold;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 4px;
}

.contact-loc {
    font-size: 12px;
    color: #718096;
    margin-bottom: 12px;
}

.btn-chat {
    display: inline-block;
    background: #e53e3e;
    color: #fff;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
}

.btn-chat:hover { background: #c53030; }
.empty-text { color: #718096; font-style: italic; font-size: 14px; grid-column: 1 / -1; text-align: center; padding: 15px; }

/* NACHRICHTENZENTRUM (`messages.php`) */
.chat-layout {
    display: flex;
    max-width: 1200px;
    margin: 30px auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    height: 600px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #f7fafc;
}

.partner-list {
    overflow-y: auto;
    flex-grow: 1;
}

.partner-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #edf2f7;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.partner-item:hover, .partner-item.active {
    background: #fed7d7;
}

.partner-avatar {
    width: 45px;
    height: 45px;
    background: #cbd5e0;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.chat-main-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: bold;
    font-size: 16px;
}

.chat-main-header span {
    color: #e53e3e;
}

/* Stellt sicher, dass das Chatfenster scrollbar wird und unten bleibt */
.message-history {
    flex-grow: 1;
    padding: 15px;
    height: 400px; /* Eine feste Höhe erzwingen */
    max-height: 55vh; /* Passt sich flexibel an Handy-Displays an */
    overflow-y: auto; /* Aktiviert die vertikale Scrollbar nur in der Chatbox */
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg-bubble {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.msg-bubble.me {
    background: #e53e3e;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.msg-bubble.other {
    background: #edf2f7;
    color: #2d3748;
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.msg-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.chat-input-box {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-form input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
}

.chat-form button {
    background: #e53e3e;
    color: #fff;
    border: none;
    padding: 0 25px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-form button:hover { 
    background: #c53030; 
}

.no-chat-selected { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    color: #718096; 
    font-style: italic; 
}

/* FOOTER DESIGN */
footer {
    text-align: center; 
    padding: 20px; 
    color: #a0aec0; 
    font-size: 12px; 
    margin-top: 30px;
    border-top: 1px solid #e2e8f0;
    background-color: #fff;
}

.single-info h3 a:hover {
    color: #e53e3e !important;
}
.profile-link {
    display: block;
    cursor: pointer;
}

/* ==========================================
   TINDER-STYLE SLIDER & MATCH-OVERLAY
   ========================================== */

/* 1. Der Kartenstapel-Behälter */
.slider-wrapper {
    position: relative;
    width: 340px;
    height: 520px;
    margin: 20px auto;
}

/* Die einzelnen Profilkarten */
.slider-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Große Bildbox im Slider */
.slider-img-box {
    width: 100%;
    height: 320px;
    background-color: #edf2f7;
}

.slider-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Textbereich unter dem Bild */
.slider-info-box {
    padding: 15px 20px;
    flex-grow: 1;
}

.slider-info-box h3 {
    font-size: 22px;
    color: #2d3748;
    margin-bottom: 4px;
}

.slider-info-box h3 a {
    text-decoration: none;
    color: #2d3748;
}

.slider-info-box h3 a:hover {
    color: #e53e3e;
}

/* Große Swipe-Knöpfe am Kartenboden */
.slider-actions {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #f7fafc;
}

.btn-swipe {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.1s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-swipe:active {
    transform: scale(0.9);
}

.btn-swipe.dislike {
    background-color: #fff;
    color: #e53e3e;
    border: 2px solid #fed7d7;
}

.btn-swipe.dislike:hover {
    background-color: #fff5f5;
}

.btn-swipe.like {
    background-color: #e53e3e;
    color: #fff;
}

.btn-swipe.like:hover {
    background-color: #c53030;
}

/* Wenn alle Karten weggewischt wurden */
.no-more-cards {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 16px;
    border: 2px dashed #cbd5e0;
    max-width: 340px;
    color: #718096;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.no-more-cards h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

/* Button-Styling für unangemeldete Gäste im Slider */
.login-prompt-btn {
    display: block;
    text-align: center;
    width: 100%;
    background: #edf2f7;
    color: #2b6cb0;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
}

/* 2. VOLLTREFFER (MATCH) OVERLAY WINDOW */
.match-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.match-modal {
    background: #fff;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.match-modal h2 {
    font-size: 28px;
    color: #e53e3e;
    margin-bottom: 10px;
}

.match-heart {
    font-size: 60px;
    margin: 20px 0;
    animation: beat 1s infinite alternate;
}

.btn-match-action {
    display: block;
    background: #e53e3e;
    color: #fff;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 10px;
}

.btn-match-action:hover {
    background: #c53030;
}

.btn-match-close {
    background: none;
    border: none;
    color: #718096;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

/* KEYFRAMES FÜR ANIMATIONEN */
@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes beat {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}




/* ==========================================================================
   ?? HANDY- & TABLET-OPTIMIERUNG (RESPONSIVE MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Header & Menü auf Handys kompakt anordnen */
    .header-container {
        flex-direction: column;
        gap: 12px;
        padding: 10px;
        text-align: center;
    }
    
    .top-nav {
        justify-content: center;
        width: 100%;
        gap: 5px;
    }
    
    .top-nav a {
        font-size: 13px;
        padding: 6px 10px;
        margin-left: 0; /* Entfernt den starren PC-Abstand */
    }

    /* 2. Haupt-Layout untereinander stapeln */
    .main-container {
        flex-direction: column;
        margin: 15px auto;
        padding: 0 10px;
        gap: 15px;
    }

    /* 3. Sidebars nach unten schieben, damit die Singles oben stehen */
    .sidebar-left {
        width: 100%;
        order: 2; /* Boxen rutschen nach ganz unten */
    }

    .content-center {
        width: 100%;
        order: 1; /* Die Singles oder der Slider kommen zuerst ins Blickfeld */
    }

    /* 4. Singles-Raster auf Smartphones auf 2 Spalten begrenzen */
    .singles-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .profile-img-container {
        height: 160px; /* Kleinere Bildboxen für Mobilgeräte */
    }
    
    .single-info h3 {
        font-size: 15px;
    }

    /* 5. Tinder-Slider proportional an Handy-Displays anpassen */
    .slider-wrapper {
        max-width: 100%;
        width: 310px;
        height: 460px;
    }
    
    .slider-img-box {
        height: 260px;
    }
    
    .btn-swipe {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    /* 6. Das Nachrichtenzentrum (messages.php) mobil steuern */
    .chat-layout {
        flex-direction: column;
        height: 78vh; /* Verhindert Rutschen aus dem Bildschirm */
    }

    .chat-sidebar {
        width: 100%;
        height: 160px; /* Kompakte Liste der Chatpartner oben */
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .partner-item {
        padding: 10px;
    }

    .chat-main {
        height: calc(100% - 160px); /* Der eigentliche Chat nutzt den Rest des Displays */
    }
    
    .msg-bubble {
        max-width: 85%; /* Mehr Platz für Text auf kleinen Displays */
        font-size: 13px;
    }

    /* 7. Matches-Raster auf der Kontaktseite kompakt machen */
    .contact-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    
    .contact-avatar {
        width: 65px;
        height: 65px;
    }
    
    .contact-name {
        font-size: 13px;
    }
    
    /* 8. Volltreffer Match-Modal verkleinern */
    .match-modal {
        width: 85%;
        padding: 25px 15px;
    }
    
    .match-modal h2 {
        font-size: 22px;
    }
    
    .match-heart {
        font-size: 45px;
    }
}

/* ==========================================================================
   ?? CHATBOT AMOR DESIGN (WIEDER DA!)
   ========================================================================== */

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 9999; /* Sorgt dafür, dass Amor immer ganz oben schwebt */
}

.chatbot-header {
    background-color: #e53e3e;
    color: #fff;
    padding: 12px 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.chatbot-body {
    height: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Verhindert, dass der Inhalt die Box sprengt */
}

.chat-logs {
    flex-grow: 1;
    padding: 15px;
    height: 290px; /* Feste Höhe für die Nachrichten */
    max-height: 290px;
    overflow-y: auto; /* Aktiviert die Scrollbar NUR für die Nachrichten */
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f7fafc;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-msg.bot {
    background-color: #edf2f7;
    color: #2d3748;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.chat-msg.user {
    background-color: #fed7d7;
    color: #9b2c2c;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background: #fff;
}

.chat-input-area input {
    flex-grow: 1;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
}

.chat-input-area button {
    background-color: #e53e3e;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* Auf ganz kleinen Handys schieben wir Amor etwas beiseite, damit er nichts verdeckt */
@media (max-width: 480px) {
    .chatbot-container {
        width: 260px;
        bottom: 10px;
        right: 10px;
    }
}


/* Stellt sicher, dass Emojis im Auswahl-Popup perfekt klein sind */
.smiley-tab-content img {
    width: 32px !important;
    height: 32px !important;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.1s;
}

.smiley-tab-content img:hover {
    transform: scale(1.2);
}
