/* ========================================
   ZPRÁVY - MESSENGER LAYOUT
   MOBILE FIRST
   ======================================== */

/* Hlavní obsah bez paddingu pro messenger */
.dashboard__main--messages {
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Mobil: 100vh - hlavicka webu (60px) - mobilni title "Zpravy" (56px) */
    height: calc(100vh - 116px);
    overflow: hidden;
}

/* ========================================
   MESSAGES KONTEJNER
   ======================================== */

.messages {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
}

/* ========================================
   SEZNAM KONVERZACÍ
   ======================================== */

.messages__list {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-right: 1px solid #e5e7eb;
    background-color: #ffffff;
}

.messages__list--hidden-mobile {
    display: none;
}

.messages__list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.messages__list-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.messages__list-count {
    font-size: 13px;
    color: #6b7280;
}

.messages__conversations {
    flex: 1;
    overflow-y: auto;
}

/* ========================================
   JEDNOTLIVÁ KONVERZACE
   ======================================== */

.messages__conversation {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.messages__conversation:hover {
    background-color: #f9fafb;
}

.messages__conversation--active {
    background-color: #f5f3ff;
}

.messages__conversation--unread {
    background-color: #faf5ff;
}

.messages__conversation--unread:hover {
    background-color: #f3e8ff;
}

.messages__conversation-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.messages__conversation-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Fallback kdyz se obrazek nenacte - zobrazime inicialy */
.messages__conversation-avatar img[alt]::after {
    content: attr(alt);
}

/* Inicialy - kdyz neni obrazek */
.messages__conversation-initials {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    line-height: 1;
}

.messages__conversation-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 2;
}

.messages__conversation-content {
    flex: 1;
    min-width: 0;
}

.messages__conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.messages__conversation-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages__conversation--unread .messages__conversation-name {
    font-weight: 700;
}

.messages__conversation-time {
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.messages__conversation--unread .messages__conversation-time {
    color: #7c3aed;
    font-weight: 600;
}

.messages__conversation-breed {
    font-size: 12px;
    color: #7c3aed;
    margin-bottom: 4px;
}

.messages__conversation-preview {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages__conversation--unread .messages__conversation-preview {
    color: #374151;
    font-weight: 500;
}

.messages__conversation-you {
    color: #9ca3af;
}

/* ========================================
   DETAIL KONVERZACE
   ======================================== */

.messages__detail {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
}

/* Hlavicka - FIXED na vrchu */
.messages__detail-header {
    position: fixed;
    top: 60px; /* pod hlavickou webu */
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #ffffff;
    border: none;
    box-shadow: none;
    z-index: 100;
}

.messages__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #6b7280;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.messages__back:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.messages__back svg {
    width: 20px;
    height: 20px;
}

.messages__detail-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.messages__detail-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Inicialy v hlavicce detailu */
.messages__detail-initials {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    line-height: 1;
}

.messages__detail-info {
    flex: 1;
    min-width: 0;
}

.messages__detail-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages__detail-breed {
    display: block;
    font-size: 12px;
    color: #7c3aed;
}

.messages__detail-link {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #7c3aed;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.messages__detail-link:hover {
    background-color: #f5f3ff;
    border-color: #c4b5fd;
}

.messages__detail-link svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   CHAT - ZPRÁVY
   ======================================== */

/* Chat oblast - s paddingem pro fixed header a form */
.messages__chat {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-top: 8px; /* minimalni mezera od hlavicky */
    padding-bottom: 68px; /* prostor pro fixed form */
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: none; /* zadny border */
    /* Hladky scroll */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.messages__date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.messages__date-divider span {
    font-size: 12px;
    color: #9ca3af;
    background-color: #f8f9fa;
    padding: 4px 12px;
}

/* ========================================
   BUBLINY ZPRÁV
   ======================================== */

.messages__bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
}

.messages__bubble--mine {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.messages__bubble--theirs {
    align-self: flex-start;
    background-color: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.messages__bubble-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 4px 0;
}

.messages__bubble-time {
    display: block;
    font-size: 11px;
    text-align: right;
}

.messages__bubble--mine .messages__bubble-time {
    color: rgba(255, 255, 255, 0.7);
}

.messages__bubble--theirs .messages__bubble-time {
    color: #9ca3af;
}

/* ========================================
   FORMULÁŘ PRO NOVOU ZPRÁVU
   ======================================== */

/* Formular - FIXED na spodu */
.messages__form {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    z-index: 100;
}

.messages__form-input-wrapper {
    flex: 1;
}

.messages__form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    background-color: #f3f4f6;
    border: 1px solid transparent;
    border-radius: 20px;
    resize: none;
    outline: none;
    transition: all 0.15s ease;
    min-height: 40px;
    max-height: 120px;
}

.messages__form-input:focus {
    background-color: #ffffff;
    border-color: #c4b5fd;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.messages__form-input::placeholder {
    color: #9ca3af;
}

.messages__form-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.messages__form-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.messages__form-submit svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   PRÁZDNÝ STAV
   ======================================== */

.messages__empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
    text-align: center;
    background-color: #f8f9fa;
}

.messages__empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    color: #d1d5db;
}

.messages__empty-icon svg {
    width: 100%;
    height: 100%;
}

.messages__empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.messages__empty-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* ========================================
   TABLET (768px+)
   ======================================== */

@media (min-width: 768px) {
    .dashboard__main--messages {
        height: calc(100vh - 60px);
    }

    .messages__bubble {
        max-width: 70%;
    }

    .messages__detail-link {
        display: flex;
    }
}

/* ========================================
   DESKTOP (1024px+)
   ======================================== */

@media (min-width: 1024px) {
    .dashboard__main--messages {
        height: calc(100vh - 60px);
    }

    .messages__list {
        width: 360px;
        flex-shrink: 0;
    }

    .messages__list--hidden-mobile {
        display: flex;
    }

    .messages__back {
        display: none;
    }

    .messages__empty {
        display: flex;
    }

    .messages__bubble {
        max-width: 60%;
    }

    .messages__chat {
        padding: 24px;
    }
}

/* ========================================
   VELKÝ DESKTOP (1400px+)
   ======================================== */

@media (min-width: 1400px) {
    .messages__list {
        width: 400px;
    }

    .messages__bubble {
        max-width: 50%;
    }
}
