/* Reseteo y variables */
:root {
    --wa-bg: #ece5dd;
    --wa-header: #f0f2f5;
    --wa-sidebar: #ffffff;
    --wa-green: #00a884;
    --wa-dark: #111b21;
    --wa-message-in: #ffffff;
    --wa-message-out: #d9fdd3;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --system-msg-bg: #ffeecd;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #d1d7db;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    background-color: #fff;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,0.06), 0 2px 5px 0 rgba(0,0,0,0.2);
}

@media (min-width: 1440px) {
    .app-container {
        height: 95vh;
        margin-top: 2.5vh;
        border-radius: 6px;
        overflow: hidden;
    }
}

/* Sidebar */
.sidebar {
    width: 30%;
    min-width: 300px;
    background-color: var(--wa-sidebar);
    border-right: 1px solid #d1d7db;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background-color: var(--wa-header);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-primary);
}

.upload-section {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upload-section p {
    color: var(--text-secondary);
    font-size: 14px;
}

input[type="file"] {
    display: none;
}

.custom-file-upload {
    display: inline-block;
    padding: 10px 20px;
    cursor: pointer;
    background-color: var(--wa-header);
    border-radius: 20px;
    font-weight: 500;
    transition: background 0.3s;
    border: 1px dashed #bcc6cc;
}

.custom-file-upload:hover {
    background-color: #e9edef;
}

.btn-submit {
    padding: 10px 20px;
    background-color: var(--wa-green);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn-submit:hover {
    background-color: #008f6f;
}

#uploadStatus {
    font-size: 13px;
    color: #008f6f;
    margin-top: 10px;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--wa-header);
}

.chat-header {
    height: 60px;
    background-color: var(--wa-header);
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #d1d7db;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.chat-title h3 {
    font-size: 16px;
    font-weight: 500;
}

.chat-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-background {
    flex: 1;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-color: var(--wa-bg);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.welcome-message {
    text-align: center;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Mensajes */
.msg-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    position: relative;
}

.msg {
    max-width: 65%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    position: relative;
    font-size: 14.2px;
    line-height: 19px;
    color: var(--text-primary);
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
    word-wrap: break-word;
    word-break: break-word;
}

.msg-in {
    align-self: flex-start;
    background-color: var(--wa-message-in);
    border-top-left-radius: 0;
}

.msg-out {
    align-self: flex-end;
    background-color: var(--wa-message-out);
    border-top-right-radius: 0;
}

.msg-author {
    font-size: 12.5px;
    font-weight: 500;
    margin-bottom: 2px;
}

/* Colores dinámicos para autores */
.color-1 { color: #35cd96; }
.color-2 { color: #6bcbee; }
.color-3 { color: #e542a3; }
.color-4 { color: #91ab01; }
.color-5 { color: #ffa97a; }

.msg-text {
    white-space: pre-wrap;
    display: inline-block;
    padding-bottom: 10px;
    margin-bottom: -10px;
}

.msg-time {
    font-size: 11px;
    color: var(--text-secondary);
    float: right;
    margin: 10px 0 -5px 10px;
    position: relative;
    bottom: -3px;
}

/* Fecha separadora */
.date-separator {
    align-self: center;
    background-color: var(--wa-sidebar);
    padding: 5px 12px;
    border-radius: 7.5px;
    font-size: 12.5px;
    color: #54656f;
    margin: 15px 0;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
    text-transform: uppercase;
    text-align: center;
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--wa-green);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Agrupaciones por Día y Mes */
.month-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.day-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 25px; /* Espacio extra entre días para delimitar mejor 00h00 a 24h00 */
}
.month-separator {
    align-self: center;
    background-color: #e2e8f0;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 25px 0 10px 0;
    box-shadow: 0 1px 2px rgba(11,20,26,.2);
    text-transform: uppercase;
    text-align: center;
}
