/* ================ BASE VARIABLES ================ */
:root {
  --primary: #1877f2;       /* Facebook blue */
  --primary-hover: #166fe5;
  --secondary: #65676b;     /* Gray for secondary text */
  --light-gray: #f0f2f5;    /* Light background */
  --border-gray: #dddfe2;   /* Border color */
  --text-dark: #1c1e21;     /* Dark text */
  --text-light: #65676b;    /* Light text */
  --success: #42b72a;       /* Green for success */
  --danger: #fa383e;        /* Red for danger/error */
  --warning: #ffbb33;       /* Yellow for warning */
  --white: #ffffff;
  --black: #000000;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--light-gray);
  color: var(--text-dark);
  line-height: 1.5;
}

/* ================ LAYOUT ================ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 15px;
}

/* ================ POST CARD ================ */
.post-card {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 0px;
  overflow: hidden;
}

.post-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  position: relative;
}

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

.post-user-info {
  flex-grow: 1;
}

.post-user-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.post-time {
  font-size: 13px;
  color: var(--secondary);
  display: flex;
  align-items: center;
}

.post-content {
  padding: 0 16px 12px;
}

.post-text {
  margin-bottom: 12px;
  white-space: pre-line;
  word-break: break-word;
}

.post-text.collapsed {
  max-height: 80px;
  overflow: hidden;
  position: relative;
}

.post-text.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to bottom, transparent, var(--white));
}

.read-more-btn {
  color: var(--secondary);
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  margin-top: 5px;
}

/* ================ MEDIA STYLES ================ */
/* Image Grid */
/* Image Grid Styles */
.image-grid {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

/* Mobile First Approach */
/* Single Image */
.single-image {
    width: 100%;
    height: 400px;
    /*display: flex;
    justify-content: center;
    background-color: #f5f5f5;*/
}

.single-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

/* Two Images */
.two-images {
    display: grid;
    grid-template-rows: 200px 200px;
    gap: 2px;
}

.two-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Three Images */
.three-images {
    display: grid;
    grid-template-rows: 240px 160px;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.three-images img:nth-child(1) {
    grid-row: 1;
    grid-column: span 2;
    height: 240px;
}
.three-images img:nth-child(2) {
    grid-row: 2;
    grid-column: 1;
}
.three-images img:nth-child(3) {
    grid-row: 2;
    grid-column: 2;
}


.three-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Four Images */
.four-images {
    display: grid;
    grid-template-rows: 200px 200px;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.four-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Five or More Images */
.many-images {
    display: grid;
    grid-template-rows: 240px 160px;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 2px;
}

.many-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.many-images img:nth-child(1) {
    grid-row: 1;
    grid-column: span 3;
}
.many-images img:nth-child(2) {
    grid-row: 1;
    grid-column: span 3;
}
.many-images img:nth-child(3) {
    /*grid-row: 2;*/
    grid-column: span 2;
}
.many-images img:nth-child(4) {
    /*grid-row: 2;*/
    grid-column: span 2;
}
.many-images .remaining-count img {
    /*grid-row: 2;*/
    grid-column: span 2;
}
.remaining-count {
    position: relative;
    cursor: pointer;
    /*grid-row: 2;*/
    grid-column: span 2;
    width: 100%;
    height: 100%;
}
.remaining-count img {
    filter: brightness(0.7);
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.count-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.3);
}

/* Desktop Styles */
@media (min-width: 768px) {
    
    .single-image {
        height: auto;
    }
    
    .single-image img {
        height: auto;
        max-height: 720px;
    }
    
    .two-images {
        grid-template-columns: 1fr;
        grid-template-rows: 540px 540px;
    }
    
    .three-images {
        /*grid-template-columns: 1fr 1fr;*/
        grid-template-rows: 540px 360px;
    }
    /*
    .three-images img:first-child {
        
        grid-column: span 2;
    }
    
    .three-images img:not(:first-child) {
        height: 360px;
    }*/
    
    .four-images {
        grid-template-rows: 540px 540px;
    }
    
    .many-images {
        grid-template-rows: 720px 360px;
    }
}

/* ================ VIDEO PLAYER ================ */
.post-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin-top: 12px;
  background: var(--black);
  border-radius: 8px;
}

.post-video video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  padding: 10px;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

.post-video:hover .video-controls {
  opacity: 1;
}

/* ================ TAGS & MENTIONS ================ */
.post-tags, .post-mentions {
  margin-bottom: 8px;
}

.tag-input-container {
  position: relative;
  margin-bottom: 10px;
}

.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.tag-suggestions .dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
}

.tag-suggestions .dropdown-item:hover {
  background-color: #f8f9fa;
}

.badge .btn-remove-tag, 
.badge .btn-remove-mention {
  background: none;
  border: none;
  color: inherit;
  padding: 0 0 0 4px;
  line-height: 1;
}

.badge .btn-remove-tag:hover, 
.badge .btn-remove-mention:hover {
  color: white;
}

/* ================ POST ACTIONS ================ */
.post-stats {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-gray);
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--secondary);
}

.post-actions {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  cursor: pointer;
  color: var(--secondary);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border-gray);
  border-radius: 4px;
  transition: background-color 0.2s;
}

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

.post-action-btn i {
  margin-right: 6px;
  font-size: 18px;
}

.post-action-btn.liked {
  color: var(--primary);
}

/* ================ REACTION DROPDOWN ================ */
.reaction-dropdown {
  position: absolute;
  background: white;
  border-radius: 50px;
  padding: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  min-width: 280px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.reaction-option {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s;
  text-align: center;
}

.reaction-option:hover {
  transform: scale(1.2);
}

/* ================ COMMENT SECTION ================ */
.comment-section {
  padding: 8px 16px;
  background-color: var(--light-gray);
  border-radius: 0 0 8px 8px;
}

.comment-form {
  display: flex;
  margin-bottom: 12px;
}

.comment-input {
  flex-grow: 1;
  border-radius: 20px;
  border: 1px solid var(--border-gray);
  padding: 8px 12px;
  outline: none;
  resize: none;
  max-height: 100px;
}

.comment-submit-btn {
  margin-left: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
}

.comment-list {
  margin-top: 8px;
}

.comment-item {
  display: flex;
  margin-bottom: 8px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

.comment-content {
  flex-grow: 1;
  background-color: var(--white);
  padding: 8px 12px;
  border-radius: 18px;
}

.comment-user {
  font-weight: 600;
  font-size: 13px;
  margin-right: 6px;
}

.comment-text {
  font-size: 14px;
  margin: 4px 0;
}

.comment-actions {
  display: flex;
  font-size: 12px;
  color: var(--secondary);
}

.comment-action {
  margin-right: 12px;
  cursor: pointer;
}

.comment-action:hover {
  text-decoration: underline;
}

.reply-section {
  margin-left: 40px;
  margin-top: 8px;
}

.reply-item {
  display: flex;
  margin-bottom: 8px;
}

.reply-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

/* ================ SHARE MODAL ================ */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
}

.share-dialog {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
}

/* ================ CREATE POST MODAL ================ */
.create-post-modal {
  max-width: 500px;
  margin: 20px auto;
}

.create-post-header {
  border-bottom: 1px solid var(--border-gray);
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  position: relative;
}

.create-post-close {
  position: absolute;
  right: 16px;
  top: 12px;
  cursor: pointer;
}

.create-post-body {
  padding: 16px;
}

.post-type-selector {
  display: flex;
  border-bottom: 1px solid var(--border-gray);
  margin-bottom: 16px;
}

.post-type-btn {
  flex: 1;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.post-type-btn.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.media-preview {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.media-preview img,
.media-preview video {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: var(--black);
}

.remove-media {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ================ RESPONSIVE ADJUSTMENTS ================ */
@media (max-width: 768px) {
  .container { padding: 0; }
  .post-card {
    border-radius: 0;
    margin-bottom: 8px;
    box-shadow: none;
    border-bottom: 1px solid var(--border-gray);
  }
}

@media (max-width: 576px) {
  .post-actions .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }
  .comment-avatar {
    width: 32px;
    height: 32px;
  }
}