*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./assets/font/PoiretOne-Regular.ttf') format('truetype');
}

html {
    font-family: "Poiret One";
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

p {
    text-wrap: pretty;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

#root, #__next {
    isolation: isolate;
}

.container {
    display: grid;
    grid-template-areas: "menu header extras"
        "menu content extras"
        "menu content extras"
        "footer footer footer";
    grid-template-columns: 1.5fr 5fr 1.5fr;
    grid-template-rows: 1fr 1fr 100vh 5fr;
}

.photo {
    width: 50px;
    height: 50px;
}

.header {
    grid-area: header;
    display: flex;
    gap: 1px;
    text-align: center;
    box-shadow: 0 8px 3px -3px rgb(170, 169, 169);
    font-size: 2.5vh;
    background: linear-gradient(to top, rgb(170, 169, 169), white);
}

.header button {
    flex: 1 1 0;
    border: 0;
    background-color: white;
    color: black;
}

.header button:hover {
    opacity: 50%;
    transform: translateY(-4px);
    transition-duration: 0.1s;
}


.footer {
    grid-area: footer;
    text-align: center;
    background-color: black;
    color: white;
    align-content: space-evenly;
    font-size: 2vh;
    font-weight: bold;
    padding: 20px;
}

.message {
    border: solid black 1px;
    margin: 10px;
    padding: 10px;
}

#input-send-message {
    display: flex;
    flex-direction: column;
}

.menu {
    grid-area: menu;
    display: flex;
    flex-direction: column;
    padding: 3vh;
    gap: 3vh;
    background-color: black;
    color: white;
    font-size: 2vh;
    box-shadow: 4px 0px 3px rgb(182, 181, 181);
    background: linear-gradient(to bottom, black 55%, white);
}

.content {
    grid-area: content;
    padding: 20px;
    position: relative;
}

#login-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#login-display label {
    font-weight: bold;
}

.logo {
    display: flex;
    gap: 4vh;
    flex-direction: column;
    padding: 20px;
    padding-bottom: 0;
    font-size: 2.5vh;
    grid-area: dashboard;
    background-color: black;
    color: white;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.menu ul {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 20px;
    font-size: 2.5vh;
    padding: 0;
    display: none;
}

ul li {
    padding-left: 2vh;
    padding-right: 2vh;
    align-content: center;
    font-size: 3vh;
    height: 8vh;
}

ul li a {
    text-decoration: none;
    color: white;
}

ul li:hover {
    opacity: 50%;
    transform: translateY(-3px);
    transition-duration: 0.2s;
}

.loginButton {
    background-color: transparent;
    color: white;
    border: solid rgb(255, 255, 255) 1px;
    height: 4vh;
    font-size: 2vh;
    font-weight: bold;
    border-radius: 6px;
}

.loginButton:hover {
    opacity: 50%;
    transform: translateY(-3px);
    transition-duration: 0.2s;
}

#username {
    font-weight: bold;
    text-indent: 10px;
    border-radius: 6px;
}

#password {
    font-weight: bold;
    text-indent: 10px;
    border-radius: 6px;
}

.pfpDiv {
    height: 17vh;
    width: 17vh;
    background-color: white;
    border-radius: 100vh;
    display: none;
}

.extras {
    grid-area: extras;
    padding: 2vh;
    padding-top: 3vh;
    display: flex;
    flex-direction: column;
    gap: 3vh;
    box-shadow: -4px 0px 6px rgb(182, 181, 181);
}

.extras > div {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    max-height: 40vh;
    display: none;
}

.extras > div > div {
    flex: 1 1 0;
    box-shadow: 4px 4px 6px rgb(182, 181, 181);
}

.extras > div > h1 {
    text-wrap: nowrap;
}

#input-send-message > div:first-of-type {
    display: flex;
    flex-direction: column;
}

#input-send-message > div > div:first-of-type {
    margin-top: 0.5vh;
    display: flex;
}

#input-send-message button {
    align-self: flex-end;
    border-radius: 6px;
    border: solid black 1px;
    background-color: black;
    color: white;
}

#input-send-message button:hover {
    transform: translateY(-3px);
    opacity: 50%;
    transition-duration: 0.3s;
}

#sendMsg {
    width: 100%;
    min-height: 10vh;
    resize: none;
    text-indent: 5px;
    border-radius: 6px;
    padding: 5px;
}

#remainingChars {
    text-align: left;
    flex: 1 1 0;
}

.followersCheck {
    display: flex;
    flex-direction: row;
    gap: 1vh;
}

#followers-only {
    accent-color: black;
}

#main-text-display {
    flex: 1 1 0;
    overflow: auto;
    max-height: 75vh;
}

.message {
    border-radius: 6px;
}

.messageContent {
    margin-top: 10px;
    margin-bottom: 10px;
}

.messageHeader {
    display: flex;
}

.messageHeader div h5 a {
    text-decoration: none;
    color: black;
}

.messageHeader p {
    font-size: 1.35vh;
}

.messageHeader img {
    height: 4vh;
    width: 4vh;
    border: solid black 1px;
    border-radius: 100vh;
    text-indent: -100vh;
    
}

.messageHeader div {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 0.75vh;
}

.messageHeader h5 {
    font-size: 1.75vh;
}

.messageFooter {
    display: flex;
    gap: 0.5vh;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}



.messageFooter button{
    background-color: white;
    color: black;
    border-radius: 6px;
    border: solid black 1px;
    padding: 2px 8px;
    cursor: pointer;
}

.messageFooter button:hover {
    transform: translateY(-3px);
    opacity: 50%;
    transition-duration: 0.2s;
}

.reply-count {
    margin-left: 6px;
}

.reactions {
    margin-right: 0px;
    display: flex;
    gap: 6px;
}

.reply-section {
    margin-left: 0px;
    display: flex;
    gap: 0px;
}

.replyButton {
    background-color: white;
    color: black;
}

.trendingMessagesContainer {
    display: flex;
    flex-direction: column;
    padding-top: 1vh;
    padding-bottom: 1vh;
    gap: 2vh;
}

.trendingMessage {
    display: flex;
    align-items: center;
    gap: 1vh;
}

.trendingMessage img {
    height: 5vh;
    width: 5vh;
    border: solid black 1px;
    border-radius: 100vh;
    text-indent: -100vh;
}

.trendingMessage h5 {
    font-size: 1.75vh;
}

.trendingMessage p {
    max-width: 25vh;
    font-size: 1.75vh;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#profile-page {
    grid-area: 1 / 2 / 4 / 2;
    padding: 20px;
    flex-direction: column;
}

#profile-page button {
    grid-area: header;
    background-color: black;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#profile-page button:hover {
    opacity: 80%;
    transform: translateY(-3px);
}

#profile-page .likeButton, #profile-page .replyButton, #profile-page .dislikeButton {
    background-color: white;
    color: black;
}

#profile-page button:active {
    transform: scale(0.995);
    background-color: black;
    opacity: 1;
    transition: 0.1s;
}

#profile-back-to-feed {
    margin-top: 8px;
    width: 100%; 
    display: block; 
    padding: 3px 12px; 
}

#profile-follow-btn {
    background-color: black;
    color: white;
    border-radius: 6px;
}

#profile-messages-list {
    flex: 1 1 0;
    overflow: auto;
    max-height: 75vh;
}

#profilePhotoInput::file-selector-button {
    border-radius: 6px;
    border: solid black 1px;
    background-color: black;
    color: white;
    font: inherit;
}

#profilePhotoInput::file-selector-button:hover {
    opacity: 50%;
    transform: translateY(-3px);
    transition-duration: 0.2s;
}

#reply-thread-header button {
    margin-top:8px;
    background-color: black;
    color: white;
    border-radius: 6px;
    padding: 3px 12px; 
    cursor: pointer;
    transition: all 0.2s ease;
}

#reply-thread-header button:hover {
    opacity: 80%;
    transform: translateY(-3px);
}

#reply-thread-header button:active {
    transform: scale(0.995);
    background-color: black;
    opacity: 1;
    transition: 0.1s;
}

#back-to-feed {
    width: 100%; 
    display: block; 
}

.message.sent-by-target {
    color: white;
    margin-right: 25%; 
    margin-left: 10px;
    background-color: #000000ab; 
}

.message.sent-by-target .messageHeader h5 a {
    color: white;
}

.message.sent-by-user {
    margin-left: 25%; 
    margin-right: 10px;
    background-color: #c1c1c1
}

/* ── DM User List Sidebar ── */

#dm-user-list-container {
    display: none;
    flex-direction: column;
    flex: 1 1 0;
    overflow-y: auto;
    gap: 4px;
}

#dm-user-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dm-user-list-item {
    display: flex;
    flex-direction: column;
    padding: 1.2vh 2vh;
    cursor: pointer;
    border-left: 3px solid transparent;
    border-radius: 6px;
    gap: 2px;
    transition: background-color 0.15s, border-left-color 0.15s;
}

.dm-user-list-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: white;
}

.dm-user-list-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: white;
}

.dm-user-list-name {
    font-size: 2vh;
    font-weight: bold;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-user-list-preview {
    font-size: 1.5vh;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── DM Compose Area pinned to bottom ── */

#dm-compose-area {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background-color: white;
    border-top: 1px solid #ccc;
    padding-top: 10px;
    max-height: 30vh;
    overflow-y: auto;
}

/* push main-text-display up so messages don't hide behind the pinned input box */
#main-text-display:has(~ #dm-compose-area[style*="flex"]) {
    padding-bottom: 14vh;
}

/* ── DM Conversation List Layout ── */

#dm-conversation-list .message {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#dm-conversation-list .messageHeader-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

#dm-conversation-list .username a {
    text-decoration: none;
    color: black;
}

#dm-input {
    max-height: 15vh;
    overflow-y: auto;
}