.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.composer__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.thread__images {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.user-input {
    padding-top: 12px;
    padding-left: 16px;
    display: flex;
    gap: 7px;
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    background-color: var(--background);
    flex-direction: row;
}

.tweet {
    border-bottom: 1px solid var(--secondary);
    padding: 18px;
    display: flex;
    gap: 18px;
    position: relative;
}

.message-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.tweet-actions {
    display: flex;
    justify-content: space-between;
}

.thread__image img {
    max-width: 100%;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 5s;
    margin-bottom: 10px;
    color: grey;
}

.thread__image img:hover {
    opacity: 0.9;
}

.thread__text {
    color: rgb(241, 243, 245);
    font-size: 17px;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tweet-content {
    flex: 1;
    min-width: 0;
}

.tweet-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.content-wrapper {
    flex: 1;
    min-width: 0; /* Allows content to shrink properly */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.timestamp::before {
    margin: 4px 4px;
}

.thread__name,
.thread__timestamp {
    display: inline-block;
    vertical-align: bottom;
    font-weight: normal;
    font-size: 16px;
    color: var(--secondary);
}

.logout-btn {
    background: none;   /* remove button background */
    border: none;       /* remove button border */
    padding: 0;         /* remove extra space */
    cursor: pointer;    /* show pointer cursor */
    color: inherit;     /* inherit text/icon color */
    font-size: 1.2rem;  /* adjust size of icon */
}

.logout-btn:hover {
    color: #cccccc; /* optional hover effect */
}

/* Notification Styles */
.notification-container {
    display: flex;
    align-items: center;
    margin-right: 16px;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: inherit;
    font-size: 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.notification-btn:hover {
    background-color: var(--surface);
    color: #cccccc;
}

.notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.notification-count:empty {
    display: none;
}

.notification-btn.has-notifications {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Inline topic edit control */
.entity-edit {
    position: relative;
    display: inline-block;
}

.entity-edit .entity-edit-btn {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    background: rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--secondary);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.entity-edit .entity-edit-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

.entity-edit .entity-edit-form {
    margin-left: 8px;
    gap: 6px;
    align-items: center;
}

.entity-edit .entity-edit-input {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
}

.entity-edit .entity-edit-save,
.entity-edit .entity-edit-cancel {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
}

.entity-edit .entity-edit-save:hover {
    background: rgba(34,197,94,0.15);
}

.entity-edit .entity-edit-cancel:hover {
    background: rgba(239,68,68,0.15);
}

/* Mobile notification adjustments */
@media (max-width: 768px) {
    .notification-container {
        margin-right: 8px;
    }
    
    .notification-btn {
        padding: 6px;
        font-size: 1.1rem;
    }
    
    .notification-count {
        min-width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* Authentication buttons for unauthenticated users */
.auth_buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.login-btn {
    background: #1d4ed8;
    color: white;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.register-btn {
    background: #1d4ed8;
    color: white;
}

.register-btn:hover {
    background: #3d8bfe;
    border-color: #3d8bfe;
    color: white;
}

.auth-btn i {
    font-size: 12px;
}

.whingeScore {
    font-size: 15px;
    max-width: 300px;          /* or any width */
    text-overflow: ellipsis;
    text-decoration: none;
    padding-top: 2px;
}

.timestamp {
    color: rgb(239, 239, 239);
    font-size: 15px;
    max-width: 300px;          /* or any width */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
}

.website {
    color: var(--background);
    white-space: nowrap;
    display: block;/* keep it on one line */
    font-size: 15px;
    max-width: 40ch;          /* or any width */
    overflow: hidden;
    font-weight: bold;
    padding: 5px 9px;
    border-radius: 20px;
    text-overflow: ellipsis;
    background: var(--secondary);
    text-decoration: none;
    font-family: "Roboto", sans-serif;

}

.timestamp + .timestamp {
    margin-left: 4px;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edit-textarea {
    background-color: #253341;
    border: 1px solid #38444d;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    color: #ffffff;
    font-size: 16px;
    font-family: inherit;
    min-height: 160px;
    resize: none;
    white-space: pre-wrap;
    overflow: auto;       /* scroll if content overflows */
}

.edit-textarea:focus {
    outline: none;
    border-color: #878787;
}

.edit-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.edit-actions button {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-actions button[type="submit"] {
    background-color: #1da1f2;
    color: white;
    border: none;
}

.edit-actions button[type="submit"]:hover {
    background-color: #1a91da;
}

.edit-actions button[type="button"] {
    background: none;
    border: 1px solid #38444d;
    color: #8b98a5;
}

.edit-actions button[type="button"]:hover {
    background-color: #38444d;
    color: #ffffff;
}

.author-info {
    display: flex;
    gap: 1px;
    flex: 1;
}

.username {
    color: rgb(239, 239, 239);
    font-size: 15px;
    font-weight: 600;
}

.tweet-menu {
    background: var(--background);
    position: relative; z-index: 2;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    font-size: x-large;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
}

.tweet-menu:hover {
    background-color: black;
    color: #666868;
}

.dropdown-menu {
    background-color: #353535;
    border: 1px solid #636363;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    padding: 8px 0;
    min-width: 120px; /* shrink width */
    max-width: 160px; /* optional limit */
    position: absolute;
    top: 100%;
    right: 0;
    transform: translateX(-20%);
}

.dropdown-menu.show {
    display: block;
}

.menu-item {
    width: 100%;
    background: none;
    border: none;
    color: #ffffff;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #253341;
}

.menu-item.delete-item {
    color: #f91880;
}

.menu-item.delete-item:hover {
    background-color: rgba(249, 24, 128, 0.1);
}

.menu-icon {
    font-size: 16px;
    width: 20px;
    display: flex;
    justify-content: center;
}

.container {
    display: grid;
    row-gap: 15px;
    column-gap: 1px;
    grid-template-columns: auto 32px;
    grid-template-areas: "header sidemenu"
}

.container-content {
    display: flex;
    row-gap: 15px;
    flex-direction: column;
}

.container.no-images {
    grid-template-rows: 25px auto auto 40px 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "whinge whinge"
        "reference reference"
        "footer footer";
}

.container.no-reference {
    grid-template-rows: 25px auto auto auto 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "image auto"
        "whinge whinge"
        "footer footer";
}

.container.no-whinge-score {
    grid-template-rows: 25px auto auto auto 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "image image"
        "reference reference"
        "footer footer";
}

.container.no-reference.no-images {
    row-gap: 5px;
    grid-template-rows: 25px auto auto 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "whinge whinge"
        "footer footer";
}

.container.no-images.no-whinge-score {
    grid-template-rows: 25px auto auto 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "reference reference"
        "footer footer";
}

.container.no-reference.no-images.no-whinge-score {
    grid-template-rows: 25px auto 20px;
    grid-template-areas:
        "header sidemenu"
        "main auto"
        "footer footer";
}

.create-post-form {
    padding-left: 5px;
    display: grid;
    row-gap: 1px;
    grid-template-columns: auto 32px;
    grid-template-rows: 20px auto auto 20px 20px;
    grid-template-areas:
    "header sidemenu"
    "main main"
    "image image"
    "time time"
    "footer footer";
}

.header-1 {
    grid-area: header;
    display: flex;
}

.author-info {
    grid-area: header;
    display: flex;
}

.whinge {
    grid-area: whinge;
    display: flex;
    font-weight: 900;
    color: var(--secondary);
    margin-bottom: 5px;
}

.reference{
    grid-area: reference;
    display: flex;
    gap: 0.3em;
    align-items: center;
    padding: 8px 0;
}

.meta_data {
    display: flex;
    align-content: center;
}

.header-2 {
    grid-area: header;
    display: flex;
    align-items: center;  /* vertically center content */
    justify-content: space-between; /* space between username and gauges */
    top: 0;          /* pin to the top */
    left: 0;
    width: 100%;
    height: 40px;/* full width */
    z-index: 1000;   /* keeps it above other elements */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* subtle shadow */
}

.gauges i {
    cursor: pointer;
}

.main {
    grid-area: main;
    display: table;
    color: var(--primary);
    font-size: 15px;
    line-height: calc(1.4 * 1em);
    white-space: pre-wrap;
    font-weight: 400;
    cursor: pointer;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.main strong {
    font-weight: bold;
    color: var(--primary);
}

.footer {
    grid-area: footer;
}

.editor {
    grid-area: sidemenu;
    position: relative;
}

.time {
    grid-area: time;
    color: var(--secondary);
    font-size: 14px;
}

.container > .thread__image {
    grid-area: image;
}

.container > .thread__images {
    grid-area: image;
}

.container > .thread__youtube {
    grid-area: image;
}

/* Hide images area when container has no-images class */
.container.no-images > .thread__images,
.container.no-images > .thread__image,
.container.no-images > .thread__youtube {
    display: none;
}

/* Ensure solve-form doesn't affect grid layout */
.container .solve-form {
    position: fixed !important;
    grid-area: unset !important;
    display: none !important;
}

/* Hide solve-form from grid layout completely */
.container > .solve-form {
    display: none !important;
    grid-area: unset !important;
    position: fixed !important;
}


/* Wrapped image layout for threads - no horizontal scroll */
.thread .thread__images,
.container .thread__images {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 8px 0 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Hide original images in a tweet when editing */
.is-editing .thread__images[data-tweet-id],
.is-editing .thread__image[data-tweet-id] {
    display: none !important;
}

/* YouTube Video Styling */
.thread__youtube {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
}

.thread__youtube iframe {
    width: 100% !important;
    height: 315px;
    border: none;
    border-radius: 8px;
    max-width: 100%;
}

/* Inline YouTube embeds (from content) */
.thread__youtube-inline {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.thread__youtube-inline iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 8px;
}

/* Responsive YouTube videos */
@media (max-width: 768px) {
    .thread__youtube iframe {
        height: 200px;
    }
    
    /* Mobile text wrapping improvements */
    .main {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
        -ms-hyphens: auto;
        max-width: 100%;
        width: 100%;
    }
    
    /* Ensure containers don't overflow */
    .tweet {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .tweet-content {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Fix text overflow issues on mobile */
    .website {
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        max-width: 100% !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }
    
    .whingeScore {
        max-width: 100% !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .author-info {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .author_alias {
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        max-width: 100%;
        overflow: visible !important;
    }
    
    .time {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        max-width: 100%;
    }
    
    /* Ensure all text elements wrap properly */
    span, a, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* Hide reaction button text on mobile, show only icons */
    .thread__action span:not(.reaction-count) {
        display: none !important;
    }
    
    .reaction_annotation {
        display: none !important;
    }
    
    /* Adjust reaction button spacing for mobile */
    .thread__action {
        padding: 8px 12px;
        min-width: 44px; /* Ensure touch-friendly size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .thread__action i {
        font-size: 16px;
    }
    
    /* Adjust reaction counts */
    .reaction-count {
        font-size: 12px;
        margin-left: 4px;
    }
    
    /* Hide scroll bars on mobile */
    * {
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE and Edge */
    }
    
    *::-webkit-scrollbar {
        display: none !important; /* Chrome, Safari, Opera */
    }
    
    /* Images wrap on mobile - no horizontal scroll */
    .thread__images {
        overflow: hidden !important;
        flex-wrap: wrap !important;
    }
    
    .thread__images::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Adjust tweet-menu positioning on mobile */
    .tweet-menu {
        margin-right: 16px !important; /* Add spacing from right edge */
        margin-left: auto !important; /* Push to right side */
    }
    
    /* Ensure editor container has proper spacing */
    .editor {
        padding-right: 8px !important; /* Add padding to prevent overlap */
        margin-right: 8px !important; /* Additional margin from screen edge */
    }
}

.thread__images .thread__image {
    position: relative;
    display: block !important;
    box-sizing: border-box;
    flex: 1 1 calc(50% - 4px); /* Two images per row with gap */
    min-width: 0; /* Allow flex items to shrink */
    max-width: calc(50% - 4px); /* Ensure max 2 per row */
}

/* For 3-4 images, make them smaller */
.thread__images .thread__image:nth-child(n+3) {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
}

.thread__images .thread__image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    display: block !important;
    margin-bottom: 0 !important; /* Override single image margin */
    float: none !important; /* Ensure no float interference */
}

/* Edit-mode remove button overlay */
.thread__images .thread__image .remove-image {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 16px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
}

.thread__images .thread__image .remove-image:hover {
    background: rgba(0,0,0,0.75);
}



.back-button {
    display: block;
    width: 40px;
    height: 40px;
    border: 2px solid #333;
    border-radius: 50%;
    background-color: var(--functional);
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* Arrow */
.back-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    border-top: 2px solid #333;
    border-left: 2px solid #333;
    transform: translate(-25%, -50%) rotate(-45deg);
}

/* Hover effect */
.back-button:hover {
    background-color: #f0f0f0;
}