/* DISEÑO PROFESIONAL V4 - CHAT FULL FEATURES */
:root {
    --primary: #0f172a;
    --accent: #3b82f6;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #334155;
    --border: #cbd5e1;
    --danger: #ef4444;
    --success: #22c55e;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--surface);
    padding: 10px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.brand { font-size: 20px; font-weight: 800; color: var(--primary); }

.lang-switch { display: flex; gap: 10px; align-items: center; }
.lang-switch a { 
    text-decoration: none; font-size: 24px; filter: grayscale(100%); opacity: 0.6; padding: 2px; border-radius: 4px;
}
.lang-switch a:hover, .lang-switch a.active { filter: grayscale(0%); opacity: 1; background: #e2e8f0; transform: scale(1.1); }

.layout { max-width: 1400px; margin: 20px auto; display: flex; gap: 25px; padding: 0 20px; flex: 1; width: 100%; box-sizing: border-box; align-items: flex-start; }
.sidebar { width: 300px; background: var(--surface); padding: 20px; border-radius: 12px; border: 1px solid var(--border); flex-shrink: 0; }
.main { flex-grow: 1; background: var(--surface); padding: 25px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }

.btn { 
    padding: 10px 18px; border-radius: 6px; font-weight: 600; border: none; cursor: pointer; text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; min-width: 80px; text-align: center;
}
.btn-sm { padding: 5px 10px !important; font-size: 12px !important; min-height: 30px !important; min-width: auto !important; }

.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-blue { background: var(--accent); color: white; }
.btn-green { background: var(--success); color: white; }
.btn-red { background: #fee2e2; color: var(--danger); }
.btn-gray { background: #e2e8f0; color: var(--text); }
.btn-dark { background: var(--primary); color: white; }
.btn-full { width: 100%; display: flex; }

.form-control { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; font-size: 13px; box-sizing: border-box; }
label { font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 4px; display: block; text-transform: uppercase; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 15px; text-align: center; cursor: pointer; position: relative; transition: 0.2s; background: white; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 12px -3px rgba(0,0,0,0.05); }
.card-icon { font-size: 32px; margin-bottom: 8px; }
.card-text { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash { position: absolute; top: 5px; right: 5px; font-size: 14px; color: var(--danger); opacity: 0; padding: 4px; border-radius: 4px; transition: 0.2s; }
.card:hover .trash { opacity: 1; }

.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; background: var(--success); color: white; font-weight: bold; z-index: 9999; animation: slideIn 0.5s forwards; box-shadow: 0 10px 25px rgba(0,0,0,0.1); font-size: 14px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* CHAT AVANZADO */
.chat-container { display: flex; height: calc(100vh - 70px); background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 20px; }
.chat-sidebar { width: 300px; border-right: 1px solid var(--border); background: #f8fafc; overflow-y: auto; display: flex; flex-direction: column; }
.chat-main { flex: 1; display: flex; flex-direction: column; background: white; }

/* Buscador de contactos */
.search-chat { padding: 10px; border-bottom: 1px solid var(--border); background: white; position: sticky; top: 0; }
.search-chat input { margin: 0; border-radius: 20px; padding: 8px 15px; border: 1px solid var(--border); width: 100%; box-sizing: border-box; font-size: 12px; background: #f1f5f9; }

.contact { padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--text); transition: 0.2s; }
.contact:hover, .contact.active { background: #eef2ff; border-left: 3px solid var(--accent); }
.msg-area { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background-image: radial-gradient(#e2e8f0 1px, transparent 1px); background-size: 20px 20px; }

.msg { max-width: 75%; padding: 10px 15px; border-radius: 10px; font-size: 13px; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.msg.me { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 2px; }
.msg.other { align-self: flex-start; background: white; color: var(--text); border-bottom-left-radius: 2px; border: 1px solid var(--border); }
.msg-time { font-size: 10px; opacity: 0.7; display: block; margin-top: 5px; text-align: right; }

/* Adjuntos y borrar */
.clip-btn { cursor: pointer; font-size: 20px; color: #64748b; padding: 5px 10px; transition: 0.2s; }
.clip-btn:hover { color: var(--accent); background: #f1f5f9; border-radius: 6px; }
.msg-file { display: block; background: rgba(255,255,255,0.2); padding: 5px; margin-bottom: 5px; border-radius: 4px; font-size: 11px; text-decoration: none; color: inherit; font-weight: bold; border: 1px dashed rgba(255,255,255,0.5); }
.msg.other .msg-file { background: #f1f5f9; color: var(--accent); border-color: var(--border); }

.delete-msg { position: absolute; top: 5px; right: 5px; color: white; opacity: 0; cursor: pointer; font-size: 10px; padding: 2px 5px; background: rgba(0,0,0,0.2); border-radius: 4px; text-decoration: none; }
.msg.me:hover .delete-msg { opacity: 1; }
.badge { background: var(--danger); color: white; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 10px; }