/* ============================================
   LEMONxCHEAT - Main Stylesheet
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Chặn zoom khi tap vào input trên iOS */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Chỉ input text/textarea/select cần font 16px để iOS không zoom khi focus */
input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="search"],
input[type="tel"], textarea, select {
    font-size: 16px !important;
    -webkit-appearance: none;
}

/* Chặn text/link dài tràn viền */
.post-card, .post-card *, .post-content,
article, article *,
.message-bubble, .message-content,
.comment-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.post-card img, article img {
    max-width: 100%;
    height: auto;
}

:root {
    --primary: #FFD700;
    --primary-dark: #FFA500;
    --bg-dark: #0f0f1e;
    --bg-darker: #0a0a15;
    --bg-card: #1a1a2e;
    --bg-hover: #252541;
    --text-light: #e4e4e7;
    --text-muted: #9ca3af;
    --border: rgba(255, 215, 0, 0.15);
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #a855f7;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 215, 0, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.05) 0%, transparent 50%);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--primary); text-decoration: none; transition: all 0.3s; }
a:hover { color: var(--primary-dark); }

/* ==================== NAVBAR ==================== */
.navbar {
    background: rgba(10, 10, 21, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 12px 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo-lemon { color: var(--primary); text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.logo-x { color: #fff; font-size: 1.2rem; }
.logo-cheat {
    background: linear-gradient(135deg, #ff6b6b, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 5px;
}

.nav-menu a {
    color: var(--text-light);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-menu a:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.btn-login, .btn-register {
    padding: 8px 18px !important;
    border-radius: 8px;
}

.btn-login { border: 1px solid var(--primary); }
.btn-register {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-dark) !important;
    font-weight: 600;
}

.btn-register:hover { background: var(--primary-dark); transform: translateY(-2px); }

.nav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-menu { position: relative; }

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 200px;
    padding: 8px;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-top: 8px;
}

.user-menu:hover .user-dropdown { display: block; }

.user-dropdown a {
    display: block;
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--text-light);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 30px 0;
}

/* ==================== HERO ==================== */
.hero {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1), transparent 70%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    position: relative;
}

.hero h1 .gradient {
    background: linear-gradient(135deg, var(--primary), #ff6b6b, var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    position: relative;
}

.hero-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-dark);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3); color: var(--bg-dark); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover { background: var(--primary); color: var(--bg-dark); }

.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

/* ==================== CATEGORY GRID ==================== */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 30px;
    background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
    border-radius: 4px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--cat-color, var(--primary));
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--cat-color, var(--primary));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.category-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(255, 215, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--cat-color, var(--primary));
    margin-bottom: 15px;
}

.category-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.category-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; }

.category-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== POST CARD ==================== */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.post-card:hover { border-color: var(--primary); }

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.post-user-info h4 { font-size: 0.95rem; }
.post-user-info .post-time { font-size: 0.8rem; color: var(--text-muted); }

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-light);
}

.post-title a:hover { color: var(--primary); }

.post-content {
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.post-actions span { cursor: pointer; transition: color 0.2s; }
.post-actions span:hover { color: var(--primary); }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.badge-mod { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
.badge-vip { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--bg-dark); }
.badge-member { background: var(--bg-hover); color: var(--text-muted); }

/* ==================== FORMS ==================== */
.form-container {
    max-width: 450px;
    margin: 40px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 35px;
}

.form-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 25px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-info { background: rgba(59, 130, 246, 0.15); border: 1px solid var(--info); color: var(--info); }

/* ==================== CHAT PAGE ==================== */
.chat-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==================== CHAT BOX ==================== */
.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-height: 800px;
}

/* Chat trên trang chủ - chiều cao cố định */
.chat-container.home-chat {
    height: 550px;
    max-height: 550px;
    margin: 0 0 30px 0;
    max-width: 100%;
}

.chat-header {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(168, 85, 247, 0.1));
    padding: 18px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-indicator {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    50% { opacity: 0.7; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: var(--bg-darker); }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.message {
    display: flex;
    gap: 10px;
    max-width: 75%;
    animation: slideIn 0.3s ease;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.own { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.message-content { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.message.own .message-header { justify-content: flex-end; }

.message-author { 
    font-weight: 600; 
    color: var(--primary); 
    font-size: 0.85rem;
}

.message-time { 
    color: var(--text-muted); 
    font-size: 0.75rem; 
    font-weight: 400;
}

.message-bubble {
    background: var(--bg-hover);
    padding: 10px 15px;
    border-radius: 15px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message.own .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-dark);
}

/* Bubble ảnh - không padding, cố định size */
.message-image-bubble {
    padding: 0 !important;
    background: transparent !important;
    overflow: hidden;
    border-radius: 12px;
}

.message-bubble img { 
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 12px; 
    display: block;
    cursor: pointer;
    background: var(--bg-darker);
    transition: transform 0.2s;
}

.message-bubble img:hover {
    transform: scale(1.02);
}

.message-bubble audio { 
    width: 220px;
    max-width: 100%;
    height: 40px;
    display: block;
}

/* Bubble chứa audio - gọn lại */
.message-audio-bubble {
    padding: 6px 8px !important;
}

.chat-input-area {
    padding: 12px 15px;
    border-top: 1px solid var(--border);
    background: var(--bg-darker);
    position: relative;
}

/* Khung bo tròn chứa TẤT CẢ: emoji | ảnh | input | gửi */
.chat-input-wrapper {
    display: flex;
    gap: 2px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 4px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-light);
    padding: 8px 10px;
    font-size: 16px;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.chat-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
    flex-shrink: 0;
    padding: 0;
}

.chat-btn:hover { 
    background: var(--bg-hover); 
    color: var(--primary); 
}

/* Nút gửi - nằm trong khung, tròn vàng */
.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.92);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-btn.recording { background: var(--danger); color: white; animation: pulse 1s infinite; }

/* Emoji picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 15px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 100;
}

.emoji-picker.show { display: grid; }

.emoji-item {
    font-size: 1.5rem;
    padding: 5px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: background 0.2s;
}

.emoji-item:hover { background: var(--bg-hover); }

/* ==================== FOOTER ==================== */
.footer {
    background: var(--bg-darker);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.footer h4 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1rem;
}

.footer-brand p {
    color: var(--text-muted);
    margin-top: 10px;
    font-size: 0.9rem;
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    padding: 5px 0;
    font-size: 0.9rem;
}

.footer-links a:hover { color: var(--primary); }

.footer-social a {
    display: inline-flex;
    width: 38px;
    height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: var(--text-muted);
}

.footer-social a:hover { background: var(--primary); color: var(--bg-dark); border-color: var(--primary); }

.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==================== ADMIN ==================== */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 25px;
    min-height: calc(100vh - 200px);
}

.admin-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.admin-sidebar h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-light);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
    background: var(--bg-hover);
    color: var(--primary);
}

.admin-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.stat-card .stat-number { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.85rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-darker);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table select, .data-table .action-btn {
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.85rem;
}

.action-btn.delete { color: var(--danger); border-color: var(--danger); }
.action-btn.edit { color: var(--info); border-color: var(--info); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-darker);
        flex-direction: column;
        padding: 15px;
        border-bottom: 1px solid var(--border);
        display: none;
    }
    
    .nav-menu.show { display: flex; }
    .nav-menu li { width: 100%; }
    .nav-menu a { width: 100%; justify-content: flex-start; }
    
    .hero h1 { font-size: 2rem; }
    .hero { padding: 40px 20px; }
    
    .footer-content { grid-template-columns: 1fr; gap: 25px; }
    
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    
    .chat-container { height: calc(100vh - 140px); margin: 10px; }
    .chat-container.home-chat { height: 450px; margin: 0 0 20px 0; }
    .message { max-width: 90%; }
    
    .category-grid { grid-template-columns: 1fr; }
}
