/* ===========================================
   HOMY MESSAGING MODAL - CORRIGÉ
   Fichier: homy-plugin/assets/css/homy-messaging-modal.css
   =========================================== */

/* Overlay */
.homy-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.homy-modal-overlay.is-active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* Modal Container */
.homy-message-modal {
    position: relative;
    background: #FFFFFF;
    border-radius: 24px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
}

.homy-modal-overlay.is-active .homy-message-modal {
    transform: translateY(0);
    opacity: 1;
}

/* ===========================================
   LEFT PANEL - FOND BLANC/GRIS CLAIR
   =========================================== */

.homy-modal-summary {
    flex: 0 0 320px;
    background: linear-gradient(135deg, #F8F6F9 0%, #F0EDF2 100%);
    padding: 30px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #E8E8E8;
}

.homy-modal-summary-header {
    text-align: center;
    margin-bottom: 24px;
}

.homy-modal-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #3CB4E8;
    overflow: hidden;
    margin: 0 auto 12px;
}

.homy-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.homy-modal-owner-name {
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #2C192D;
    margin: 0;
}

/* Dates Display */
.homy-modal-dates {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
    padding: 16px;
    background: #FFFFFF;
    border-radius: 16px;
}

.homy-modal-date-box {
    text-align: center;
}

.homy-modal-date-day {
    font-family: 'Raleway', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #2C192D;
    line-height: 1;
}

.homy-modal-date-month {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    text-transform: capitalize;
}

.homy-modal-date-year {
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    color: #999;
}

.homy-modal-date-separator {
    font-size: 20px;
    color: #A17DB3;
    font-weight: 300;
}

/* Location */
.homy-modal-location {
    text-align: center;
    margin-bottom: 16px;
}

.homy-modal-location-city {
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #2C192D;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.homy-modal-location-address {
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* Info Row */
.homy-modal-info-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.homy-modal-info-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #2C192D;
}

.homy-modal-info-item svg {
    width: 14px;
    height: 14px;
    stroke: #3CB4E8;
}

/* Application Status */
.homy-modal-status {
    text-align: center;
    margin-bottom: 20px;
}

.homy-modal-status-text {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #245F71;
}

.homy-modal-status-sub {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Animals Display */
.homy-modal-animals {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.homy-modal-animal {
    text-align: center;
}

.homy-modal-animal-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #E8E8E8;
    overflow: hidden;
    margin: 0 auto 6px;
}

.homy-modal-animal-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.homy-modal-animal-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #A17DB3 0%, #3CB4E8 100%);
    opacity: 0.3;
}

.homy-modal-animal-name {
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #2C192D;
}

.homy-modal-animal-age {
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    color: #666;
}

/* ===========================================
   RIGHT PANEL - MESSAGE FORM
   =========================================== */

.homy-modal-form {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.homy-modal-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: #F5F5F5 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.homy-modal-close:hover {
    background: #E8E8E8 !important;
}

.homy-modal-close:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(60, 180, 232, 0.3) !important;
}

.homy-modal-close svg {
    width: 16px !important;
    height: 16px !important;
    stroke: #666 !important;
}

/* Form Header */
.homy-modal-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-right: 40px;
}

.homy-modal-form-title {
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #2C192D;
    margin: 0;
}

.homy-modal-form-actions {
    display: flex;
    gap: 12px;
}

.homy-modal-action-btn {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: transparent !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    color: #A17DB3 !important;
    padding: 0 !important;
}

.homy-modal-action-btn:hover {
    background: #F5F5F5 !important;
    color: #3CB4E8 !important;
}

.homy-modal-action-btn svg {
    width: 20px !important;
    height: 20px !important;
}

/* Link Input */
.homy-link-input-wrapper {
    display: none;
    margin-bottom: 16px;
    padding: 12px;
    background: #F8F6F9;
    border-radius: 12px;
}

.homy-link-input-wrapper.is-visible {
    display: block;
}

.homy-link-input-row {
    display: flex;
    gap: 10px;
}

.homy-link-input {
    flex: 1 !important;
    padding: 10px 14px !important;
    border: 1.5px solid #E5E5E5 !important;
    border-radius: 8px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 13px !important;
    background: #FFFFFF !important;
    color: #2C192D !important;
    box-shadow: none !important;
}

.homy-link-input:focus {
    outline: none !important;
    border-color: #3CB4E8 !important;
    box-shadow: none !important;
}

.homy-link-add-btn {
    padding: 10px 16px !important;
    background: #3CB4E8 !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 8px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
}

.homy-link-add-btn:hover {
    background: #245F71 !important;
    color: #FFFFFF !important;
}

/* Textarea */
.homy-modal-textarea-wrapper {
    position: relative;
    margin-bottom: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.homy-modal-textarea {
    width: 100% !important;
    flex: 1 !important;
    min-height: 150px !important;
    padding: 16px !important;
    border: 1.5px solid #E5E5E5 !important;
    border-radius: 16px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: #2C192D !important;
    resize: none !important;
    transition: border-color 0.2s ease !important;
    background: #FAFAFA !important;
    box-shadow: none !important;
}

.homy-modal-textarea:focus {
    outline: none !important;
    border-color: #3CB4E8 !important;
    background: #FFFFFF !important;
    box-shadow: none !important;
}

.homy-modal-textarea::placeholder {
    color: #999 !important;
}

/* Character Counter */
.homy-modal-textarea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.homy-modal-char-count {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    color: #999;
}

.homy-modal-char-count.warning {
    color: #F59E0B;
}

.homy-modal-char-count.danger {
    color: #DC2626;
    font-weight: 600;
}

/* ===========================================
   ATTACHMENTS - EN DESSOUS DU TEXTAREA
   =========================================== */

.homy-modal-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
    margin-bottom: 20px;
}

.homy-modal-attachments:empty {
    display: none;
    margin-bottom: 0;
}

/* Info attachments */
.homy-modal-attachments-info {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    color: #999;
    margin: 0;
}

.homy-modal-attachments-info span {
    color: #666;
}

.homy-modal-attachment {
    position: relative;
    border-radius: 12px;
    overflow: visible;
}

/* Image attachment */
.homy-modal-attachment-image {
    width: 80px;
    height: 80px;
    background: #F5F5F5;
    border-radius: 12px;
    position: relative;
    overflow: visible;
}

.homy-modal-attachment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* Link attachment */
.homy-modal-attachment-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    padding-right: 40px; /* Place pour le bouton supprimer */
    background: #E8F4FC;
    border: 1px solid #3CB4E8;
    border-radius: 12px;
    max-width: 280px;
}

.homy-modal-attachment-link > svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #3CB4E8;
}

.homy-modal-attachment-link > span {
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #245F71;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================================
   BOUTON SUPPRIMER - CORRIGÉ POUR LIENS
   =========================================== */

.homy-modal-attachment-remove {
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    width: 24px !important;
    height: 24px !important;
    border: 2px solid #FFFFFF !important;
    background: #DC2626 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
}

.homy-modal-attachment-remove:hover {
    background: #B91C1C !important;
    transform: scale(1.1) !important;
}

.homy-modal-attachment-remove svg {
    width: 12px !important;
    height: 12px !important;
    stroke: #FFFFFF !important;
    stroke-width: 3 !important;
}

/* Footer avec séparateur */
.homy-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid #E8E8E8;
}

/* Submit Button */
.homy-modal-submit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 32px !important;
    background: #3CB4E8 !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 50px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

.homy-modal-submit:hover:not(:disabled) {
    background: #245F71 !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
}

.homy-modal-submit:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.homy-modal-submit svg {
    width: 16px !important;
    height: 16px !important;
}

.homy-modal-submit .homy-spinner {
    width: 16px !important;
    height: 16px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-top-color: #FFFFFF !important;
    border-radius: 50% !important;
    animation: homy-spin 0.8s linear infinite !important;
}

@keyframes homy-spin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   BOUTON CONTACTER (page annonce)
   =========================================== */
.homy-contact-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 14px 24px !important;
    background: #3CB4E8 !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 50px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin-bottom: 20px !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

.homy-contact-btn:hover {
    background: #245F71 !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
}

.homy-contact-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(60, 180, 232, 0.3) !important;
}

.homy-contact-btn svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
}

/* Hidden file input */
.homy-modal-file-input {
    display: none;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 900px) {
    .homy-message-modal {
        flex-direction: column;
        max-width: 95%;
        max-height: 95vh;
    }

    .homy-modal-summary {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid #E8E8E8;
        padding: 20px;
    }

    .homy-modal-dates {
        margin: 16px 0;
        padding: 12px;
    }

    .homy-modal-date-day {
        font-size: 24px;
    }

    .homy-modal-animals {
        gap: 12px;
    }

    .homy-modal-animal-photo {
        width: 50px;
        height: 50px;
    }

    .homy-modal-form {
        padding: 20px;
    }

    .homy-modal-textarea {
        height: 150px !important;
        min-height: 120px !important;
    }
}

@media (max-width: 480px) {
    .homy-modal-summary {
        padding: 16px;
    }

    .homy-modal-avatar {
        width: 60px;
        height: 60px;
    }

    .homy-modal-owner-name {
        font-size: 16px;
    }

    .homy-modal-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .homy-modal-submit {
        width: 100% !important;
    }

    .homy-modal-attachment-link {
        max-width: 100%;
    }
}