/* Make body and html elements take full screen, remove scrollbars, and use flexbox layout */
body,
html {
    width: 100%;
    display: flex;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background-color: #333;
    color: white;
}

/* Link Styling*/
a {
    text-decoration: none;
    color: #fff;
}

a:hover {
    text-decoration: none;
    color: #bbb;
}

/* Set max size for icons */
.icon {
    max-width: 40px;
    max-height: 40px;
}

/* Style for fixed header at top of the page */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #666;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px;
    z-index: 10;
    /* Ensure header stays above other content */
}

/* Center the header title horizontally */
header h1 {
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
}

/* Container for search form elements */
.search-wrapper form {
    display: flex;
    align-items: center;
    max-width: 100%;
    margin-bottom: 20px;
}

/* Input styling inside search wrapper */
.search-wrapper input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.4em 0.6em;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    outline: none;
}

/* Styling for form in header */
header form {
    display: flex;
    align-items: center;
}

/* Style for text input inside header */
header input[type="text"] {
    padding: 0.3rem 0.5rem;
    font-size: 1rem;
}

/* Style for button inside header */
header button {
    padding: 0.3rem 0.8rem;
    font-size: 1rem;
    margin-left: 0.5rem;
}

/* Spacer element used to maintain header layout alignment */
.header-spacer {
    width: 150px;
}

/* General heading style */
h1 {
    padding: 20px;
    margin: 0;
}

h2 {
    padding: 20px;
    margin: 0;
}

/* Message container fixed below the header, centered */
.messages {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    /* Above most content */
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual message styling */
.messages li {
    background-color: #333;
    border: 1px solid #ccc;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    opacity: 1;
    transition: opacity 1s ease-out;
    color: white;
    /* Fade out effect */
}

/* Layout for the entire page */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    margin-top: 80px;
    width: 100%;
    box-sizing: border-box;
}

/* Sidebar styling */
.sidebar {
    max-width: 20%;
    min-width: 20%;
    background-color: #555;
    padding: 40px;
    box-sizing: border-box;
    margin-top: 0;
    padding-top: 60px;
    height: 100vh;
    overflow-y: auto;
}

.sidebar i {
    color: #999 !important;
}

/* Profile section in sidebar */
.profile_container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
    margin-bottom: 30px;
}

.profile_picture img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ccc;
    margin-bottom: 0;
}

.profile_details {
    flex: 1;
}

.profile_details p {
    margin: 4px 0;
    font-size: 14px;
    color: white;
}

.profile_details i {
    color: #999;
    margin-right: 6px;
}

.nav-toggle {
    display: none;
}

/* Nav style */
.nav-wrapper {
    position: relative;
    height: 80px;
}

.nav-toggle {
    display: block;
    width: 200px;
    background-color: #666;
    color: white;
    border: none;
    padding: 0.75em;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 0 auto;
    border-radius: 8px;
}

.nav {
    position: relative;
    display: block;
    max-height: 0;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    margin: 0 auto;
    width: 200px;
    border-radius: 8px;
    transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s;
}

.nav.show {
    margin: 0 auto;
    max-height: 500px;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    width: 200px;
    border-radius: 8px;
}

.nav li {
    border-bottom: 1px solid #ddd;
}

.nav li:last-child {
    border-bottom: none;
}

.nav li:first-child {
    border-top: 1px solid #ddd;
}

.nav-link {
    background-color: #666;
    text-align: center;
    text-decoration: none;
    color: white;
}

.nav-link:hover {
    text-decoration: none;
    color: #bbb;
}

.nav-link:active {
    text-decoration: none;
    color: #bbb;
}

/* Navigation list in sidebar */
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li {
    margin-bottom: 12px;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.25s, color 0.25s;
}

.sidebar-nav ul li a i {
    margin-right: 10px;
    font-size: 16px;
    min-width: 20px;
    text-align: center;
    color: #666;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a:focus {
    background-color: #ccc;
    color: black;
    outline: none;
}

.sidebar-nav ul li a:hover i,
.sidebar-nav ul li a:focus i {
    color: black;
}

.sidebar-nav ul li hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

/* Text Muted */
.text-muted {
    font-size: small;
    color: #666 !important;
}

/* Profile Lists */
.list-group-item {
    color: white;
    background: #333;
    border-radius: 8px;
    border: 1px solid #999;
}

/* Main content area */
.content {
    flex-grow: 1;
    padding: 20px;
    box-sizing: border-box;
}

/* Remove list styling globally */
.content,
ul {
    list-style: none;
}

/* Sidebar list styling (possibly redundant) */
.sidebar>ul {
    list-style: none;
}

.sidebar>ul>li {
    width: 80%;
    padding: 5px;
    margin: 5px;
    border: 1px solid black;
}

/* Main content height */
main {
    height: calc(100% - 120px);
}

/* Scrollable container */
.scroll {
    height: 100%;
    overflow-y: auto;
    padding: 1rem 1rem 80px 1rem;
    box-sizing: border-box;
    scrollbar-color: #333 #666;
}

/* Standard card style */
.card {
    display: flex;
    border: 2px solid #999;
    max-width: 80%;
    margin: 20px 10%;
    height: fit-content;
    background: none;
    color: white;
}

/* Smaller card with overflow control and gradient fade */
.card-small {
    display: flex;
    flex-direction: column;
    border: 2px solid #999;
    border-radius: 8px;
    margin: 20px 10%;
    height: 300px;
    max-height: 300px;
    overflow: hidden;
}

.card-inner {
    padding: 20px;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
    background: none;
}

.card-small .card-inner::after {
    content: "";
    pointer-events: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(#ffffff00, #333);
}

/* Footer section for cards */
.card-footer {
    margin: 0 auto;
    padding: 10px 20px;
    background: #333;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 95%;
}

/* Full-width card layout */
.card-full {
    display: flex;
    flex-direction: column;
    border: 2px solid #999;
    border-radius: 8px;
    max-width: 80%;
    margin: 20px 10%;
}

/* Comments container */
.comments {
    display: flex;
    margin: 20px 10%;
    max-width: 80%;
    height: fit-content;
}

/* Individual comment style */
.comment {
    width: 100%;
    background-color: #333;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #999;
}

.comment-thread {
    margin-bottom: 1rem;
    border-left: 3px solid transparent;
}

/* Indented replies */
.reply-thread {
    margin-left: 20px;
    border-left: 3px solid #ccc;
    padding-left: 15px;
}

/* Nested reply comment box */
.comment-reply {
    width: 100%;
    background-color: #333;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.replies-container {
    margin-top: 0.5rem;
}

/* Toggle replies link/button */
.toggle-replies {
    cursor: pointer;
}

/* Utility class to float elements right */
.right {
    float: right;
}

/* Limit editor width inside modal */
.modal .note-editor {
    max-width: 100%;
    width: 100%;
}

.modal-content {
    background-color: #333;
    color: white;
}

/* Button styling */
.btn {
    border: 1px solid #999;
    background: none;
    color: #999;
}

/* Search Button */
.search-btn {
    background-color: #666;
    color: #333;
    border: 1px solid #333;
}

/* Link-style button */
.btn-link {
    text-decoration: none;
    color: #999;
}

/* Hover state for buttons */
.btn:hover {
    border: 1px solid #999;
    color: white;
    background-color: #ccc;
}

/* Specific hover styles for edit buttons */
#edit-post-btn:hover,
.edit-comment-btn:hover {
    border: 1px solid #999;
    color: white;
    background-color: #666;
}

/* Reply button hover effect */
.reply-btn:hover {
    color: black;
}

/* Danger button styling */
.btn-danger {
    background: none;
    color: red;
}

.btn-danger:hover {
    background-color: red;
    color: white;
}

/* Favorite button styling */
.fav-btn {
    background: none;
    border: none;
    padding: 10px;
    font-size: 1.25rem;
    color: #666;
}

.fav-btn:hover {
    border: none;
    color: gold;
    background: none;
    opacity: 0.8;
}

/* Like button hover state */
.like-btn:hover {
    color: white;
    background-color: #ccc;
}

/* Text color utility classes */
.gold {
    color: gold;
}

.black {
    color: #666;
}

.blue {
    color: white;
}

/* Profile picture sizes */
.profile_picture {
    max-width: 100px;
    max-height: 100px;
}

.profile_picture_small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 20px;
    border: 2px solid #ccc;
}

.profile_picture_main {
    max-width: 250px;
    max-height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ccc;
    margin-bottom: 0;
}

/* Post listing container */
.post-list {
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Signup form styling */
#signup_form {
    width: 80%;
    margin: 0 auto;
}

/* Label styling */
label {
    width: 40%;
    margin-bottom: 0;
}

/* Checkbox styling */
.form-check input[type="checkbox"] {
    width: 1.2em;
    height: 1.2em;
}

/* Input styling */
input,
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-sizing: border-box;
}

/* Input focus styling */
input:focus,
select:focus,
textarea:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Inline checkbox labels */
.checkbox-inline label {
    width: auto;
    margin-bottom: 0;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.checkbox-inline input[type="checkbox"] {
    width: 1.2em;
    height: 1.2em;
    margin: 0;
    display: inline-block;
}

.checkbox-inline {
    gap: 0.5rem;
}

#id_profile_picture {
    color: white;
    background-color: #333;
}

/* Footer styling: full width, fixed at bottom, bisque background, centered text */
footer {
    width: 100%;
    position: absolute;
    /* Fix footer at bottom of the page */
    bottom: 0;
    background-color: #666;
    text-align: center;
    padding: 10px;
    z-index: 10;
    /* Ensures footer stays above other content */
}

footer>p {
    margin: 0;
}

/* Hamburger menu button - initially hidden and positioned top-right */
.hamburger {
    position: absolute;
    top: 20px;
    right: 20px;
    display: none;
    /* Hidden by default, shown on small screens */
    font-size: 1.8rem;
    background: none;
    /* No background */
    border: none;
    /* No border */
    cursor: pointer;
    /* Pointer cursor on hover */
    color: black;
    z-index: 16;
    /* Higher than footer to stay on top */
}

/* Hamburger inside header: vertically center it, position at right */
header .hamburger {
    position: absolute;
    top: 50%;
    /* Vertically center relative to header */
    right: 20px;
    transform: translateY(-50%);
    /* Adjust vertical centering */
}

/* Pagination container - flexbox to center items, nowrap to prevent line breaks */
.pagination {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.3rem;
    /* Spacing between pagination items */
    white-space: nowrap;
    /* Prevent line breaks */
}

/* Pagination list styling: flex wrap allows wrapping on smaller screens */
ul.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    padding-left: 0;
    /* Remove default list padding */
    list-style: none;
    /* Remove bullets */
    margin: 0 auto;
    /* Center the list */
    max-width: 100%;
    /* Limit width to container */
}

/* Pagination list items: flexible sizing with horizontal margin */
ul.pagination li {
    flex: 0 1 auto;
    /* Allow shrinking/growing but keep natural size */
    margin: 0 0.2rem;
}

/* Pagination Styling */
.page-link {
    color: #999;
    background: none;
    border: 1px solid #999;
}

.active>.page-link {
    color: white;
    background: #666;
    border: 1px solid #999;
}

/* Ensure Summernote popovers and toolbars display correctly inside Bootstrap modals */
.note-popover,
.note-editor {
    z-index: 1056 !important;
    /* Bootstrap modal z-index is 1055 */
}

body.medium-layout .sidebar {
    padding: 30px 8px 0 8px;
}

/* Responsive styles for smaller devices (up to 768px) */
body.mobile-layout html {
    font-size: smaller;
}

body.mobile-layout a {
    text-decoration: underline;
}

body.mobile-layout .post-list {
    margin-left: auto;
    margin-right: auto;
    padding-left: 10px;
    padding-right: 10px;
    width: 100%;
    box-sizing: border-box;
}

body.mobile-layout .list-group-item {
    width: 100%;
}

body.mobile-layout .icon {
    margin-left: 20px;
}

body.mobile-layout .card {
    width: 100%;
}

body.mobile-layout .card-small {
    margin: 0;
}

body.mobile-layout header {
    justify-content: flex-start;
    padding: 0;
}

body.mobile-layout .header-spacer {
    width: 0;
}

body.mobile-layout header h1 {
    position: static;
    transform: none;
    text-align: left;
    margin-left: 20px;
    font-size: 1.5rem;
}

body.mobile-layout ul.pagination {
    justify-content: center;
}

body.mobile-layout ul.pagination li {
    flex-basis: 5%;
    text-align: center;
    margin-bottom: 0.4rem;
}

body.mobile-layout .sidebar {
    position: fixed;
    top: 80px;
    right: 0;
    left: auto;
    transform: translateX(100%);
    width: 60vw;
    height: calc(100% - 80px);
    z-index: 15;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    max-width: none;
}

body.mobile-layout .sidebar.open {
    transform: translateX(0);
}

body.mobile-layout .hamburger {
    display: block;
}

body.mobile-layout .page-wrapper {
    flex-direction: column;
    padding: 0;
    margin: 0;
}

body.mobile-layout .content {
    margin-top: 30px;
    margin-bottom: 60px;
    margin-left: 0;
    max-width: 100%;
}

body.mobile-layout #sidebar-overlay {
    display: none;
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100% - 80px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 14;
}

body.mobile-layout #sidebar-overlay.active {
    display: block;
}

/* Responsive tweaks for very small devices (up to 480px) */
body.mobile-layout .search-wrapper input[type="text"] {
    font-size: 0.9rem;
    padding: 0.3em 0.4em;
}

body.mobile-layout .search-wrapper button {
    padding: 0.3em 0.6em;
    font-size: 0.9rem;
}
