/* Responsive Styles */

/* Breakpoint: <= 1200px (Compact Desktop / Laptop) */
@media (max-width: 1200px) {
  .hero-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
  }

  .main-content-layout {
    grid-template-columns: 1fr 310px;
    gap: 18px;
  }

  .carousel-card {
    flex: 0 0 calc((100% - (4 * 12px)) / 5);
  }

  .forum-table-head,
  .forum-item-row {
    grid-template-columns: 1fr 120px 190px;
    gap: 12px;
  }
}

/* Breakpoint: <= 1024px (Small Laptop / Tablet Landscape) */
@media (max-width: 1024px) and (min-width: 769px) {
  .nav-item {
    padding: 0 8px;
    font-size: 13px;
    gap: 4px;
  }
  .btn-post-ad {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* Breakpoint: <= 992px (Tablet) */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .main-content-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .carousel-card {
    flex: 0 0 calc((100% - (3 * 12px)) / 4);
  }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .footer-brand-col {
    grid-column: span 2;
  }

  .topics-header-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }

  .topics-tabs-nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Breakpoint: <= 768px (Mobile & Small Tablet) */
@media (max-width: 768px) {
  .brand-logo-img--header {
    height: 42px;
    max-height: 42px;
  }

  .brand-logo-img--footer {
    height: 44px;
    max-height: 44px;
  }

  .header-top-links {
    display: none;
  }

  .header-nav-inner {
    position: relative;
  }

  .header-nav-actions {
    width: 100%;
    margin-left: auto;
    justify-content: space-between;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background-color: var(--color-navy-dark);
    flex-direction: column;
    height: auto;
    padding: 12px;
    border-bottom: 2px solid var(--color-orange);
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }

  .nav-links.show-mobile {
    display: flex;
  }

  .nav-item {
    width: 100%;
    height: 40px;
    padding: 0 12px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-search-wrapper {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 12px;
    gap: 10px;
  }

  .search-input {
    width: 100%;
  }

  .search-category-select {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--color-divider);
    padding: 8px 0;
  }

  .search-submit-btn {
    width: 100%;
    justify-content: center;
    border-radius: var(--radius-md);
  }

  .hero-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .hero-stats-row .stat-item {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
  }

  .hero-features-box {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .carousel-card {
    flex: 0 0 calc((100% - (1 * 12px)) / 2);
  }

  /* Forum Categories Mobile */
  .forum-table-head {
    display: none;
  }

  .forum-item-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .forum-item-stats {
    justify-content: flex-start;
    gap: 14px;
    padding-top: 4px;
  }

  .forum-item-lastpost {
    padding-top: 6px;
    border-top: 1px dashed var(--color-border-subtle);
  }

  .cat-header-desc {
    display: none;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand-col {
    grid-column: span 1;
  }

  .footer-bottom-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .header-top-inner,
  .header-top-right,
  .header-auth-buttons,
  .header-nav-inner,
  .header-nav-actions {
    min-width: 0;
  }

  .header-top-right {
    gap: 10px;
  }

  .header-user-btn > span {
    display: none;
  }

  .header-user-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
  }

  .header-popover-menu {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 76px);
  }

  .header-user-dropdown-menu {
    position: fixed;
    top: 64px;
    right: 12px;
    width: min(220px, calc(100vw - 24px));
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
  }

  .footer-social-links {
    flex-wrap: wrap;
  }

  .footer-links-list a,
  .footer-links-list span,
  .footer-bottom-inner {
    overflow-wrap: anywhere;
  }

  .search-page,
  .search-page .container,
  .search-form-primary,
  .search-form-primary > * {
    min-width: 0 !important;
    max-width: 100%;
  }

  .search-form-primary > div,
  .search-category-filter,
  .search-sort-filter,
  .search-submit-button {
    width: 100%;
  }

  .search-tabs-nav {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .search-tabs-nav .search-tab-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* ====================================================
     SON KONULAR (LATEST TOPICS) MOBILE-FIRST POLISH
     ==================================================== */
  .latest-topics-section > .container {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topics-header-wrapper {
    padding: 12px 14px;
    gap: 10px;
  }

  .topics-title-area .card-header-title {
    font-size: 1rem;
  }

  .topics-tabs-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px;
    gap: 4px;
  }
  .topics-tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .topic-tab-btn {
    padding: 5px 10px;
    font-size: 0.6875rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .pinned-section-header {
    padding: 7px 12px;
    font-size: 0.625rem;
  }

  /* Transform table into clean 2-line list items on mobile */
  .table-responsive {
    overflow-x: visible;
  }

  .topics-data-table thead {
    display: none !important;
  }

  .topics-data-table,
  .topics-data-table tbody {
    display: block;
    width: 100%;
  }

  .topics-data-table tr.topic-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid #EEF2F6;
    row-gap: 6px;
    background-color: #FFFFFF;
    transition: background-color 0.15s ease;
  }

  .topics-data-table tr.topic-row:last-child {
    border-bottom: none;
  }

  .topics-data-table tr.topic-row--pinned {
    background-color: #FFFDF9;
    border-left: 3px solid #FF6B0B;
  }

  .pinned-topics-table tr.topic-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px;
    background-color: #FFFDF9;
    border-left: 3px solid #FF6B0B;
    border-bottom: 1px solid #FEF3C7;
  }

  .pinned-topics-table tr.topic-row .topic-col-title {
    flex: 1;
    min-width: 0;
    width: auto;
    order: unset;
  }

  .pinned-topics-table tr.topic-row .topic-col-views {
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    padding: 0 !important;
    border: none !important;
    order: unset;
    flex-shrink: 0;
  }

  .topic-col-title {
    width: 100%;
    order: 1;
    padding: 0 !important;
    border: none !important;
  }

  .topic-title-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .topic-title-cell .topic-icon-badge {
    margin-top: 2px;
    width: 20px;
    height: 20px;
  }

  .topic-title-link {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
  }

  /* Hide Category on Mobile */
  .topic-col-category {
    display: none !important;
  }

  /* Meta Row: Author, Trade on Left | Replies, Views on Right */
  .topic-col-author {
    order: 2;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center;
    font-size: 0.6875rem;
  }

  .topic-col-author .topic-author-name {
    font-size: 0.6875rem;
  }

  .topic-col-trade {
    order: 3;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center;
    margin-left: 6px;
  }

  .topic-col-trade .trade-score-pill {
    font-size: 0.625rem;
    padding: 1px 5px;
  }

  .topic-col-replies {
    order: 4;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center;
    margin-left: auto; /* Pushes stats to far right */
  }

  .topic-col-views {
    order: 5;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center;
    margin-left: 8px;
  }

  .topic-stat-badge {
    font-size: 0.6875rem;
    gap: 3px;
  }
}

/* Breakpoint: <= 430px (Small Mobile) */
@media (max-width: 430px) {
  .brand-logo-img--header {
    height: 38px;
    max-height: 38px;
  }

  .brand-logo-img--footer {
    height: 38px;
    max-height: 38px;
  }

  .brand-logo {
    font-size: 1.375rem;
  }

  .brand-subtitle {
    display: none;
  }

  .header-auth-buttons .btn-login {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .header-auth-buttons .btn-register {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .carousel-card {
    flex: 0 0 85%;
  }

  .hero-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hero-stats-row .stat-item {
    gap: 7px;
    padding: 8px;
  }

  .hero-stats-row .stat-icon-wrapper {
    width: 32px;
    height: 32px;
  }

  .hero-stats-row .stat-number {
    font-size: 0.875rem;
  }

  .hero-stats-row .stat-label {
    font-size: 0.625rem;
    line-height: 1.25;
  }

  .latest-topics-section > .container {
    padding-right: 6px;
    padding-left: 6px;
  }

  .topics-header-wrapper {
    padding: 10px 12px;
  }

  .topics-data-table tr.topic-row {
    padding: 10px 10px;
  }

  .topic-col-trade {
    margin-left: 4px;
  }

  .topic-col-views {
    margin-left: 6px;
  }

  .header-top-right {
    gap: 8px;
  }

  .header-auth-buttons {
    gap: 6px !important;
  }
}
