* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

/* =============================================
   BASE BODY — index.html default
   ============================================= */
body {
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* =============================================
   INDEX.HTML — Loading & Auth Screens
   ============================================= */
.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    transition: opacity 0.5s ease-in-out;
}

h1#status-text {
    font-size: 1.7rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* Spinner */
.spinner {
    width: 100px;
    height: 100px;
    border: 3px solid #e5e5e5;
    border-top: 3px solid #000000;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4,0,0.2,1) infinite;
    margin-bottom: 35px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Welcome */
.content-welcome {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.logo {
    margin-top: 20px;
    margin-bottom: 30px;
}

.logo img {
    width: 100px;
    height: auto;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.description {
    color: #86868b;
    line-height: 1.5;
    margin-bottom: 40px;
}

.footer-actions {
    margin-top: auto;
    width: 100%;
    padding-bottom: 30px;
}

.terms-container {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: #86868b;
    margin-bottom: 20px;
}

.terms-container span {
    color: #000;
    text-decoration: underline;
}

.btn-primary {
    width: 100%;
    background: #000;
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    width: 100%;
    background: none;
    border: none;
    color: #86868b;
    padding: 15px;
    cursor: pointer;
    margin-top: 10px;
}

/* Animations */
.transparent { opacity: 0; }

.fade-in { animation: fadeIn 0.6s forwards; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login */
.content-login {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding-top: 40px;
}

.input-group {
    margin-bottom: 20px;
    width: 100%;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.rounded-input {
    width: 100%;
    padding: 16px;
    border: 1.5px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.rounded-input:focus {
    border-color: #000;
}

.content-login .footer-actions {
    margin-top: auto;
    padding-bottom: 30px;
}

/* Home Screen */
#home-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white !important;
    color: black;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.home-content {
    padding-top: 80px;
    text-align: center;
}

.bottom-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000;
    padding: 15px 25px;
    border-radius: 50px;
    width: 90%;
    max-width: 500px;
}

.nav-links {
    display: flex;
    justify-content: space-between;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.nav-links li a:hover {
    color: #28a745;
}

/* =============================================
   MESSAGING.HTML — scoped to body.chat-page
   ============================================= */
body.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #fff;
}

body.chat-page #chat-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

body.chat-page .chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
    flex-shrink: 0;
}

body.chat-page .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.chat-page .back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    position: static;
}

body.chat-page .profile-pic {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #000;
    flex-shrink: 0;
}

body.chat-page .header-info {
    display: flex;
    flex-direction: column;
}

body.chat-page .username {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

body.chat-page .status {
    font-size: 12px;
    color: #8e8e8e;
}

body.chat-page .chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

body.chat-page .message-group {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

body.chat-page .message-group.sent {
    align-self: flex-end;
    align-items: flex-end;
}

body.chat-page .message-group.received {
    align-self: flex-start;
    align-items: flex-start;
}

body.chat-page .bubble {
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
}

body.chat-page .message-group.sent .bubble {
    background-color: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
}

body.chat-page .message-group.received .bubble {
    background-color: #f0f0f0;
    color: #111;
    border-bottom-left-radius: 4px;
}

body.chat-page .timestamp {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
    padding: 0 4px;
}

body.chat-page .message-bar-container {
    padding: 10px 16px 20px;
    background: #fff;
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
}

body.chat-page .input-pill {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 28px;
    padding: 6px 14px;
    min-height: 48px;
    background: #fafafa;
    gap: 8px;
}

body.chat-page .message-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    background: transparent;
    color: #111;
}

body.chat-page .message-input::placeholder {
    color: #aaa;
}

body.chat-page .timestamp-live {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
    flex-shrink: 0;
}

body.chat-page .send-text {
    background: none;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    color: #000;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

body.chat-page .send-text:hover {
    background: #f0f0f0;
}

/* =============================================
   PROFILE.HTML — scoped to body.profile-page
   ============================================= */
body.profile-page {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    width: 100vw;
}

body.profile-page .profile-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}

body.profile-page .back-btn {
    position: absolute;
    left: 16px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #111;
    padding: 4px;
}

body.profile-page .back-btn:hover { color: #555; }

body.profile-page .profile-header h1 {
    font-size: 17px;
    font-weight: 600;
    margin-left: 12px;
}

body.profile-page .section {
    padding: 0 20px;
    margin-top: 28px;
}

body.profile-page .section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
}

body.profile-page .divider {
    height: 1px;
    background: #e5e5e5;
    margin: 28px 0 0;
}

body.profile-page .field-row {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

body.profile-page .field-row:last-child {
    border-bottom: none;
}

body.profile-page .field-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.profile-page .field-input {
    border: none;
    outline: none;
    font-size: 15px;
    color: #111;
    background: transparent;
    border-bottom: 1.5px solid transparent;
    padding-bottom: 4px;
    transition: border-color 0.2s;
    width: 100%;
}

body.profile-page .field-input::placeholder { color: #bbb; }
body.profile-page .field-input:focus { border-bottom: 1.5px solid #000; }

body.profile-page .birthday-inputs {
    display: flex;
    gap: 10px;
}

body.profile-page .birthday-inputs select {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #111;
    background: transparent;
    cursor: pointer;
    appearance: none;
    padding-bottom: 4px;
    border-bottom: 1.5px solid transparent;
    transition: border-color 0.2s;
}

body.profile-page .birthday-inputs select:focus {
    border-bottom: 1.5px solid #000;
}

body.profile-page .field-select {
    border: none;
    outline: none;
    font-size: 15px;
    color: #111;
    background: transparent;
    cursor: pointer;
    appearance: none;
    width: 100%;
    padding-bottom: 4px;
    border-bottom: 1.5px solid transparent;
    transition: border-color 0.2s;
}

body.profile-page .field-select:focus { border-bottom: 1.5px solid #000; }

body.profile-page .save-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 32px 20px 60px;
    padding: 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

body.profile-page .save-btn:hover { background: #222; }

body.profile-page .toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

body.profile-page .toast.show { opacity: 1; }
