:root {
  --color-text: #1f2421ff;
  --color-primary: #216869ff;
  --color-secondary: #49a078ff;
  --color-muted: #9cc5a1ff;
  --color-white: #fff;
  --color-light: #dce1deff;
}

body {
  margin: 0;
  font: 14px "Montserrat", Helvetica, Arial, sans-serif;
  background-color: var(--color-white);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

* {
  box-sizing: border-box;
  -moz-box-sizing: border-box;
}

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

/* UTILITY */
.text-muted {
  color: var(--color-secondary);
}

/* FORMS */
.form-group {
  display: flex;
  gap: 10px;
}

#form-group--gender {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.form-group > input {
  flex-grow: 1;
}

input {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  margin-top: 10px;
  padding: 15px;
}

::placeholder {
  color: #999;
  /* Firefox */
}

:-ms-input-placeholder {
  /* Internet Explorer 10-11 */
  color: #999;
}

::-ms-input-placeholder {
  /* Microsoft Edge */
  color: #999;
}

.btn {
  border-radius: 5px;
  cursor: pointer;
}

.btn > a {
  text-decoration: none;
  color: #fff;
}

/* LANDING PAGE */
.landing-page {
  margin: 0 auto;
  display: flex;
  flex-grow: 1;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* LOGO */
.logo-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 50%;
  margin-right: 60px; /* Add margin between logo and login */
}

@media only screen and (max-width: 700px) {
  .logo-container {
    display: none;
  }
}

h1.logo {
  margin-top: -60px;
  color:var(--color-secondary);
  font-size: 4vw;
  font-size: clamp(32px, 4vw, 60px);
  font-weight: 500;
}

h2.logo-subtext {
  width: 85%;
  font-weight: 400;
  font-size: clamp(16px, 2vw, 24px); /* Also constrain subtext size */
}

/* LOGIN */
.login-container {
  width: 396px;
  background-color: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%),
    0 8px 16px rgb(0 0 0 / 10%);
  border: 1px solid #ddd;
  border-radius: 10px;
  text-align: center;
  padding: 10px 0;
}

.login-input, .btn {
  width: 90%;
  font-size: 1rem;
}

.login-btn {
  background-color: var(--color-primary);
  color: #fff;
}

.login-bottom {
  display: inline-block;
  margin: 20px 0;
}

.login-bottom > * {
  width: 100%;
}

.login-divider {
  width: 90%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.login_new-account {
  display: flex;
  justify-content: center;
}

.login_new-account-btn {
  font-size: 1rem;
  padding: 10px;
  margin: 20px 0 10px 0;
  min-width: 150px;
  width: 50%;
  background-color:var(--color-secondary);
}

/* CREATE ACCOUNT */
.create-account {
  height: 100vh;
  width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.color-choice-container {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
}

.color-choice {
  width: 60px;
  height: 60px;
  border: 1px solid gray;
  border-radius: 8px;
}

.gradient-0 {
  background: linear-gradient(to bottom, #32006e, #ff0aff);
}

.gradient-1 {
  background: linear-gradient(to bottom, #69e0cd, #5e0eab);
}

.gradient-2 {
  background: linear-gradient(to bottom, #08ccfd, #660bec);
}

.gradient-3 {
  background: linear-gradient(to bottom, #2ca4c7, #dbded1);
}

.gradient-4 {
  background: linear-gradient(to bottom, #f16328, #ffbf35);
}

.gradient-5 {
  background: linear-gradient(to bottom, #a46d5b, #f36670);
}

.gradient-6 {
  background: linear-gradient(to bottom, #ed0025, #fc62bc);
}

.gradient-7 {
  background: linear-gradient(to bottom, #85cdde, #51f95e);
}

/* CONTENT */
.content {
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: 920px; /* 280px * 3 + 20px * 2 + 40px padding */
  width: 100%;
  padding: 0 20px;
}

/* GREETING */
.greeting {
  display: block;
  margin: 10px 0;
}

/* CREATE POST */
.create-post {
  margin: 20px auto;
  width: 600px;
  max-width: 100%;
}

.create-post input {
  word-wrap: break-word;
  word-break: break-all;
}

/* .post-input:focus {
  height: 490px;
  transition: height 5s;
  background: linear-gradient(to bottom, #d76214, #660bec);
  background: linear-gradient(to bottom, #2ca4c7, #dbded1);
  background: linear-gradient(to bottom, #f16328, #920b5b);
  background: linear-gradient(to bottom, #a46d5b, #f36670);
  background: linear-gradient(to bottom, #ed0025, #70daca);
  background: linear-gradient(to bottom, #85cdde, #51f95e);
  color: white;
  font-size: xx-large;
  text-align: center; 
  outline: none;
  border: none;
} */

/* .post-input:focus::placeholder {
  color: transparent;
} */

.post-input:focus {
  border-color: var(--color-primary);
}

/* POST FEED */

.post-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* IMAGE VIEW */
.post[data-content-type="image"] .post-content {
  height: 280px;
  width: 280px;
  background: linear-gradient(to bottom, #69e0cd, #5e0eab);
  background: linear-gradient(to bottom, #a790c1, #c9e6b9);
  background: linear-gradient(to bottom, #d76214, #660bec);
  background: linear-gradient(to bottom, #2ca4c7, #dbded1);
  background: linear-gradient(to bottom, #f16328, #920b5b);
  background: linear-gradient(to bottom, #a46d5b, #f36670);
  background: linear-gradient(to bottom, #ed0025, #70daca);
  background: linear-gradient(to bottom, #85cdde, #51f95e);
  color: white;
  font-size: xx-large;
  text-align: center;
}

/* TEXT VIEW */
.post[data-content-type="text"] {
  grid-column: 1 / -1; /* Span all columns */
  justify-self: center; /* Center within the grid span */
}

.post[data-content-type="text"] .post-content {
  width: 600px; /* Fixed width, not max-width */
  max-width: calc(100vw - 40px); /* But don't overflow on mobile */
  height: auto;
  min-height: 120px;
  background: white;
  color: #000;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

/* Base post styles */
.post {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.post-message {
  flex: 1;
  align-self: center;
}

.posts-container {
  margin: 20px auto 0;
  width: 100%;
  max-width: 880px; /* 280px * 3 + 20px * 2 */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  column-gap: 20px;
  row-gap: 20px;
  justify-content: center;
}

.post-header, .comment-header {
  display: flex;
  /* justify-content: space-between; */
  align-items: center;
  margin-bottom: 8px;
}

.comment {
  margin-top: 12px;
}

.post-icon {
  border-radius: 20px; /* 50% of 40px - more precise than percentage */
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-right: 12px;
  overflow: hidden;
  display: flex;
  transform: translateZ(0); /* Force GPU acceleration */
  -webkit-backface-visibility: hidden; /* Improve rendering on webkit */
  backface-visibility: hidden;
  will-change: transform; /* Optimize for animations/transforms */
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); /* Subtle shadow smooths jagged edges */
}

.post-icon img,
.post-icon svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  shape-rendering: geometricPrecision; /* Better SVG rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.post-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; /* Remove bottom gap from inline image */
}

.post-icon a {
  display: flex;
  width: 100%;
  height: 100%;
  line-height: 0; /* Remove extra spacing from inline elements */
}

.post-author, .comment-author {
  display: flex;
  flex-direction: column;
}

.username {
  font-weight: 600;
  text-decoration: none;
}

.major {
  font-size: 0.9em;
}

.timestamp {
  font-size: 1em;
  margin-left: auto;
}

/* APP BAR */
.app-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: 56px;
  background-color: var(--color-light);
  box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.1);
  padding-right: 16px;
  padding-left: 16px;
  z-index: 9999;
}

.app-bar--left,
.app-bar--right {
  flex: 0 0 auto;
  min-width: 48px;
}

.app-bar--center {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-bar--center img {
  max-width: 50px;
}

.controls {
  display: flex;
  gap: 8px;
}

.control-item {
  border-radius: 100%;
  width: 40px;
  height: 40px;
  background-color: #e4e6eb;
}

.control-item:hover {
  background-color: #d1d3d5;
}

.logo-icon {
  border-radius: 100%;
  width: 40px;
  height: 40px;
  background-color: var(--color-primary);
  /* background: linear-gradient(45deg, rgba(84, 53, 156, 1) 50%, rgba(181, 149, 255, 1) 100%); */
}

.logo-icon a {
  text-decoration: none;
  color: #fff;
  font-weight: 500;
  margin: 0px;
  display: block;
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: 2.5em;
  font-weight: 600;
  position: relative;
  top: 3px;
}

.view-toggle {
  display: flex;
  gap: 12px;
  align-items: center;
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s;
  text-decoration: none;
}

.view-btn img {
  width: 24px;
  height: 24px;
  display: block;
}

.view-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.view-btn.active {
  background-color: rgba(84, 53, 156, 0.1);
}

.profile {
  display: flex;
  align-items: center;
  text-align: center;
  cursor: pointer; 
}

.profile > span {
  flex: 1;
  justify-self: center;
  font-size: 1.25em;
}

.user-menu {
  width: 400px;
  /* height: 112px; */
  position: fixed;
  top: 56px;
  right: 16px;
  display: none;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin-bottom: -168px;
  /* box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); */
}

.user-menu.visible {
  display: block;
}

.user-menu > ul {
  padding: 0;
  margin: 0;
}

.user-menu li a {
  text-decoration: none;
  color: #000;
  font-weight: 500;
  margin: 0px;
  display: block;
  width: 100%;
  height: 100%;
  padding: 1.5em;
}

.user-menu > ul > li {
  list-style: none;
}

.user-menu > ul > li:hover {
  background-color: rgba(0, 0, 0, 0.025);
}

.hidden {
  display: none;
}

/* POST ACTIONS */
.post-actions {
  display: flex;
  gap: 12px;
  padding-top: 2px;
  padding-bottom: 12px;
}

.like-btn, .comment-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s;
  font-size: 14px;
}

.like-btn:hover, .comment-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.like-btn.liked .like-icon {
  color: #e0245e;
}

.like-icon, .comment-icon {
  /* font-size: 18px; */
  color: #657786;
}

.comment-icon {
  transform: translateY(3px);
}

.like-icon, .comment-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
}

.like-btn.liked .like-icon svg {
  fill: #e0245e;
  stroke: #e0245e;
}

.like-btn:hover .like-icon svg {
  stroke: #e0245e;
}

.like-count {
  color: #657786;
  font-weight: 500;
}

/* COMMENT INPUT */
.comment-input-container {
  padding: 0px;
  /* border-top: 1px solid rgba(0, 0, 0, 0.1); */
}

.comment-input-container.hidden {
  display: none;
}

.comment-form {
  display: flex;
  flex-direction: column; /* Stack vertically instead of horizontal */
  gap: 10px;
}

.post-input, .comment-input {
  width: 100%; /* Full width */
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  padding: 15px;
  font-size: 14px;
  outline: none;
  margin-top: 0;
}

.comment-submit-btn {
  align-self: flex-end;
  padding: 8px 16px; /* Reduced from 10px 20px */
  width: auto; /* Only as wide as content needs */
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.post-input:focus, .comment-input:focus {
  border-color: #54359C;
}

.comment-submit-btn:hover {
  background-color: #432b7d;
}

.comment-submit-btn:active {
  transform: scale(0.98);
}

/* COMMENTS LIST */
.comments-list {
  padding-bottom: 12px;
}

.comment-text {
  width: 600px; /* Fixed width, not max-width */
  max-width: calc(100vw - 40px); /* But don't overflow on mobile */
  height: auto;
  background: rgba(0, 0, 0, 0.025);
  color: #000;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  padding: 15px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.comment-profile {
  border-radius: 50%;
  width: 32px;  /* Slightly smaller than post icons */
  height: 32px;
  flex-shrink: 0;
  margin-right: 8px;
  overflow: hidden;
  display: flex;
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

.comment-profile a {
  display: flex;
  width: 100%;
  height: 100%;
}

.comment-profile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

/* TAG SELECTOR */

.tag-selector {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.tag-selector.hidden {
  display: none;
}

.tag-btn, .tag-filter-btn {
  padding: 6px 16px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.tag-btn:hover, .tag-filter-btn:hover {
  background: rgba(84, 53, 156, 0.1);
}

.tag-btn.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-muted);
}

/* General content grid for pages with sidebar tags */
#feed-content {
  display: grid;
  grid-template-columns: 220px minmax(0, 700px) 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 16px;
  min-height: 100vh;
}

/* Hide sidebars by default, show only on feed */
.sidebar-tags {
  display: block;
  grid-column: 1;
}

.main-content {
  grid-column: 2;
  min-width: 0;
}

.right-sidebar {
  grid-column: 3;
  /* Optional: add content or leave empty */
}

/* For profile and other pages, use a single column or different layout */
#profile-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 16px;
  display: block;
}

/* Sidebar tags styling */
.sidebar-tags {
  /* background: #fff; */
  /* border-radius: 16px; */
  /* box-shadow: 0 2px 12px rgba(84, 53, 156, 0.06); */
  padding: 0px 16px 20px 16px;
  margin-top: 24px;
  margin-bottom: 24px;
  min-width: 180px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.sidebar-header {
  font-size: 1rem;
  font-weight: 600;
  color:var(--color-text);
  letter-spacing: 0.5px;
}

.tag-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* .tag-filter-btn {
  background: #fcfcfc;
  color: #54359C;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
} */

/* .tag-filter-btn:hover, */
.tag-filter-btn.active {
  background: var(--color-primary);
  color: #fff;
}