/* static/css/style.css */

/* Define CSS Variables for Colors */
:root {
    --primary-color: #00443c; /* Primary green */
    --secondary-color: #6c757d; /* Example: Bootstrap secondary grey */
    --dark-color: #636363;
    --white-color: #ffffff; /* White color for text and backgrounds */
    --bg-color: #f4f7f6; /* Light background color */
    --grey-card-color: #f0f0f0; /* Example: Light grey for dark mode cards */

    --navbar-bg-color: var(--primary-color); /* Navbar background uses the primary color */
    --navbar-text-color: #ffffff; /* Keep text white for the dark primary background */

    --sidebar-bg-color: #f8f9fa; /* Example: Bootstrap light grey */
    --sidebar-text-color: #333; /* Example: Dark text */
    --sidebar-heading-color: #6c757d; /* Example: Muted text */

    --link-color: var(--primary-color); /* Links use primary color by default */
    --link-hover-color: #c8cecd; /* A slightly darker shade of #02871e (green) for hover */

    --border-color: #dee2e6; /* Example: Bootstrap border color */

    /* Add variables for card styling if needed */
    --card-bg-color: #ffffff; /* White background for cards */
    --card-border-radius: 0.5rem; /* Standard Bootstrap border radius */
    --card-shadow: 0 .125rem .25rem rgba(0,0,0,.075); /* Standard Bootstrap shadow */
}

/* Apply padding to body to prevent content from being hidden by fixed navbar */
body {
    padding-top: 60px; /* Adjust this value based on navbar height */
    color: var(--sidebar-text-color); 
}

/* Style the fixed navbar using variables */
.navbar {
    background-color: var(--navbar-bg-color) !important;
    color: var(--navbar-text-color);
    padding-top: 0.4rem; /* Adjust padding as needed */
    padding-bottom: 0.5rem; /* Adjust padding as needed */
}

/* Style navbar brand and links using variables */
.navbar-brand {
    color: var(--navbar-text-color) !important;
}

.navbar .nav-link {
    color: var(--navbar-text-color) !important;
    padding-top: 0.25rem !important; /* Reduce padding to make navbar less tall */
    padding-bottom: 0.25rem !important; /* Reduce padding to make navbar less tall */
    line-height: normal; /* Ensure consistent line height */
}

.navbar .nav-link:hover {
    color: rgba(255, 255, 255, 0.75) !important;
}

.navbar-nav {
    flex-direction: row; /* Override Bootstrap's column direction */
}

.navbar-nav .nav-item {
    display: flex; /* This should override display: block */
    align-items: center; /* Vertically align content */
}

/* Styling for the username container and icon in the navbar */
.username-container {
    display: flex;
    align-items: center;
    white-space: nowrap; /* Prevent wrapping */
}

.username-container .fa-user {
    font-size: 0.9em; /* Adjust icon size relative to username text */
    color: var(--navbar-text-color); /* Use navbar text color */
    margin-right: 5px; /* Space between icon and username */
}

/* Ensure dropdowns within the navbar are positioned correctly */
.navbar .dropdown-menu {
    position: absolute;
    /* Other positioning properties like top, right, left, will be handled by Bootstrap's dropdown-menu-end */
}

/* Style the sidebar using variables */
.sidebar {
    position: fixed;
    top: 56px; /* Position below the fixed navbar (adjust if navbar height changes) */
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--sidebar-bg-color);
}

.sidebar .nav-link {
    font-weight: 500;
    color: var(--sidebar-text-color);
    padding: .5rem 1rem;
}

.sidebar .nav-link.active {
    color: var(--primary-color);
}

.sidebar .nav-link:hover {
     color: var(--link-hover-color);
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
    padding: .5rem 1rem;
    color: var(--sidebar-heading-color);
}

/* Style the main content area */
main {
    margin-left: 220px; /* Adjust margin to make space for sidebar width */
    padding: 20px; /* Add some padding inside the main content area */
    padding-top: 20px; /* Ensure padding top below the fixed header */
}

/* Adjust main content margin for smaller screens if sidebar collapses */
@media (max-width: 767.98px) {
    main {
        margin-left: 0;
    }
}

/* Style the main heading area using variables */
.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom {
    border-bottom: 1px solid var(--border-color) !important;
}

/* Style headings using variables (optional) */
h1, h2, h3, h4, h5, h6 {
    color: var(--sidebar-text-color);
}

a {
    color: var(--link-color);
}

a:hover {
    color: var(--link-hover-color);
}

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

.header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--sidebar-text-color);
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    color: var(--sidebar-text-color);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    color: var(--sidebar-text-color); 
}

/* Styles for the video grid and cards (will be used on list_videos_by_figure.html) */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.video-card {
    background: var(--card-bg-color);
    border-radius: var(--card-border-radius); 
    overflow: hidden;
    box-shadow: var(--card-shadow); 
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
}

.video-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0,0,0,0.2); 
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 250px;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.play-overlay::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid var(--sidebar-text-color); 
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

.video-card:hover .play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255,255,255,1);
}

.duration-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.video-info {
    padding: 2rem;
}

.video-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--sidebar-text-color); 
    line-height: 1.3;
}

.video-description {
    color: #666; 
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color); 
}

.leader-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leader-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color)); 
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.leader-name {
    font-weight: 600;
    color: var(--sidebar-text-color);
}

.view-count {
    color: #888;
    font-size: 0.9rem;
}

.category-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255,255,255,0.9);
    color: var(--sidebar-text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .container {
        padding: 1rem;
    }

    .video-info {
        padding: 1.5rem;
    }
}
.card {
    border: none;
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
}

.card-title {
    color: var(--primary-color); 
}

.card-text {
    color: #555; 
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-primary:hover {
    background-color: var(--link-hover-color) !important;
    border-color: var(--link-hover-color) !important;
}
/* Responsive Navbar Styles */
@media (max-width: 991.98px) {
    .navbar-nav {
        flex-direction: column; /* This is the key change for vertical layout */
        align-items: flex-start;
        width: 100%; /* Make sure the nav items take up the full width */
    }

    /* Ensure the entire collapsed menu has the green background */
    .navbar-collapse {
        width: 100%;
        padding: 0.5rem 0; /* Add some vertical padding */
        align-items: flex-start;
    }

    .navbar-collapse .nav-item {
        width: 100%; /* Ensure nav items take full width */
    }
    
    /* Style all links within the collapsed menu for consistency */
    .navbar-collapse .nav-link {
        color: var(--navbar-text-color) !important; /* Use white text */
        padding: 0.75rem 1.5rem;
        width: 100%;
    }

    /* Style the dropdown menu to be a seamless part of the navbar */
    .navbar-collapse .dropdown-menu {
        position: static !important; /* Makes the dropdown part of the normal document flow */
        width: 100%;
        background-color: transparent; /* Inherit the green background */
        border: none;
        box-shadow: none;
        margin-top: 0;
        padding: 0; /* Remove default padding, we'll style items directly */
    }

    /* Style the individual items within the dropdown */
    .navbar-collapse .dropdown-item {
        color: var(--navbar-text-color); /* Use white text */
        padding: 0.75rem 2.5rem; /* Add more padding to indent sub-items */
    }

    /* Create a consistent hover/focus effect for all links and dropdown items */
    .navbar-collapse .nav-link:hover,
    .navbar-collapse .nav-link:focus,
    .navbar-collapse .dropdown-item:hover,
    .navbar-collapse .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1); /* Subtle white highlight on hover */
    }

    .navbar-nav .ms-auto {
        width: 100%;
    }
    
    /* Style for nested dropdowns to ensure they are also part of the flow */
    .navbar-collapse .dropdown-menu .dropdown-menu {
        padding-left: 1.5rem; /* Deeper indent for sub-items */
    }
}

/* Style for collapsible header icons */
.card-header .btn-link .fas {
    transition: transform 0.3s ease-in-out;
}

.card-header .btn-link[aria-expanded="true"] .fas {
    transform: rotate(0deg);
}

.card-header .btn-link[aria-expanded="false"] .fas {
    transform: rotate(-90deg);
}
/* Custom progress bar styling */
.progress-bar {
    background-color: var(--primary-color) !important;
}
/* Navbar Search polish */
.navbar-search { flex: 0 1 300px; max-width: 400px; }
.navbar-search-inner { position: relative !important; }
.navbar-search .form-control {
  height: 38px;
  line-height: 38px;
  padding-right: 0.5rem;
  border-radius: 999px;
  margin: 0;
}
.navbar-search .btn-link {
  color: inherit;
  opacity: 0.8;
  text-decoration: none;
}
.navbar-search-dropdown {
  position: absolute !important;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  color: #212529;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  z-index: 2000;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.08);
}
.navbar-search-group { padding: 6px 0; }
.navbar-search-group-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c757d;
  padding: 8px 12px;
  text-transform: uppercase;
}
.navbar-search-list { list-style: none; margin: 0; padding: 0; }
.navbar-search-list li[role="option"] {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
}
.navbar-search-list li[role="option"][aria-selected="true"],
.navbar-search-list li[role="option"]:hover { background: #f1f3f5; }
@media (max-width: 991.98px) {
  .navbar-search { flex: 1 1 100%; max-width: none; }
}
/* Hide slides during search without breaking Swiper layout */
.swiper-slide.search-hidden { display: none !important; }
/* Honor Swiper's hidden-slide semantics */
.swiper-slide.swiper-slide-hidden { display: none !important; }
/* Swiper stability during filtering */
.swiper { overflow: hidden; }
.swiper-wrapper { flex-wrap: nowrap !important; }
.swiper-slide { flex-shrink: 0; }
/* Ensure Swiper layout on all containers, including .video-swiper */
.video-swiper { overflow: hidden; }
.video-swiper .swiper-wrapper { display: flex !important; flex-wrap: nowrap !important; height: auto !important; }
.video-swiper .swiper-slide { flex-shrink: 0; }
.video-carousel-section .swiper-wrapper { height: auto !important; } /* defensive for section-scoped wrappers */

/* Keep honoring hidden slides */
.swiper-slide.search-hidden,
.swiper-slide.swiper-slide-hidden { display: none !important; }
/* Styles for like and bookmark buttons */
.like-btn.liked,
.bookmark-btn.bookmarked {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.like-btn.liked {
    background-color: #dc3545;
    border-color: #dc3545;
}

.bookmark-btn.bookmarked {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

/* Hover effects for buttons */
.like-btn:hover,
.bookmark-btn:hover,
.like-btn.liked:hover,
.bookmark-btn.bookmarked:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease-in-out;
}