:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Blobs */
.background-blobs {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; overflow: hidden;
}
.blob {
    position: absolute; filter: blur(100px); border-radius: 50%;
    animation: float 20s infinite alternate ease-in-out;
}
.blob-1 { width: 500px; height: 500px; background: rgba(59, 130, 246, 0.4); top: -100px; left: -100px; }
.blob-2 { width: 400px; height: 400px; background: rgba(139, 92, 246, 0.3); bottom: -50px; right: -50px; animation-delay: -5s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 100px) scale(1.2); }
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

header { padding: 2rem; text-align: center; margin-bottom: 2rem; }
header h1 { font-size: 2.5rem; font-weight: 800; background: linear-gradient(to right, #60a5fa, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
header p { color: var(--text-muted); margin-top: 0.5rem; }

.loading-spinner { text-align: center; font-size: 1.2rem; color: var(--primary); padding: 3rem; display: none; }

.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

/* Card Styles */
.card {
    padding: 1.5rem; transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column; justify-content: space-between;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.6); border-color: rgba(255,255,255,0.2); }

.card-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; flex-grow: 1; }

.badge {
    display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase; margin-bottom: 1rem;
}
.badge-PENDING { background: rgba(245, 158, 11, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.badge-DRAFT { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #60a5fa; }
.badge-PUBLISHED { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }

/* Buttons */
.btn {
    width: 100%; padding: 0.75rem; border: none; border-radius: 10px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; font-size: 0.9rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: scale(1.02); }
.btn-view { background: rgba(255,255,255,0.1); color: white; }
.btn-view:hover { background: rgba(255,255,255,0.2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s;
    /* Bài dài + nhiều ảnh làm khung cao hơn màn hình, các nút cuối bài (Đăng, Lưu)
       bị đẩy ra ngoài và KHÔNG cuộn tới được. Cho phép cuộn cả lớp phủ và chừa lề trên/dưới. */
    overflow-y: auto;
    padding: 24px 0;
    align-items: flex-start;
}
.modal.show { display: flex; opacity: 1; }
.modal-content {
    width: 90%; max-width: 600px; padding: 2rem; position: relative;
    transform: translateY(20px); transition: transform 0.3s;
    /* Tự cuộn bên trong khung, luôn chừa chỗ để thấy nút ở cuối */
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: auto;
    background: #1e2230;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    -webkit-overflow-scrolling: touch;
}
/* Nút đóng bám theo mép trên khi cuộn, không bị trôi mất */
.modal-content .close-btn { position: sticky; float: right; top: 0; z-index: 5; }
/* Hàng nút cuối khung luôn nhìn thấy khi cuộn tới đáy */
.modal-actions {
    position: sticky; bottom: -2rem;
    background: #1e2230;
    padding: 1rem 0 0.5rem;
    margin-top: 0.5rem;
}
.modal.show .modal-content { transform: translateY(0); }

.close-btn { position: absolute; top: 1rem; right: 1.5rem; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.close-btn:hover { color: white; }

#modal-title { margin-bottom: 1rem; color: #60a5fa; }
.content-box label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; display: block; }
#modal-body {
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; color: white; padding: 1rem; font-family: inherit;
    resize: none; outline: none; line-height: 1.6; margin-bottom: 1.5rem;
}

.modal-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-copy { background: #475569; color: white; flex: 1; }
.btn-publish { background: var(--success); color: white; flex: 1; }
.btn-publish:hover { background: #059669; }
/* Thêm vào cuối file style.css */
.tabs { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.tab-btn {
    padding: 0.75rem 1.5rem; border: none; border-radius: 999px; font-weight: 600;
    background: rgba(255,255,255,0.1); color: var(--text-muted); cursor: pointer; transition: all 0.3s;
    font-family: inherit; font-size: 0.95rem;
}
.tab-btn.active { background: var(--primary); color: white; box-shadow: 0 0 15px rgba(59,130,246,0.5); }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.2); color: white; }

/* AI Chỉnh sửa bài theo góp ý (feedback box trong modal xem bài) */
.feedback-box { margin-top: 0.5rem; margin-bottom: 1.5rem; }
.feedback-box label { font-size: 0.85rem; color: #c4b5fd; margin-bottom: 0.5rem; display: block; }
#modal-feedback {
    width: 100%; background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 10px; color: white; padding: 0.75rem; font-family: inherit;
    resize: vertical; outline: none; line-height: 1.5; font-size: 0.9rem;
}
#modal-feedback:focus { border-color: #a78bfa; }
.btn-revise {
    background: #7c3aed; color: white; width: 100%; margin-top: 0.6rem;
}
.btn-revise:hover { background: #6d28d9; }
