body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Select dropdown styling */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em 1em;
    padding-right: 2.5rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Admin name styling */
.admin-name {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    position: relative;
}

.admin-name::after {
    content: '👑';
    margin-left: 4px;
    font-size: 0.9em;
    -webkit-text-fill-color: #fbbf24;
    background: none;
}

/* VIP name styling with animated gradient */
.vip-name {
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #d97706, #fbbf24);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    animation: vip-gradient 3s ease infinite;
    position: relative;
    display: inline-block;
}

@keyframes vip-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.vip-name::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.3), transparent);
    animation: vip-shine 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes vip-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Password toggle button */
.toggle-password {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    background: none;
    border: none;
}

.toggle-password:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.toggle-password:active {
    transform: scale(0.95);
}

.toggle-password i {
    font-size: 16px;
}

/* Privacy Toggle Switch */
#privacy-toggle:checked + .relative .block {
    background-color: #10b981 !important; /* Green when checked */
}

#privacy-toggle:checked + .relative .dot-privacy {
    transform: translateX(1.5rem) !important;
}

#privacy-toggle:not(:checked) + .relative .block {
    background-color: #d1d5db !important; /* Gray when unchecked */
}

#privacy-toggle:not(:checked) + .relative .dot-privacy {
    transform: translateX(0) !important;
}

.dot-privacy {
    transition: transform 0.2s ease-in-out;
}

/* Google Bot toggle styling */
.dot-google-bot {
    transition: transform 0.3s ease;
}

/* Loading skeleton animation */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-skeleton .animate-pulse {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth spinner animation */
@keyframes spin-smooth {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-skeleton .animate-spin {
    animation: spin-smooth 1s linear infinite;
}

/* Responsive */
@media (max-width: 640px) {
    .chat-card {
        min-height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .app-container {
        padding: 0;
    }
    
    .nav-bar {
        border-radius: 0;
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 250px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid #10b981;
}

/* Popup thông báo tìm thấy người lạ */
.anonymous-match-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anonymous-match-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 360px;
    animation: slideIn 0.25s ease-out;
}

.anonymous-match-icon {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
}

.anonymous-match-content h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.anonymous-match-content p {
    margin: 0.1rem 0 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.anonymous-match-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-left: 0.5rem;
}

.anonymous-match-actions .btn-primary,
.anonymous-match-actions .btn-secondary {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.anonymous-match-actions .btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.anonymous-match-actions .btn-primary:hover {
    background: #2563eb;
}

.anonymous-match-actions .btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.anonymous-match-actions .btn-secondary:hover {
    background: #d1d5db;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Hidden class - ensure elements are completely hidden */
.hidden {
    display: none !important;
}

.app-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: auto;
    max-height: none;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

.chat-card {
    background-color: white;
    border-radius: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 520px;
    min-height: calc(100vh - 3rem);
    height: auto;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0 auto;
}

.message-bubble {
    max-width: 80%;
    border-radius: 1.5rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
    word-wrap: break-word;
}

.message-container {
    position: relative;
}

.message-content-wrapper {
    position: relative;
}

.message-recall-btn {
    z-index: 10;
    cursor: pointer;
    font-size: 0.7rem;
    white-space: nowrap;
}

.message-sent {
    background-color: #3b82f6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

.message-received {
    background-color: #e5e7eb;
    color: #374151;
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

.user-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
}

.btn {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    color: white;
    background-color: #3b82f6;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 8px rgba(59, 130, 246, 0.3);
}

.notification-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    z-index: 10;
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 420px;
}

.message-image {
    max-width: 100%;
    border-radius: 1rem;
}

.nav-bar {
    height: 4rem;
    min-height: 4rem;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    border-radius: 0;
    flex-shrink: 0;
}

.nav-bar.hidden {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #9ca3af;
    font-size: 0.75rem;
    position: relative;
    text-decoration: none;
}

.nav-item.active {
    color: #3b82f6;
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.icon-btn {
    padding: 0.5rem;
    border-radius: 999px;
    color: #4b5563;
    transition: background-color 0.2s ease;
}

.icon-btn:hover {
    background-color: #e5e7eb;
}

.unread-indicator,
.unread-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.25rem;
    height: 1.25rem;
    background-color: #ef4444;
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
    z-index: 10;
    padding: 0 0.25rem;
    box-sizing: border-box;
}

.chat-item-card {
    position: relative;
}

.chat-item-card .unread-indicator {
    top: 10px;
    right: 10px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.dot-phone,
.dot-facebook {
    position: absolute;
    left: 0.25rem;
    top: 0.25rem;
    background-color: white;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    transition: transform 0.2s ease;
}

/* Scrollable views - only show when not hidden */
#chat-list-view:not(.hidden),
#anonymous-chat-view:not(.hidden),
#friend-chat-view:not(.hidden),
#nearby-view:not(.hidden),
#friends-list-view:not(.hidden),
#my-profile-view:not(.hidden),
#friend-profile-view:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Ensure hidden views are completely hidden */
#chat-list-view.hidden,
#anonymous-chat-view.hidden,
#friend-chat-view.hidden,
#nearby-view.hidden,
#friends-list-view.hidden,
#my-profile-view.hidden,
#friend-profile-view.hidden {
    display: none !important;
}

/* View headers - fixed at top */
#chat-list-view > div:first-child,
#anonymous-chat-view > div:first-child,
#friend-chat-view > div:first-child,
#nearby-view > div:first-child,
#friends-list-view > div:first-child,
#my-profile-view > div:first-child,
#friend-profile-view > div:first-child {
    flex-shrink: 0;
    z-index: 10;
    background-color: white;
    position: sticky;
    top: 0;
}

/* Scrollable content areas */
#chat-list-container,
#anonymous-messages,
#friend-chat-messages,
#nearby-users-list,
#friends-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

/* Chat message areas - align messages toward bottom for nicer mobile view */
#anonymous-messages,
#friend-chat-messages {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

#friends-list::-webkit-scrollbar {
    width: 6px;
}

#friends-list::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 10px;
}

#friends-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

#friends-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

#pending-friends-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

#pending-friends-list::-webkit-scrollbar {
    width: 6px;
}

#pending-friends-list::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 10px;
}

#pending-friends-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

#pending-friends-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

#friends-list,
#pending-friends-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Profile view scrollable */
#my-profile-view > div:last-child,
#friend-profile-view > div:last-child {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Chat controls - fixed style helpers */
#anonymous-chat-controls,
#friend-chat-controls {
    flex-shrink: 0;
    background-color: #f3f4f6;
}

@media (max-width: 768px) {
    #anonymous-chat-controls,
    #friend-chat-controls {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 4rem; /* ngay trên thanh menu */
        z-index: 90;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        box-sizing: border-box;
    }
    
    /* Chừa khoảng trống để không bị che bởi thanh chat + menu */
    #anonymous-messages,
    #friend-chat-messages {
        padding-bottom: 7.5rem;
    }
}

/* Nearby view controls */
#nearby-view > div:nth-child(2) {
    flex-shrink: 0;
}

/* Friends list pending section */
#friends-list-view > div:last-child {
    flex-shrink: 0;
    max-height: 45vh;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chat-card {
        max-width: 600px;
        min-height: calc(100vh - 2rem);
    }
    
    .app-container {
        padding: 0;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 0;
    }
    
    .chat-card {
        max-width: 100%;
        border-radius: 0.75rem;
    }
    
    .nav-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        max-width: 100%;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 1.5rem;
    }
    
    #landing-page > div {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
    
    #profile-display,
    #profile-edit-form-container {
        padding: 1rem;
    }
    
    #anonymous-chat-controls {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #anonymous-chat-input-container {
        flex-direction: row;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
    }
    
    #find-next-btn {
        width: 100%;
    }
    
    .user-avatar {
        width: 3rem;
        height: 3rem;
    }
}

@media (max-width: 480px) {
    .chat-card {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .nav-bar {
        padding: 0 0.5rem;
    }
    
    .icon-btn {
        padding: 0.35rem;
    }
    
    .message-bubble {
        max-width: 90%;
    }

    /* Header buttons - scale down to avoid overflow on small screens */
    #start-anonymous-chat-btn,
    #chat-settings-btn,
    #friend-request-btn,
    #end-chat-btn,
    #anonymous-settings-btn,
    #friend-chat-profile-btn,
    #friend-chat-delete-btn {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
        padding-left: 0.6rem;
        padding-right: 0.6rem;
        font-size: 0.8rem;
    }

    /* VIP button and profile actions: reduce height on mobile */
    #upgrade-vip-btn,
    #change-password-btn {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
        font-size: 0.9rem;
    }

    /* Anonymous chat image icon + input */
    #anonymous-chat-input-container i.fas.fa-image {
        font-size: 1.5rem;
    }
    
    /* Ngăn iOS tự zoom khi focus (>=16px) */
    #anonymous-message-input,
    #friend-message-input {
        font-size: 1rem; /* ~16px */
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }
}








