/* assets/css/style.css */
/* VARIABLES DE DISEÑO - TEMA NEGRO PROFUNDO */
:root {
    --bg-black: #000000;
    --bg-panel: #111113;
    --border-color: #2A2A30;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --accent-secure: #2ECC71; 
    --accent-call: #3498DB;   
    --accent-hangup: #E74C3C; 
    --bubble-sent: #1F1F23;   
    --bubble-recv: #2C3E50;   
    
    --font-size-name: 1.3rem;
    --font-size-msg: 1.15rem;
    --font-size-time: 0.85rem;
    --touch-target: 48px; 
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%; width: 100%; margin: 0; padding: 0; position: fixed; 
    top: 0; left: 0; overflow: hidden;
}

body {
    background-color: #1a1a1a; color: var(--text-main);
    display: flex; justify-content: center;
}

.app-shell {
    width: 100%; max-width: 480px; height: 100%; 
    background-color: var(--bg-black); position: relative;
    overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
}

.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column;
    transition: transform 0.3s ease-out; z-index: 1;
    background-color: var(--bg-black);
}

.screen.hidden-right { transform: translateX(100%); }
.screen.active { transform: translateX(0); z-index: 2; }

.icon { width: 24px; height: 24px; fill: currentColor; }

/* HEADER */
.header {
    height: 70px; background-color: var(--bg-panel); border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; flex-shrink: 0; z-index: 10;
}
.header-title { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.header-action-btn {
    background: none; border: none; color: var(--text-muted);
    width: var(--touch-target); height: var(--touch-target);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 50%;
}
.header-action-btn:active { background-color: rgba(255,255,255,0.1); }
.header-action-btn.accent { color: var(--accent-secure); }

/* LISTA DE CONTACTOS */
.contact-list-content { flex: 1; overflow-y: auto; padding-top: 10px; }
.contact-item {
    display: flex; align-items: center; padding: 15px 20px;
    border-bottom: 1px solid #111; cursor: pointer; transition: background 0.2s;
}
.contact-item:active { background-color: var(--bg-panel); }
.avatar {
    width: 60px; height: 60px; border-radius: 50%; background-color: #333;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: bold; color: #fff;
    margin-right: 15px; border: 2px solid var(--border-color); flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.contact-name { font-size: var(--font-size-name); font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-time { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; margin-left: 10px; }
.contact-bottom-row { display: flex; align-items: center; color: var(--text-muted); gap: 5px;}
.secure-dot { width: 8px; height: 8px; background-color: var(--accent-secure); border-radius: 50%; flex-shrink: 0; }
.offline-dot { width: 8px; height: 8px; background-color: #555; border-radius: 50%; flex-shrink: 0; }
.unread-badge { background-color: var(--accent-secure); color: #000; font-size: 0.8rem; font-weight: bold; border-radius: 12px; padding: 2px 8px; margin-left: auto; display: flex; align-items: center; justify-content: center; }
.contact-preview { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CHAT INDIVIDUAL */
.chat-header-user { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0;}
.chat-header-user .avatar { width: 40px; height: 40px; font-size: 1.1rem; margin-right: 0;}
.chat-header-info { min-width: 0; }
.chat-header-info h2 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-verified { font-size: 0.8rem; color: var(--accent-secure); display: flex; align-items: center; gap: 4px;}
.chat-header-actions { display: flex; gap: 5px; }
.btn-call { color: var(--accent-call); }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 15px;
    background-image: radial-gradient(#111 1px, transparent 1px);
    background-size: 20px 20px;
}

.msg-bubble {
    max-width: 85%; padding: 12px 16px; border-radius: 12px;
    font-size: var(--font-size-msg); line-height: 1.4;
    position: relative; word-wrap: break-word; min-width: 100px;
}
.msg-bubble.received { background-color: var(--bubble-recv); align-self: flex-start; border-top-left-radius: 2px; }
.msg-bubble.sent { background-color: var(--bubble-sent); align-self: flex-end; border-top-right-radius: 2px; border: 1px solid var(--border-color); }
.msg-bubble img, .msg-bubble video {
    max-width: 100%; border-radius: 8px; margin-top: 5px; display: block;
}
.msg-bubble audio { height: 40px; margin-top: 5px; max-width: 200px; outline: none; }
.msg-time { display: block; font-size: var(--font-size-time); color: rgba(255,255,255,0.5); margin-top: 5px; text-align: right; }

/* ÁREA DE INPUT */
.chat-input-wrapper { position: relative; background-color: var(--bg-panel); border-top: 1px solid var(--border-color); flex-shrink: 0; }
.attach-menu {
    position: absolute; bottom: 100%; left: 10px; background-color: #1E1E23;
    border: 1px solid var(--border-color); border-radius: 12px; padding: 8px;
    display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.6); opacity: 0; visibility: hidden;
    transform: translateY(10px); transition: all 0.2s ease; z-index: 20;
}
.attach-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.attach-option {
    display: flex; align-items: center; gap: 12px; color: var(--text-main); background: none; border: none;
    padding: 12px 16px; border-radius: 8px; font-size: 1.1rem; cursor: pointer; text-align: left; white-space: nowrap;
}
.attach-option:active { background-color: rgba(255,255,255,0.05); }
.attach-option svg { width: 20px; height: 20px; fill: currentColor; }

.chat-input-bar {
    padding: 10px; display: flex; align-items: center; gap: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.btn-attach {
    color: var(--text-muted); background: none; border: none;
    width: var(--touch-target); height: var(--touch-target);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.5rem; flex-shrink: 0; border-radius: 50%;
}
.btn-attach.active { color: var(--accent-secure); background-color: rgba(46, 204, 113, 0.1); }
.message-input {
    flex: 1; min-width: 0; background-color: var(--bg-black);
    border: 1px solid var(--border-color); color: var(--text-main);
    padding: 12px 16px; border-radius: 24px; font-size: 1.05rem; outline: none; transition: width 0.2s;
}
.btn-send {
    background-color: var(--accent-secure); color: white; border: none;
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
    transition: all 0.2s;
}
.btn-send:active { transform: scale(0.95); }
.btn-mic { background-color: #34495E; color: white; border: none; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all 0.2s;}
.btn-mic.recording { background-color: var(--accent-hangup); animation: pulseRecord 1s infinite alternate; }

@keyframes pulseRecord {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    100% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
}

.hidden-input { display: none; }

/* OVERLAYS DEMO LLAMADAS */
.fullscreen-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-black); z-index: 100; display: none; flex-direction: column;
    align-items: center; justify-content: space-between; padding: 50px 20px;
}
.fullscreen-overlay.active { display: flex; }
.call-info { text-align: center; margin-top: 50px; z-index: 2;}
.call-info .avatar { width: 120px; height: 120px; font-size: 3rem; margin: 0 auto 20px; }
.call-info h1 { font-size: 2rem; margin-bottom: 10px; }
.call-status { color: var(--accent-secure); font-size: 1.2rem; display: flex; align-items: center; gap: 8px; justify-content: center;}
.video-placeholder {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1a2a3a 0%, #000 100%);
    z-index: 1; opacity: 0.8; display: flex; align-items: center; justify-content: center;
}
.call-actions { width: 100%; display: flex; justify-content: center; gap: 30px; margin-bottom: 30px; z-index: 2; }
.btn-round {
    width: 70px; height: 70px; border-radius: 50%; border: none; display: flex;
    align-items: center; justify-content: center; cursor: pointer; color: white;
}
.btn-hangup { background-color: var(--accent-hangup); }
.btn-hangup svg { width: 32px; height: 32px; }
.btn-video-on { background-color: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }


/* LOGIN / REGISTER UI */
.auth-container {
    padding: 30px 20px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%;
}
.auth-container h1 { font-size: 2rem; margin-bottom: 30px; color: var(--text-main); font-weight: bold; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 15px;}
.auth-form input {
    background-color: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-main);
    padding: 15px; border-radius: 10px; font-size: 1.1rem; outline: none;
}
.auth-form input:focus { border-color: var(--accent-secure); }
.btn-auth {
    background-color: var(--accent-secure); color: #fff; padding: 15px; border: none;
    border-radius: 10px; font-size: 1.2rem; font-weight: bold; cursor: pointer; margin-top: 10px;
}
.btn-auth:active { background-color: #27ae60; }
.toggle-auth { color: var(--text-muted); text-align: center; margin-top: 20px; cursor: pointer; text-decoration: underline; }

/* FLOATING ACTON BUTTON (AGREGAR CONTACTO) */
.fab {
    position: absolute; bottom: 20px; right: 20px; width: 60px; height: 60px;
    border-radius: 50%; background-color: var(--accent-secure); color: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4); border: none; cursor: pointer;
    z-index: 15;
}
.fab:active { filter: brightness(0.9); }
.fab svg { width: 24px; height: 24px; fill: currentColor; }

.modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8); z-index: 50; display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background-color: var(--bg-panel); width: 85%; padding: 25px; border-radius: 15px;
    border: 1px solid var(--border-color); box-shadow: 0 10px 30px #000;
}
.modal h3 { margin-bottom: 15px; font-size: 1.2rem;}
.modal input { width: 100%; padding: 12px; margin-bottom: 20px; background: #000; border: 1px solid #333; color: white; border-radius: 8px;}
.modal-actions { display: flex; justify-content: space-between; }
.btn-primary { padding: 10px 20px; border-radius: 8px; border: none; background: var(--accent-secure); color: white; cursor: pointer;}
.btn-accept { padding: 8px 15px; border-radius: 8px; border: 1px solid var(--accent-secure); background: rgba(46, 204, 113, 0.1); color: var(--accent-secure); font-weight: bold; cursor: pointer; transition: all 0.2s;}
.btn-accept:active { background: var(--accent-secure); color: white;}

/* BEAUTIFUL CUSTOM ALERTS */
.custom-alert-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.85); z-index: 9999; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.custom-alert-overlay.active { display: flex; opacity: 1; }
.custom-alert {
    background-color: #1e1e24; width: 80%; max-width: 350px; padding: 25px; border-radius: 16px;
    border: 1px solid var(--accent-secure); box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    text-align: center; transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.custom-alert-overlay.active .custom-alert { transform: translateY(0); }
.custom-alert-icon { font-size: 3rem; color: var(--accent-secure); margin-bottom: 10px; }
.custom-alert-msg { font-size: 1.1rem; color: var(--text-main); margin-bottom: 20px; line-height: 1.5; }
.custom-alert-btn { background: var(--accent-secure); color: white; padding: 12px 20px; border: none; border-radius: 10px; font-weight: bold; width: 100%; cursor: pointer;}

