* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #1a73e8;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #1a73e8;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-small {
    padding: 5px 10px;
    background: #e4e6eb;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.btn-small:hover {
    background: #d8dadf;
}

.btn-full {
    width: 100%;
}

.alert {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.demo-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 14px;
}

/* Navigation */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: #1a73e8;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: #f0f2f5;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Timeline */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.post-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.post-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 10px;
}

.tts-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tts-controls select,
.tts-controls input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.post-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.post-header {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
}

.post-time {
    float: right;
}

.post-content {
    font-size: 16px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.voice-info {
    color: #666;
    font-size: 12px;
}

/* Chat */
.chat-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 100px);
}

.chat-sidebar {
    width: 300px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.chat-main {
    flex: 1;
    background: white;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    position: relative;
}

.message.sent {
    background: #1a73e8;
    color: white;
    align-self: flex-end;
}

.message.received {
    background: #e4e6eb;
    align-self: flex-start;
}

.message-content {
    word-wrap: break-word;
}

.message-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    font-size: 12px;
    opacity: 0.8;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #eee;
}

.chat-input-area textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: none;
    min-height: 60px;
    margin-bottom: 10px;
}

.friends-list {
    margin-top: 15px;
}

.friend-item {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.3s;
    border: 1px solid #eee;
}

.friend-item:hover {
    background: #f0f2f5;
}
/* ========== CHAT CONTAINER FIX ========== */
.chat-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px); /* Chiều cao cố định - trừ header */
    max-height: calc(100vh - 140px);
    overflow: hidden; /* Ngăn tràn */
}

.chat-sidebar {
    width: 300px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-y: auto; /* Cho phép cuộn danh sách bạn bè */
    height: 100%;
}

.chat-main {
    flex: 1;
    background: white;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 100%;
    overflow: hidden; /* Quan trọng */
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0; /* Không co lại */
}

.messages-container {
    flex: 1; /* Chiếm hết không gian còn lại */
    padding: 20px;
    overflow-y: auto; /* CHO PHÉP CUỘN */
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0; /* Quan trọng cho flex child */
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0; /* Không co lại */
    background: white;
}

/* Đảm bảo message không bị tràn */
.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    flex-shrink: 0;
}

.message.sent {
    background: #1a73e8;
    color: white;
    align-self: flex-end;
}

.message.received {
    background: #e4e6eb;
    align-self: flex-start;
}

/* Empty chat message */
.empty-chat-message {
    text-align: center;
    padding: 50px 20px;
    color: #999;
    margin: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    .chat-sidebar {
        width: 100%;
        max-height: 250px;
    }
    
    .chat-main {
        min-height: 400px;
    }
}

/* Profile */
.profile-container {
    max-width: 600px;
    margin: 20px auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-form h3 {
    margin: 30px 0 20px;
    color: #1a73e8;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
    }
    
    .chat-sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tts-controls {
        flex-direction: column;
        align-items: stretch;
    }
/* Voice Input Styles */
.input-methods {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.btn-voice {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-voice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

.btn-voice:active {
    transform: translateY(0);
}

.btn-voice.recording {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s infinite;
}

.recording-status {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 87, 108, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0);
    }
}

/* Voice button animation when recording */
.btn-voice.recording {
    animation: pulse 1.5s infinite;
}

/* Mobile responsive for voice input */
@media (max-width: 768px) {
    .btn-voice {
        width: 100%;
        padding: 12px;
    }
    
    .input-methods {
        flex-direction: column;
        align-items: stretch;
    }
}
/* Notification Styles */
.notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.in-app-notification {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #1a73e8;
    cursor: pointer;
}

.in-app-notification:hover {
    background: #f8f9fa;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-badge {
    background: #dc3545;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    margin-left: 5px;
}

.unread-badge {
    background: #1a73e8;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 8px;
}

/* Friend item improvements */
.friend-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    position: relative;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
}

.friend-info {
    flex: 1;
}

.friend-last-message {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.friend-status {
    font-size: 20px;
}

.empty-chat-message {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.empty-chat-message i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.chat-sidebar-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.chat-sidebar-actions .btn {
    flex: 1;
}

/* Message time formatting */
.message-time {
    font-size: 11px;
    opacity: 0.7;
}

/* ========== HEADER APP STYLE ========== */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Phần trên: Logo + Menu */
.nav-top {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand i {
    font-size: 28px;
}

/* Menu ngang */
.nav-menu {
    display: flex;
    gap: 5px;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 25px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

.nav-menu a i {
    font-size: 20px;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-menu a.active {
    background: rgba(255,255,255,0.3);
}

.nav-menu .menu-text {
    display: inline;
}

/* Phần dưới: Thanh tìm kiếm */
.nav-bottom {
    padding: 10px 20px;
    background: rgba(0,0,0,0.1);
}

.nav-search {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.nav-search input {
    width: 100%;
    padding: 12px 20px 12px 50px;
    border: none;
    border-radius: 30px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-search input::placeholder {
    color: rgba(255,255,255,0.7);
}

.nav-search input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.nav-search i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 18px;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff0000;
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    padding: 0 5px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(255,0,0,0.5);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 2px 15px rgba(255,0,0,0.8); }
    100% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu .menu-text {
        display: none;
    }
    
    .nav-menu a {
        padding: 10px 12px;
    }
    
    .nav-menu a i {
        font-size: 22px;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .nav-brand i {
        font-size: 32px;
    }
    
    .nav-search {
        max-width: 100%;
    }
}
/* Cảnh báo từ nhạy cảm */
.filtered-warning {
    color: #ff9800;
    font-style: italic;
}

.post-content .filtered-word {
    background: rgba(255, 152, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
    color: #ff9800;
    font-weight: bold;
}
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
    position: relative;
}

.nav-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.8);
}

.nav-search input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 14px;
}

.nav-search input::placeholder {
    color: rgba(255,255,255,0.8);
}

.nav-search input:focus {
    outline: none;
    background: rgba(255,255,255,0.3);
}

.nav-menu {
    display: flex;
    gap: 5px;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.2);
}

.nav-menu a.active {
    background: rgba(255,255,255,0.3);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff0000;
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    border: 2px solid white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .nav-menu .menu-text {
        display: none;
    }
    
    .nav-menu a {
        padding: 10px 12px;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .nav-search {
        max-width: 200px;
    }
}
}