/* ============================================================
   BIOAUREA - Messages System Styles
   User messages, notifications, inbox
   ============================================================ */

/* ===== Messages Panel Wrapper ===== */
/* IMPORTANTE: NO usar display:flex aquí — lo controla account.css con .account-panel / .account-panel.active */
#panel-messages {
    /* display se hereda de .account-panel (none) y .account-panel.active (block) */
    /* No sobreescribir con flex aquí para no romper la visibilidad de los otros paneles */
}

/* Cuando el panel de mensajes está activo, usamos flex */
#panel-messages.active {
    display: flex;
    flex-direction: column;
}

/* ===== Messages List Container ===== */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    /* Scrollbar bonito */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.messages-list::-webkit-scrollbar {
    width: 4px;
}

.messages-list::-webkit-scrollbar-track {
    background: transparent;
}

.messages-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.messages-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Message Item ===== */
.message-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.message-item:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.11);
}

.message-item:last-child {
    margin-bottom: 2px;
}

.message-item.unread {
    background: rgba(0, 255, 136, 0.04);
    border-color: rgba(0, 255, 136, 0.14);
    border-left: 3px solid #00ff88;
}

.message-item.unread:hover {
    background: rgba(0, 255, 136, 0.07);
}

/* ===== Message Icon ===== */
.message-icon {
    font-size: 1.3em;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

/* ===== Message Content ===== */
.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;
}

.message-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #e8e8e8;
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1.3;
}

.message-unread-dot {
    width: 7px;
    height: 7px;
    background: #00ff88;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.55;
        transform: scale(0.85);
    }
}

.message-date {
    font-size: 0.72em;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-body {
    font-size: 0.84em;
    color: #888;
    line-height: 1.55;
}

.message-item.unread .message-body {
    color: #aaa;
}

/* ===== Attachment / Download Block ===== */
.message-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.message-attachment:hover {
    background: rgba(0, 180, 216, 0.15);
    border-color: rgba(0, 180, 216, 0.35);
}

.message-attachment-icon {
    font-size: 1.4em;
    flex-shrink: 0;
}

.message-attachment-info {
    flex: 1;
    min-width: 0;
}

.message-attachment-name {
    font-size: 0.85em;
    color: #00b4d8;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-attachment-meta {
    font-size: 0.72em;
    color: #555;
    margin-top: 1px;
}

.message-attachment-btn {
    background: rgba(0, 180, 216, 0.15);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 6px;
    color: #00b4d8;
    font-size: 0.78em;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.message-attachment-btn:hover {
    background: rgba(0, 180, 216, 0.28);
}

/* ===== Messages Badge ===== */
.messages-badge,
.tab-badge {
    background: #ff4444;
    color: #fff;
    font-size: 0.68em;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* ===== Support Button Bar ===== */
.messages-support-bar {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.messages-support-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #888;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.messages-support-btn:hover {
    background: rgba(0, 255, 136, 0.07);
    border-color: rgba(0, 255, 136, 0.25);
    color: #00e07a;
}

/* ===== Support Compose Modal ===== */
.support-compose-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeInOverlay 0.2s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.support-compose-modal {
    background: #0e0e0e;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    padding: 0;
    max-width: 480px;
    width: 92%;
    position: relative;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 255, 136, 0.06);
    animation: slideUpModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header strip */
.support-compose-modal::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #00e07a, #00b4d8 60%, transparent);
    border-radius: 20px 20px 0 0;
}

.support-compose-header {
    padding: 22px 28px 0;
}

.support-compose-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: #555;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.support-compose-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border-color: rgba(255, 255, 255, 0.15);
}

.support-compose-title {
    color: #f0f0f0;
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -0.01em;
}

.support-compose-subtitle {
    color: #555;
    font-size: 0.8em;
    margin-bottom: 0;
    line-height: 1.55;
}

.support-compose-subtitle strong {
    color: #00e07a;
    font-weight: 600;
}

.support-compose-body-wrap {
    padding: 18px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-compose-subject {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    color: #ddd;
    padding: 11px 14px;
    font-size: 0.88em;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.support-compose-subject:focus {
    border-color: rgba(0, 224, 122, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.support-compose-subject::placeholder {
    color: #444;
}

.support-compose-body {
    width: 100%;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    color: #ddd;
    padding: 11px 14px;
    font-size: 0.88em;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    line-height: 1.6;
}

.support-compose-body:focus {
    border-color: rgba(0, 224, 122, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.support-compose-body::placeholder {
    color: #444;
}

.support-compose-status {
    display: none;
    padding: 10px 14px;
    border-radius: 9px;
    font-size: 0.83em;
}

.support-compose-footer {
    padding: 0 28px 22px;
}

.support-compose-sender {
    color: #3a3a3a;
    font-size: 0.72em;
    text-align: center;
    margin-bottom: 12px;
}

.support-compose-sender span {
    color: #555;
    font-weight: 500;
}

.support-compose-actions {
    display: flex;
    gap: 10px;
}

.support-compose-send {
    flex: 1;
    background: linear-gradient(135deg, #00c96e, #00a85c);
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    font-size: 0.9em;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.support-compose-send:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.support-compose-send:active:not(:disabled) {
    transform: translateY(0);
}

.support-compose-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.support-compose-cancel {
    background: rgba(255, 255, 255, 0.04);
    color: #555;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.88em;
    font-family: inherit;
    transition: color 0.2s, background 0.2s;
}

.support-compose-cancel:hover {
    color: #888;
    background: rgba(255, 255, 255, 0.07);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .message-item {
        padding: 11px 12px;
        gap: 10px;
    }

    .message-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1em;
    }

    .message-header {
        flex-direction: column;
        gap: 2px;
    }

    .message-date {
        font-size: 0.68em;
    }

    .support-compose-modal {
        padding: 22px 18px;
    }
}
