* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #fff5f7;
    margin: 0;
    color: #333;
}

.auth-container {
    max-width: 400px;
    margin: 60px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.auth-container h2 { text-align: center; color: #e63958; }

.policy-container {
    max-width: 640px;
    margin: 40px auto;
    background: white;
    padding: 30px 34px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.policy-container h2 { text-align: center; color: #e63958; margin-bottom: 24px; }

.policy-section { margin-bottom: 20px; }

.policy-section h3 { margin: 0 0 6px 0; color: #333; font-size: 16px; }

.policy-section p { margin: 0; color: #555; line-height: 1.5; font-size: 14px; }

form label {
    display: block;
    margin-top: 12px;
    font-weight: 600;
    font-size: 14px;
}

form input, form select, form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

form button {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: #e63958;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

form button:hover { background: #c72a47; }

.error { color: #d8000c; text-align: center; }
.success { color: #2e7d32; text-align: center; }

a { color: #e63958; text-decoration: none; }

.topbar {
    background: #2ecc71;
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.topbar a {
    background: white;
    color: #222;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.topbar a:hover { background: #f0f0f0; }

.search-bar {
    max-width: 500px;
    margin: 20px auto 0;
    padding: 0 20px;
    display: flex;
    gap: 10px;
}

.search-bar input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.search-bar input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.search-bar button {
    flex-shrink: 0;
    padding: 10px 20px;
    background: #e63958;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.search-bar button:hover { background: #c72a47; }

.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 30px;
    justify-content: center;
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 250px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.profile-photo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 10px;
}

.photo-wrapper {
    position: relative;
    display: inline-block;
}

.online-dot {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    background: #2ecc71;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.activity-status {
    font-size: 12px;
    color: #999;
    margin: 0 0 8px 0;
}

.profile-card .bio {
    font-size: 13px;
    color: #666;
    min-height: 40px;
}

.like-btn {
    display: inline-block;
    margin-top: 10px;
    background: #e63958;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.like-btn:hover { background: #c72a47; }

.chat-box {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.chat-message {
    margin-bottom: 12px;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    clear: both;
}

.chat-message.sent {
    background: #e63958;
    color: white;
    float: right;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.chat-message.received {
    background: #f0f0f0;
    float: left;
}

.chat-message p { margin: 0; }
.chat-time { font-size: 11px; opacity: 0.7; }

.msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ticks { font-size: 12px; opacity: 0.85; }

.edited-label {
    font-size: 11px;
    font-style: italic;
    opacity: 0.7;
    display: block;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    opacity: 0.7;
}

.edit-btn:hover { opacity: 1; }

.edit-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
}

.edit-form textarea.edit-input {
    width: 90%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.edit-form-actions {
    display: flex;
    gap: 6px;
}

.edit-form button {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: #e63958;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.chat-message.sent .edit-form button { background: white; color: #e63958; }

.msg-deleted {
    font-style: italic;
    opacity: 0.7;
}

.msg-action-menu {
    position: fixed;
    z-index: 1000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.msg-action-menu button {
    background: none;
    border: none;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}

.msg-action-menu button:hover { background: #f5f5f5; }

.msg-action-menu button.action-delete { color: #e63958; }

.msg-action-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
}

.chat-form {
    max-width: 600px;
    margin: 0 auto 40px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 12px;
}

.chat-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-form textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    overflow-y: hidden;
}

.send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e63958;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.photo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 6px;
    width: fit-content;
}

.photo-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.photo-preview button {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.chat-photo {
    max-width: 200px;
    border-radius: 10px;
    display: block;
    margin-bottom: 6px;
}

.attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
}

.bell-link { position: relative; }

.badge {
    background: #e63958;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: top;
}

.notif-list {
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.notif-item {
    display: block;
    background: white;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.notif-item p { margin: 0 0 4px 0; color: #333; }
.notif-time { font-size: 12px; color: #999; }

.chat-list {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 20px 40px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: #333;
}

.chat-list-item:hover { background: #fafafa; }

.chat-list-item .photo-wrapper { flex-shrink: 0; }

.chat-list-photo {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.chat-list-info {
    flex: 1;
    min-width: 0;
}

.chat-list-name {
    font-weight: 600;
    margin: 0 0 2px 0;
}

.chat-list-preview {
    font-size: 13px;
    color: #999;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-preview.unread {
    color: #333;
    font-weight: 600;
}

.chat-list-meta {
    text-align: right;
    flex-shrink: 0;
    font-size: 12px;
    color: #999;
}

.chat-list-meta .badge {
    display: inline-block;
    margin-top: 4px;
    margin-left: 0;
}

.chat-list-row {
    margin-bottom: 10px;
}

.chat-list-row .chat-list-item {
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
}

.chat-list-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background: white;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 12px 12px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 13px;
}

.chat-list-action-form {
    display: inline;
}

.chat-list-actions a,
.chat-list-actions button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    text-decoration: none;
}

.chat-list-actions a:hover,
.chat-list-actions button:hover {
    color: #666;
    text-decoration: underline;
}

.chat-list-action-sep {
    color: #ccc;
}

.chat-header-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    margin: 16px auto 4px;
}

.chat-header-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.chat-header-link h2 {
    margin: 8px 0 0 0;
    font-size: 18px;
}

.chat-header-link:hover .chat-header-photo {
    opacity: 0.9;
}

.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.photo-lightbox.open {
    display: flex;
}

.photo-lightbox img {
    max-width: 92vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    left: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-save {
    position: absolute;
    bottom: 24px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.lightbox-save:hover {
    background: rgba(255,255,255,0.3);
}

/* --- Social login (login.php) --- */
.social-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
}

.fb-login-btn {
    width: 280px;
    max-width: 100%;
    padding: 10px 0;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.fb-login-btn:hover { background: #166fe5; }

.social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 14px 0;
}

.social-divider::before, .social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.social-divider span { padding: 0 10px; }

/* --- Chat header call buttons (chat.php) --- */
.chat-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.chat-call-buttons { display: flex; gap: 10px; }

.call-icon-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
}

.call-icon-btn:hover { background: #f0f0f0; }
.call-icon-btn:disabled { opacity: 0.5; cursor: default; }

/* --- Incoming call banner (includes/nav.php) --- */
.incoming-call-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #222;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.incoming-call-banner img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.incoming-call-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.incoming-call-info span { color: #ccc; font-size: 12px; }

.incoming-call-accept, .incoming-call-decline {
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.incoming-call-accept { background: #2ecc71; color: #fff; }
.incoming-call-decline { background: #e74c3c; color: #fff; }

/* --- Call screen (call.php) --- */
.call-screen {
    position: fixed;
    inset: 0;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-remote-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

.call-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    background: #111;
}

.call-placeholder img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

#local-video {
    position: absolute;
    bottom: 100px;
    right: 16px;
    width: 110px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #444;
    background: #222;
}

.call-controls {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.call-btn:hover { background: rgba(255,255,255,0.3); }

.call-btn-end {
    background: #e74c3c;
    transform: rotate(135deg);
}

.call-btn-end:hover { background: #d33; }
