:root {
    --base-color: white;
    --base-variant: #e7f1ff;
    --text-color: #111528;
    --secondary-text: #232738;
    --primary-color: #3a435d;
    --accent-color: burlywood;
    --background-gradient: rgb(255, 237, 214);
    --blog-background: #e4cba9; 
}

.darkmode {
    --base-color: #070b1d;
    --base-variant: #101425;
    --text-color: #ffffff;
    --secondary-text: #a4a5b8;
    --primary-color: #3a435d;
    --accent-color: burlywood;
    --background-gradient: linear-gradient(to bottom, #1a1a2e, #16213e);
    --blog-background: #232738;
}
#theme-switch{
    height: 50px;
    width: 50px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--base-variant);
    display: flex;
    justify-content: center;
    align-items: center;
}
#theme-switch svg{
    fill: var(--primary-color);
}
#theme-switch svg:last-child{
    display: none;
}
.darkmode #theme-switch svg:first-child{
    display: none;
}
.darkmode #theme-switch svg:last-child{
    display: block;
}

/* Utility classes */
.hidden {
    display: none !important;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background-gradient);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout toggle classes 
.vertical-layout .blog-container {
    grid-template-columns: 1fr !important;
}
.horizontal-layout .blog-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
}*/

.toggle-btn {
    background-color: burlywood;
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    font-weight: bold;
    margin-bottom: 20px;
}

/* Blog Container */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Default layout */
    gap: 20px;
    align-content: start;
    height: auto;
    overflow: hidden;
}

/* Initial state for animations */
.blog-container .blog, .blog-container .photo-only{
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* When the blog card becomes visible */
.blog-container .blog.visible, .blog-container .photo-only.visible{
    opacity: 1;
    transform: translateY(0);
}

/* Full View Blog Card */
.blog {
    padding: 15px;
    margin: 0;
    background-color: var(--blog-background);
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.blog img, .blog video {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
    transition: transform 0.3s ease;
    margin: 10px 0;
    object-fit: cover;
}

.blog h2 {
    font-size: 1rem;
    margin: 10px 0;
    color: var(--text-color);
}

.blog p {
    font-size: 0.9rem;
    margin: 5px 0;
    color: var(--text-color);
    -webkit-line-clamp: 1;
}
.blog a {
    display: inline-block;
    margin-top: auto;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--base-variant);
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.blog a:hover {
    background-color: var(--base-variant);
    color: var(--text-color);
}

/* Photo-Only View */
.photo-only {
    padding: 15px;
    margin: 0;
    background-color: var(--blog-background);
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.photo-only:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.photo-only img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}
.youtube-video iframe,
.videos-only video {
    width: 100%; /* Take up the full width of the parent container */
    height: auto; /* Maintain aspect ratio */
    max-width: 100%; /* Ensure they don't overflow the container */
    display: block; /* Ensure no inline spacing issues */
    object-fit: cover; /* Fit the video nicely within the bounds */
    border-radius: 8px; /* Optional: Rounded corners */
}

.videos-only {
    padding: 15px;
    margin: 0;
    background-color: var(--blog-background);
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    align-content: center;
    box-sizing: border-box;
    overflow: hidden;
}


/* Filters & Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 10px;
}

.filter-bar .btn {
    background-color: burlywood;
    padding: 8px 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.pagination a {
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid #ccc;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.pagination a.active {
    font-weight: bold;
    background-color: rgb(115, 79, 31);
    color: var(--text-color);
    border-color: burlywood;
}

.pagination a:hover {
    background-color: rgb(79, 57, 29);
}

/* Admin Preferences Button & Panel */
#floating-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.3s;
    z-index: 100;
    background-color: rgb(243, 185, 108);
}

#floating-button:hover {
    background-color: burlywood; 
    transform: scale(1.05); 
}

#preferences-panel {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 70px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    width: 250px;
}

#preferences-panel h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #333;
}

#preferences-panel label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#preferences-panel select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#preferences-panel button {
    width: 100%;
    background-color: burlywood;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 5px 0px;
}

#preferences-panel button:hover {
    background-color: rgb(179, 142, 94);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 15px;
}

.user-name {
    color: black;
    font-weight: bold;
    font-size: 14px;
}

.user-role {
    color: black;
    font-size: 12px;
}

.home-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-left: 20px;
}

.home-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.logo-home-container {
    display: flex;
    align-items: center;
}

/* Table of Contents Sidebar */
.toc-sidebar {
    position: absolute;
    left: 0;
    top: 120px;
    width: 200px;
    background-color: var(--blog-background);
    padding: 20px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    z-index: 1000;
}

.toc-sidebar h2 {
    font-size: 18px;
    margin-top: 0;
    color: var(--text-color);
}

.toc-sidebar ul {
    list-style: none;
    padding: 0;
}

.toc-sidebar ul li {
    margin: 10px 0;
}

/* Main content */
main {
    margin-left: 220px;
    padding: 20px;
    min-height: calc(100vh - 170px);
    padding-bottom: 170px;
}

/* Responsive YouTube iframe wrapper */
.ytiframe {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; 
    height: 0;
}

.ytiframe iframe {
    position: absolute;
    top:0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Media Queries */
@media (max-width: 768px) {
    .blog-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .filter-bar {
        flex-direction: column;
        align-items: center;
    }

    main {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .blog-container {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: center;
    }

    .blog h2 {
        font-size: 1.2rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: 40px;
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor; /* So the icon inherits the text color */
}

.share-btn:hover {
    background-color: #d2b48c; /* Slightly darker shade of burlywood */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.share-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.blog-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-color);
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-right: 10px; /* space out from other buttons if needed */
}

.blog-buttons a:hover {
    background-color: #d2b48c; /* Slightly darker shade of burlywood */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.blog-buttons a:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* Horizontal Layout for the blog container */
.blog-container.horizontal {
    display: flex; /* Flex layout for horizontal alignment */
    flex-direction: column; /* Stack rows of blogs */
    gap: 20px;
    align-content: flex-start; /* Align items to the top */
}

/* Horizontal layout for individual blogs */
.blog-container.horizontal .blog {
    display: grid; /* Set each blog as a grid */
    grid-template-columns: 2fr 1fr; /* Video takes 2 parts, buttons 1 part */
    gap: 10px;
    align-items: center;
}

.blog-container.horizontal .blog h2 {
    grid-column: 1 / -1; /* Title spans across all columns */
    text-align: left;
    margin-bottom: 10px;
}

.blog-container.horizontal .blog .youtube-video,
.blog-container.horizontal .blog video {
    grid-column: 1 / 2; /* Video spans the first column */
    width: 100%;
    height: auto;
    object-fit: cover;
}

.blog-container.horizontal .blog-content p {
    grid-column: 1 / -1; /* Description spans across columns */
    text-align: left;
    margin: 10px 0;
}

.blog-container.horizontal .blog-buttons {
    grid-column: 2 / 3; /* Buttons span the second column */
    display: flex; /* Use flex for vertical alignment */
    flex-direction: column; /* Stack buttons vertically */
    gap: 10px; /* Add spacing between buttons */
    align-items: flex-start; /* Align buttons to the left */
}

.blog-container.horizontal .blog-buttons a:hover {
    background-color: #0056b3;
    color: white;
}

.blog-container.horizontal .blog:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* YouTube video styling */
.youtube-video {
    width: 100%;
    height: 0;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    padding-top: 56.25%;
}

.youtube-video iframe {
    display: block;
    border: none;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Adjust for buttons when horizontal */
.horizontal .blog-buttons {
    justify-self: start;
    align-items: flex-start;
}
