/* =============================================
   Facebook Style Theme for Bootstrap 5
   Custom CSS - Lê Đình Quân
   ============================================= */

/* ---- CSS Variables (Facebook palette) ---- */
:root {
    --fb-bg: #f0f2f5;
    --fb-blue: #0866ff;
    --fb-dark: #050505;
    --fb-secondary: #65676b;
    --fb-hover: #e4e6eb;
    --fb-card: #ffffff;
    --fb-border: #ced0d4;
    --fb-green: #42b72a;
}

[data-bs-theme="dark"] {
    --fb-bg: #18191a;
    --fb-blue: #2d88ff;
    --fb-dark: #e4e6eb;
    --fb-secondary: #b0b3b8;
    --fb-hover: #3a3b3c;
    --fb-card: #242526;
    --fb-border: #3e4042;
}

/* ---- Base ---- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--fb-bg);
    color: var(--fb-dark);
    transition: background-color 0.2s, color 0.2s;
}

a { color: var(--fb-blue); text-decoration: none; }
a:hover { color: var(--fb-blue); text-decoration: underline; }

/* ---- Dark mode body ---- */
[data-bs-theme="dark"] body {
    background-color: var(--fb-bg);
    color: var(--fb-dark);
}

/* ---- FB Card ---- */
.fb-card {
    background-color: var(--fb-card);
    border: 1px solid var(--fb-border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    transition: background-color 0.2s, border-color 0.2s;
}

[data-bs-theme="dark"] .fb-card {
    background-color: var(--fb-card);
    border-color: var(--fb-border);
}

/* ---- FB Navbar ---- */
.fb-navbar {
    background-color: var(--fb-card);
    border-bottom: 1px solid var(--fb-border);
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    height: 56px;
    z-index: 1030;
}

.fb-navbar .nav-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--fb-secondary);
    transition: background-color 0.15s;
    position: relative;
}

.fb-navbar .nav-icon:hover {
    background-color: var(--fb-hover);
}

.fb-navbar .nav-icon.active {
    color: var(--fb-blue);
}

.fb-navbar .nav-link-fb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 2rem;
    color: var(--fb-secondary);
    border-bottom: 3px solid transparent;
    border-radius: 0.5rem;
    transition: all 0.15s;
    position: relative;
}

.fb-navbar .nav-link-fb:hover {
    background-color: var(--fb-hover);
    text-decoration: none;
}

.fb-navbar .nav-link-fb.active {
    color: var(--fb-blue);
    border-bottom-color: var(--fb-blue);
    border-radius: 0;
    background: none;
}

.fb-navbar .nav-link-fb.active:hover {
    background: none;
}

/* ---- Mobile Bottom Nav ---- */
.fb-mobile-nav {
    border-top: 1px solid var(--fb-border);
    background-color: var(--fb-card);
}

.fb-mobile-nav .nav-link-fb {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fb-secondary);
    border-top: 3px solid transparent;
    border-bottom: none;
    border-radius: 0;
}

.fb-mobile-nav .nav-link-fb.active {
    color: var(--fb-blue);
    border-top-color: var(--fb-blue);
}

/* ---- Search Box ---- */
.fb-search {
    background-color: var(--fb-hover);
    border: none;
    border-radius: 50rem;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    color: var(--fb-dark);
    font-size: 0.9rem;
    width: 100%;
    max-width: 240px;
    transition: background-color 0.2s;
}

.fb-search::placeholder {
    color: var(--fb-secondary);
}

.fb-search:focus {
    background-color: var(--fb-card);
    box-shadow: 0 0 0 2px var(--fb-blue);
    outline: none;
}

/* ---- Profile Header ---- */
.profile-cover {
    position: relative;
    overflow: hidden;
    background-color: var(--fb-hover);
}

.profile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s;
}

.profile-cover:hover img {
    transform: scale(1.03);
}

.profile-avatar {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    border: 5px solid var(--fb-card);
    overflow: hidden;
    margin-top: -80px;
    position: relative;
    z-index: 10;
    background-color: var(--fb-bg);
    box-shadow: 0 4px 6px rgba(0,0,0,.1);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.profile-avatar:hover img {
    transform: scale(1.1);
}

.profile-avatar .camera-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background-color: var(--fb-hover);
    border: 2px solid var(--fb-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    transition: background-color 0.15s;
}

.profile-avatar .camera-btn:hover {
    background-color: #d0d0d0;
}

/* ---- Profile Tabs ---- */
.profile-tabs {
    border-bottom: 1px solid var(--fb-border);
}

.profile-tabs .nav-link {
    color: var(--fb-secondary);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 1rem 1rem;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    transition: all 0.15s;
}

.profile-tabs .nav-link:hover {
    background-color: var(--fb-hover);
    border-radius: 0.5rem 0.5rem 0 0;
}

.profile-tabs .nav-link.active {
    color: var(--fb-blue);
    border-bottom-color: var(--fb-blue);
    background: none;
}

/* ---- FB Button Variants ---- */
.btn-fb-primary {
    background-color: var(--fb-blue);
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1.25rem;
    transition: background-color 0.15s;
}
.btn-fb-primary:hover {
    background-color: #0756d4;
    color: #fff;
}

.btn-fb-secondary {
    background-color: var(--fb-hover);
    color: var(--fb-dark);
    border: none;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1.25rem;
    transition: background-color 0.15s;
}
.btn-fb-secondary:hover {
    background-color: #d0d0d0;
}

[data-bs-theme="dark"] .btn-fb-secondary {
    background-color: var(--fb-hover);
    color: var(--fb-dark);
}

[data-bs-theme="dark"] .btn-fb-secondary:hover {
    background-color: #4e4f51;
}

/* ---- FB Action Button (like, comment, share) ---- */
.fb-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--fb-secondary);
    border: none;
    background: none;
    border-radius: 0.375rem;
    transition: background-color 0.15s;
    cursor: pointer;
    text-decoration: none;
}

.fb-action-btn:hover {
    background-color: var(--fb-hover);
    text-decoration: none;
    color: var(--fb-secondary);
}

.fb-action-btn.liked {
    color: var(--fb-blue);
}

/* ---- Reaction Icons ---- */
.reaction-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--fb-card);
    font-size: 0.625rem;
    color: #fff;
}

/* ---- Text Helpers ---- */
.text-fb-blue { color: var(--fb-blue) !important; }
.text-fb-secondary { color: var(--fb-secondary) !important; }
.text-fb-dark { color: var(--fb-dark) !important; }
.bg-fb-bg { background-color: var(--fb-bg) !important; }
.bg-fb-card { background-color: var(--fb-card) !important; }
.bg-fb-hover { background-color: var(--fb-hover) !important; }
.bg-fb-blue { background-color: var(--fb-blue) !important; }
.border-fb { border-color: var(--fb-border) !important; }

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn { animation: fadeIn 0.3s ease-out forwards; }

/* ---- Entry Content ---- */
.entry-content img { max-width: 100%; height: auto; border-radius: 0.5rem; }
.entry-content a { color: var(--fb-blue); text-decoration: underline; }
.entry-content a:hover { text-decoration: none; }
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.entry-content p { margin-bottom: 1em; line-height: 1.7; }
.entry-content ul, .entry-content ol { margin-left: 1.5em; margin-bottom: 1em; }
.entry-content li { margin-bottom: 0.5em; }
.entry-content blockquote {
    border-left: 4px solid var(--fb-blue);
    padding-left: 1rem;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--fb-secondary);
}
.entry-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1em;
}
.entry-content code {
    background-color: var(--fb-hover);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* ---- Highlights ---- */
.highlight-story {
    aspect-ratio: 9/16;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.highlight-story img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s;
}

.highlight-story:hover img {
    transform: scale(1.1);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #bcc0c4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

[data-bs-theme="dark"] ::-webkit-scrollbar-track { background: #18191a; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #3e4042; }

/* ---- Toast ---- */
.ldq-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,.2);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

/* ---- Verified Badge ---- */
.verified-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    position: relative;
}

.verified-badge svg {
    width: 16px;
    height: 16px;
}

.verified-badge .verified-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
}

.verified-badge:hover .verified-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Photo Grid ---- */
.photo-grid-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    background-color: var(--fb-hover);
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.photo-grid-item:hover img {
    transform: scale(1.1);
}

/* ---- No Scrollbar ---- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- Project Card Overlay ---- */
.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.project-overlay:hover,
.project-card:hover .project-overlay {
    opacity: 1;
}

/* ---- Pricing Featured ---- */
.pricing-featured {
    border: 2px solid var(--fb-blue) !important;
    box-shadow: 0 10px 25px rgba(8,102,255,.15);
    transform: translateY(-8px);
}

/* ---- Line Clamp ---- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Responsive Adjustments ---- */
@media (max-width: 767.98px) {
    .profile-avatar {
        width: 128px;
        height: 128px;
        margin-top: -64px;
    }
    
    .fb-navbar .nav-link-fb {
        padding: 0 1rem;
    }
}
