* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
/*body { background-color: #f0f2f5; display: flex; justify-content: center; height: 100vh; } */

:root { overscroll-behavior-y: none; }

html, body { position: fixed; overflow: hidden; width: 100%; height: 100dvh; margin: 0; padding: 0; background-color: #fff2f5; }
body { display: flex; justify-content: center; }

#chat-app { width: 100%; max-width: 450px; background: white; display: flex; flex-direction: column; height: 100%; box-shadow: 0 0 10px rgba(0,0,0,0.1); position: relative; }

/* View Management */
.view { display: none; flex-direction: column; height: 100%; width: 100%; }
.view.active { display: flex; }

/* Header */
.header { padding: max(15px, env(safe-area-inset-top)) 15px 15px; min-height: 60px; background: #0078fe; color: white; text-align: center; font-weight: bold; font-size: 1.2rem; display: flex; justify-content: space-between; align-items: center; position: relative; }
.header-btn { background: transparent; border: none; color: white; font-size: 1rem; cursor: pointer; padding: 0 10px; }
.header-title { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }

/* Shared Content Area */
.content-area { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  background-image: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../background.webp"); /* <-- put your image here */
  background-size: cover;        /* fills entire area */
  background-position: center;   /* keeps it centered */
  background-repeat: no-repeat;  /* prevents tiling */
}

/* Auth View Specifics */
#auth-view .content-area { background: white; justify-content: center; padding: 30px; }
.input-group { display: flex; flex-direction: column; gap: 15px; width: 100%; }
.form-input { padding: 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; outline: none; }
.form-input:focus { border-color: #0078fe; }
.btn-primary { background: #0078fe; color: white; border: none; padding: 12px; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 1rem; transition: 0.2s; }
.btn-primary:hover { background: #005cbf; }
.btn-secondary { background: #eee; color: #333; border: none; padding: 12px; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 1rem; transition: 0.2s; }
.btn-secondary:hover { background: #ddd; }
.error-message { display: none; color: #d9534f; background-color: #fdf2f2; border: 1px solid #d9534f; padding: 10px; border-radius: 4px; margin-bottom: 15px; font-size: 0.9em; text-align: center; }
.auth-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 20px; }
.or-divider { color: #888; font-size: 0.85em; font-weight: bold; }
.auth-actions button { width: 100%; }
#auth-email { display: none !important; }
#auth-verification-token { display: none !important; }

/* Contacts & Find View Specifics */
.icon-btn { display: flex; align-items: center; justify-content: center; padding: 0px 0px; }
.header-icon { width: 30px; height: 30px; display: block; color: white; }

/* Contacts View Specifics */
.contact-row { background: white; padding: 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.contact-row:hover { background: #f9f9f9; }
.contact-info { font-weight: bold; color: #333; }
.badge { background: #0078fe; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; }
.pending-actions { display: flex; gap: 5px; }
.btn-small { padding: 5px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: bold; color: white;}
.btn-accept { background: #28a745; }
.btn-block { background: #dc3545; }

/* Profile View Specifics */
.profile-content { align-items: center; padding-bottom: 30px; }
.avatar-container { position: relative; width: 120px; height: 120px; margin: 20px auto 10px; }
#profile-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #0078fe; background: white; }
.btn-avatar-upload { position: absolute; bottom: 0; right: 0; background: #0078fe; color: white; border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.btn-avatar-remove { position: absolute; top: 0; right: 0; background: #dc3545; color: white; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.profile-nickname { text-align: center; font-size: 2rem; font-weight: bold; color: #333; margin-bottom: 30px; width: 100%; }
.sessions-section { width: 100%; background: white; border-radius: 8px; padding: 15px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); margin-bottom: 30px; flex-shrink: 0; }
.sessions-title { font-size: 1.1rem; color: #555; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.session-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.session-row:last-child { border-bottom: none; padding-bottom: 0; }
.session-info { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.session-name { font-weight: bold; color: #333; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-time { color: #888; font-size: 0.8rem; }
.btn-trash { background: none; border: none; color: #dc3545; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; }
.btn-logout { background: #dc3545; margin-top: auto; align-self: center; width: 80%; padding: 12px; border-radius: 20px; font-weight: bold; color: white; border: none; cursor: pointer; }

/* Find View Specifics */
.find-search-container { padding: 10px 15px; background: #f1f1f1; border-bottom: 1px solid #ddd; }
.find-search-input { width: 100%; box-sizing: border-box; padding: 12px; font-size: 1rem; border-radius: 20px; border: 1px solid #ccc; outline: none; }
.find-search-input:focus { border-color: #0078fe; box-shadow: 0 0 0 2px rgba(0, 120, 254, 0.2); }
.find-user-row { min-height: 60px; box-sizing: border-box; border-radius: 8px; background: white; padding: 12px 15px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.find-user-info { font-weight: bold; color: #333; overflow-wrap: anywhere; }
.find-actions { display: flex; align-items: center; gap: 10px; }
.find-badge { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
.find-badge-success { background: #e6f4ea; color: #1e8e3e; }
.find-badge-danger { color: #d93025; }
.find-btn-small { padding: 6px 12px; border: none; border-radius: 16px; cursor: pointer; font-size: 0.8rem; font-weight: bold; transition: background 0.2s; }
.find-btn-primary { background: #0078fe; color: white; }
.find-btn-primary:hover { background: #0060cc; }
.find-btn-outline { background: transparent; color: #555; border: 1px solid #ccc; }
.find-btn-outline:hover { background: #f1f1f1; }
.find-user-profile { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.find-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background-color: #f1f1f1; flex-shrink: 0; border: 1px solid #eee; }

/* Chat Bubbles */
.msg-row { display: flex; width: 100%; }
.bubble { max-width: 75%; padding: 10px 14px; border-radius: 18px; position: relative; font-size: 0.95rem; line-height: 1.4; word-wrap: break-word; word-break: break-all; overflow-wrap: anywhere; }
.bubble a { color: #007bff; text-decoration: underline; }
.sent { justify-content: flex-end; }
/*.sent .bubble { background-color: #d9fdd3; color: #111; border-bottom-right-radius: 4px; }*/
.received { justify-content: flex-start; }
/* .received .bubble { background-color: #ffffff; color: #111; border-bottom-left-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,0.05); } */
.sent .bubble { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); transition: transform 0.2s ease; background-color: #d9fdd3; color: #111; border-bottom-right-radius: 4px; }
.received .bubble { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); transition: transform 0.2s ease; background-color: #ffffff; color: #111; border-bottom-left-radius: 4px; }
.timestamp { font-size: 0.65rem; color: #888; margin-top: 4px; text-align: right; }
.chat-img-embed {
    /* Hard limits */
    max-width: 250px;
    max-height: 250px;

    /* Keep aspect ratio */
    width: auto;
    height: auto;

    /* Ensures the image stays sharp and doesn't stretch */
    object-fit: contain;

    border-radius: 8px;
    display: block;
    margin: 8px 0;
    cursor: pointer;

    /* Optional: subtle border to define edge of light images */
    border: 1px solid rgba(0,0,0,0.1);
}

/* Bottom Input Areas (Shared) */
.bottom-bar { display: flex; padding: 10px; background: #f0f0f0; gap: 10px; }
.bottom-input { flex: 1; padding: 12px; border: none; border-radius: 20px; outline: none; font-size: 1rem; }
.bottom-input:focus { box-shadow: 0 0 0 1px #0078fe, 0 0 0 3px rgba(0, 120, 254, 0.2); }
.bottom-btn { background: #0078fe; color: white; border: none; padding: 0 20px; border-radius: 20px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.bottom-btn:hover { background: #005cbf; }
.bottom-btn:disabled { background: #ccc; cursor: not-allowed; }