/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
    --bg-body: #f1f5f9;
    --bg-sidebar: #0f172a;
    --text-primary: #1e293b;
    --text-sidebar: #e2e8f0;
    --text-sidebar-muted: #94a3b8;
    --accent: #2563eb;
    --border-color: #cbd5e1;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

img,
video {
    max-width: 100%;
    display: block;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-block;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: #eee;
    border-radius: 4px;
}

.back-btn {
    display: inline-block;
    margin-bottom: 1rem;
    color: #64748b;
    font-weight: 500;
}

.back-text {
    color: #64748b;
    font-size: 0.9rem;
}

/* LAYOUT */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-content {
    margin-left: 300px;
    margin-right: 340px;
    flex: 1;
    padding: 3rem;
    min-width: 0;
}

.admin-content {
    margin-left: 300px;
    padding: 3rem;
    margin-right: 0 !important;
    max-width: none;
    flex: 1;
}

/* SIDEBAR */
.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-section {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    padding: 3px;
    object-fit: cover;
    margin: 0 auto 1rem;
    background-clip: content-box;
}

.profile-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.profile-tags {
    font-size: 0.8rem;
    color: var(--text-sidebar-muted);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
}

.nav-menu {
    flex: 1;
    margin-top: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1rem;
    color: var(--text-sidebar-muted);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: var(--accent);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* RIGHT SIDEBAR (HISTORY) */
.right-sidebar {
    width: 300px;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    padding: 3rem 1.5rem 1rem 1.5rem;
    z-index: 900;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.history-widget {
    background: #fff;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    max-height: 500px;
}

.history-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed #e2e8f0;
}

.history-scroll-container {
    height: 250px;
    overflow: hidden;
    position: relative;
}

.history-content-wrapper {
    animation: scrollUp 20s linear infinite;
}

.history-content-wrapper:hover {
    animation-play-state: paused;
}

@keyframes scrollUp {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}

.history-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #94a3b8;
    font-size: 0.9rem;
    color: #475569;
}

.history-year {
    font-weight: 800;
    display: block;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

/* POST CARDS (GRID LAYOUT) */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    /* Reduced gap */
    margin-bottom: 2rem;
}

.post-card {
    background: white;
    border-radius: 8px;
    /* Slightly smaller radius */
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Removed min-height constraint to make it compact */
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e2e8f0;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    border-color: var(--accent);
}

.post-thumbnail-wrapper {
    width: 100%;
    height: 160px;
    /* Reduced height for compactness */
    flex-shrink: 0;
    overflow: hidden;
    background-color: #ffffff;
    /* White bg for contained images */
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    /* Add padding so image doesn't touch edges */
}

.post-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensure full image is visible */
    object-position: center;
    transition: transform 0.3s;
}

.post-card:hover .post-thumbnail {
    transform: scale(1.05);
}

.post-info {
    padding: 1rem;
    /* Reduced padding */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-title {
    font-size: 1.1rem;
    /* Slightly smaller title */
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-date {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-excerpt {
    font-size: 0.85rem;
    /* Smaller text */
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
    flex: 1;
    line-height: 1.5;
}

/* SUGGESTIONS */
.suggestions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 3rem;
}

.suggestion-btn {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
}

.suggestion-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* FAMILIA STYLES */
.password-gate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    text-align: center;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 2rem;
}

.password-input {
    padding: 0.8rem 1rem;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    letter-spacing: 2px;
}

.password-input:focus {
    border-color: var(--accent);
    outline: none;
}

.menu-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: 0.2s;
    color: #334155;
    font-weight: 600;
    font-size: 1.2rem;
}

.menu-box i {
    font-size: 2.5rem;
    color: var(--accent);
}

.menu-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
}

/* ALBUM & GALLERY */
.album-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.album-card {
    display: block;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
    transition: 0.2s;
}

.album-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.album-cover {
    height: 180px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-cover .no-img {
    font-size: 3rem;
    color: #cbd5e1;
}

.album-name {
    padding: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: #334155;
    border-top: 1px solid #f1f5f9;
}

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

.gallery-item {
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    background: #eee;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

/* DOCS LIST */
.doc-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.doc-item {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #334155;
    font-weight: 500;
    transition: 0.2s;
}

.doc-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.doc-item i.fa-file-pdf {
    font-size: 1.5rem;
    color: #ef4444;
}

.doc-item .action-icon {
    margin-left: auto;
    color: #94a3b8;
}

/* PAGINATION */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.page-link {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
}

.page-link.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* LIGHTBOX STYLES */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    animation: zoom 0.3s;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes zoom {
    from {
        transform: translate(-50%, -50%) scale(0)
    }

    to {
        transform: translate(-50%, -50%) scale(1)
    }
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
}

.close-lightbox:hover,
.close-lightbox:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@media only screen and (max-width: 700px) {
    .lightbox-content {
        width: 100%;
    }
}

/* LIGHTBOX NAVIGATION */
.lb-prev,
.lb-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    z-index: 2002;
    background: rgba(0, 0, 0, 0.3);
}

.lb-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.lb-prev:hover,
.lb-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* FOLDER CARDS */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.folder-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    color: #334155;
    transition: 0.2s;
    cursor: pointer;
    position: relative;
}

.folder-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
    color: var(--accent);
}

.folder-icon {
    font-size: 3rem;
    color: #fbbf24;
    margin-bottom: 1rem;
    display: block;
}

.folder-name {
    font-weight: 600;
    font-size: 1rem;
}

.folder-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #64748b;
}


/* RESPONSIVE */
/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {

    /* Tablet & Small Laptop: Hide Right Sidebar or Collapse it */
    .right-sidebar {
        display: none;
        /* Hide history on tablets to save space */
    }

    .main-content {
        margin-right: 0;
        padding: 2rem;
    }
}

@media (max-width: 768px) {

    /* MOBILE LAYOUT */
    .app-container {
        flex-direction: column;
    }

    /* SIDEBAR (Top Bar Style) */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        /* Not fixed anymore */
        padding: 1rem;
        flex-direction: column;
        /* Keep column for menu expansion */
        align-items: stretch;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000;
        background-color: #0f172a;
    }

    .profile-section {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        /* Allow wrapping */
        gap: 1rem;
        margin: 0;
        text-align: left;
        width: 100%;
    }

    .profile-img {
        width: 50px;
        height: 50px;
        margin: 0;
        border-width: 2px;
    }

    .profile-name {
        font-size: 1.2rem;
    }

    .profile-tags {
        display: none;
        /* Hide tags on mobile to save space */
    }

    /* Show Mobile Menu Button */
    #mobile-menu-btn {
        display: block !important;
        margin-left: auto;
        /* Push to right */
    }

    /* Navigation Menu (Hidden by default) */
    .nav-menu {
        display: none;
        /* Hidden */
        width: 100%;
        margin-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }

    /* Open Menu */
    .nav-menu.active {
        display: block;
        animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-link {
        padding: 1rem;
        /* Bigger touch targets */
        font-size: 1.1rem;
    }

    /* MAIN CONTENT */
    .main-content,
    .admin-content {
        margin-left: 0;
        margin-right: 0;
        padding: 1.5rem;
        width: 100%;
    }

    /* 1 Column Grids */
    .posts-grid,
    .suggestions,
    .album-list,
    .gallery-grid,
    .folder-grid,
    .media-grid,
    .music-grid,
    .movie-grid {
        grid-template-columns: 1fr !important;
        /* Force 1 column */
    }

    /* Compact Cards Mobile */
    .post-thumbnail-wrapper {
        height: 200px;
    }

    .post-card {
        min-height: auto;
    }

    /* Gallery Fixes */
    .gallery-item,
    .album-cover {
        height: 200px;
    }

    /* Consistent height */

    /* Right Sidebar (History) -> Move to Bottom */
    .right-sidebar {
        display: block;
        /* Show it */
        width: 100%;
        height: auto;
        position: relative;
        padding: 2rem 1.5rem;
        background: #f8fafc;
        /* Differentiate bg */
        border-top: 1px solid #e2e8f0;
    }

    .history-widget {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}