/* ================================
   1. Theme Variables
================================= */
/* Define color variables for light and dark themes */
:root {
    --social-icon-color: #555;
    --social-icon-hover-color: #007bff;
    --social-media-bg: #f8f9fa;
    --social-media-text-color: #212529;
}

[data-bs-theme="dark"] {
    --social-icon-color: #bbb;
    --social-icon-hover-color: #66b2ff;
    --social-media-bg: #1c1c1c;
    --social-media-text-color: #ffffff;
}

/* ================================
   2. Social Media Styles
================================= */
.social-icon {
    color: var(--social-icon-color);
    transition: color 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.social-icon:hover {
    color: var(--social-icon-hover-color);
    transform: scale(1.1);
}

.social-media {
    background-color: var(--social-media-bg);
    color: var(--social-media-text-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ================================
   3. Dark Mode Utilities
================================= */
.dark-mode {
    background-color: #121212;
    color: #ffffff;
}

[data-bs-theme="dark"] .footer-bg {
    background-color: #333 !important;
    color: #fff !important;
}

.footer-bg {
    background-color: #f8f9fa; /* Default Bootstrap light mode background color */
}

/* ============ Thread titles (inherit text color) ============ */
.thread-title-link{
  color: inherit !important;
  text-decoration: none;
}

.thread-title-link:hover,
.thread-title-link:focus{
  text-decoration: underline;
}


/* ================================
   4. Typography and Sizing
================================= */

.nav-link-icon {
    margin-right: 8px;
}

/* ================================
   5. Navbar Styles
================================= */
/* Align dropdown menus to the right */
.dropdown-menu {
    min-width: 200px; /* Ensure a consistent width */
    text-align: right;
}

.navbar {
    transition: transform 0.3s ease-in-out;
}

/* Light mode navbar styles */
[data-bs-theme="light"] .navbar {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .navbar a {
    color: #212529 !important;
}

/* Dark mode navbar styles */
[data-bs-theme="dark"] .navbar {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .navbar a {
    color: #f8f9fa !important;
}

/* Adjust positioning for smaller screens (iPad, Mobile) */
@media (max-width: 768px) {
    .navbar {
        top: auto; /* Remove top positioning */
        bottom: 0; /* Move navbar to the bottom */
        text-align: right;
    }
}

.theme-icon-active {
    color: currentColor; /* Ensures the icon color changes based on the text color */
}

[data-bs-theme="dark"] .theme-icon-active {
    color: #fff;
}

[data-bs-theme="light"] .theme-icon-active {
    color: #000;
}

/* ================================
   6. Back to Top Button
================================= */
#backToTopBtn {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed position */
    bottom: 80px; 
    right: 30px; /* 30px from the right */
    z-index: 1000; /* Ensure it's above other content */
    font-size: 18px;
    border: none;
    outline: none;
    cursor: pointer;
    width: 50px;  /* Ensuring the button is circular */
    height: 50px; /* Equal height for circular shape */
    padding: 0;   /* Remove extra padding */
    border-radius: 50%; /* Make it circular */
    background-color: #007bff; /* Bootstrap primary color */
    color: white;
}

#backToTopBtn:hover {
    background-color: #0056b3; /* Darker shade on hover */
}

@media only screen and (max-width: 600px) {
    #backToTopBtn {
        bottom: 80px; /* Adjust button positioning for small screens */
        right: 20px;
        width: 45px;   /* Adjust size for smaller screens */
        height: 45px;
        font-size: 16px;
    }
}

/* ================================
   7. Layout Adjustments
================================= */
.main-offset-top {
    margin-top: 70px;
}

/* ================================
   8. Profile Photos and Avatars
================================= */
.profile-photo,
.avatar-photo {
    width: 75px;
    height: 75px;
    object-fit: cover;
}

/* ================================
   9. Thread and Category Cards
================================= */
.thread-card,
.category-card {
    position: relative;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    min-height: 300px;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.thread-card .card-body,
.category-card .card-body {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ================================
   10. Fixed Heights for Containers
================================= */
/* Fixed Heights for Text Containers */
.fixed-height-text {
    min-height: 3em; /* Adjust based on expected content */
}

/* Fixed Flex Containers */
.fixed-flex-container {
    min-height: 60px; /* Adjust based on content */
}

/* ================================
   11. Category Titles and Descriptions
================================= */
.category-title,
.thread-title {
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.25rem;
}

.category-description,
.card-text {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    font-size: 1rem;
    color: white;
}

.card-title {
    color: white;
}

.category-stats {
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ================================
   12. Banner Image
================================= */
.banner-image {
    max-width: 100%;
    height: auto;
}

/* ================================
   13. Newsletter Subscription Form
================================= */
.newsletter-subscription .input-group {
    max-width: 400px;
}

/* ================================
   14. Toast Container Positioning
================================= */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1050; /* Above other content */
}

/* ================================
   15. Navbar Buttons
================================= */
.navbar-buttons .btn {
    min-width: 80px;
    min-height: 40px;
    position: relative;
}

.navbar-buttons .btn .badge {
    position: absolute;
    top: -5px;
    right: -10px;
    transform: translate(50%, -50%);
}

/* ================================
   16. Jumbotron
================================= */
.fixed-jumbotron {
    min-height: 300px; /* Adjust based on content */
}

/* ================================
   17. Social Icons
================================= */
.social-icon i {
    transition: transform 0.3s;
}

.social-icon:hover i {
    transform: scale(1.1);
}

/* ================================
   18. General Card Styles
================================= */
.card-link {
    text-decoration: none;
}

.card-link:hover .thread-card,
.card-link:hover .category-card {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* ================================
   19. Placeholder Styles (if implemented)
================================= */
.placeholder-card {
    background-color: #e0e0e0;
}

.placeholder-text,
.placeholder-title,
.placeholder-date,
.placeholder-category,
.placeholder-avatar {
    background-color: #c0c0c0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.placeholder-text {
    height: 1.2em;
}

.placeholder-title {
    height: 1.5em;
}

.placeholder-date {
    width: 60px;
    height: 1em;
}

.placeholder-category {
    width: 80px;
    height: 1em;
}

.placeholder-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}



/* Select2 dark-mode support (Bootstrap 5 variables) */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__rendered {
  color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--bs-secondary-color);
}

/* Focus ring */
html[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

/* Dropdown panel + search */
html[data-bs-theme="dark"] .select2-container .select2-dropdown {
  background-color: var(--bs-body-bg);
  border-color: var(--bs-border-color);
}
html[data-bs-theme="dark"] .select2-container .select2-search__field {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
}
html[data-bs-theme="dark"] .select2-container .select2-results__option {
  color: var(--bs-body-color);
  background-color: transparent;
}
html[data-bs-theme="dark"] .select2-container .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--bs-primary);
  color: #fff;
}
/* “No results found” message */
html[data-bs-theme="dark"] .select2-results__message {
  color: var(--bs-secondary-color);
}

/* Disabled state */
html[data-bs-theme="dark"] .select2-container--default.select2-container--disabled .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default.select2-container--disabled .select2-selection--multiple {
  background-color: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  border-color: var(--bs-border-color);
}

/* Keep width sane */
.select2-container { width: 100% !important; }

/* Chips (usuarios seleccionados) en Select2 múltiple — modo oscuro */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

/* El chip/pill */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: rgba(var(--bs-primary-rgb), .15); /* sutil con el tema */
  color: var(--bs-body-color);                       /* texto legible */
  border-color: var(--bs-border-color);
}

/* Texto del chip (por si Select2 lo envuelve en un span) */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple 
  .select2-selection__choice .select2-selection__choice__display {
  color: var(--bs-body-color);
}

/* Botón de quitar (x) */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple 
  .select2-selection__choice__remove {
  color: var(--bs-body-color);
  border-right-color: var(--bs-border-color);
  margin-right: .25rem;
}
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple 
  .select2-selection__choice__remove:hover {
  color: var(--bs-danger);
}

/* Campo de búsqueda dentro del múltiple */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple 
  .select2-search__field {
  color: var(--bs-body-color);
}

/* Resultado seleccionado en el dropdown (mantén contraste) */
html[data-bs-theme="dark"] .select2-container .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--bs-primary);
  color: #fff;
}

.chat-preview {
  white-space: normal !important;   /* allow line breaks */
  overflow-wrap: break-word;        /* break long words/URLs */
  word-break: break-word;           /* legacy support */
}
