/**
 * Modern Content Layout System
 * 
 * Handles layout for content pages, categories, and product templates
 * Includes: content-header-controls, pagination, grid/list modes
 * 
 * Version: 1.0.0
 * Last Updated: Dec 2025
 */

/* ============================================
   Content Header Controls
   ============================================ */

.content-header-controls {
    position: relative;
    margin: 0 auto;
}

.content-header-controls .view-toggle-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    margin: 5px 5px 0 0;
    z-index: 10;
}

.content-header-controls .category-bar {
    margin-top: 0;
    margin-bottom: 0 !important;
}

/* ============================================
   Entry Content Container
   ============================================ */

.entry-content {
    padding-top: 20px;
    max-width: 1440px;
    margin: 0 auto;
}

/* Larger monitors: increase max-width */
@media (min-width: 1600px) {
    .entry-content {
        max-width: 1900px;
    }
}

@media (min-width: 1920px) {
    .entry-content {
        max-width: 1900px;
    }
}

/* Remove left padding in grid mode for full width */
body.view-mode-grid .entry-content,
.container.view-mode-grid .entry-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* Hide types sidebar in grid mode, show slide-out trigger instead */
body.view-mode-grid .types-sidebar {
    display: none !important;
}

body.view-mode-grid .types-slideout-trigger {
    display: flex !important;
}

/* Grid mode: documents container uses full width */
body.view-mode-grid .content-with-sidebar {
    display: block !important;
}

body.view-mode-grid .documents {
    max-width: none !important;
    width: 100% !important;
}

/* Premium members (product=68): use flex layout with sidebar */
body.smb-member .content-with-sidebar,
.container.smb-member .content-with-sidebar {
    display: flex !important;
}

body.smb-member .documents,
.container.smb-member .documents {
    max-width: calc(100% - 240px) !important;
    width: 100% !important;
}

@media (min-width: 1200px) {
    body.smb-member .documents,
    .container.smb-member .documents {
        padding-left: 130px;
        padding-right: 20px;
    }
}

body.smb-member.view-mode-grid .documents,
.container.smb-member.view-mode-grid .documents {
    padding-left: 20px;
}

/* Grid mode: hide sidebar for SMB members and use full width */
body.smb-member.view-mode-grid .products-sidebar,
.container.smb-member.view-mode-grid .products-sidebar {
    display: none !important;
}

body.smb-member.view-mode-grid .documents,
.container.smb-member.view-mode-grid .documents {
    max-width: none !important;
    width: 100% !important;
}

/* Total Access and pages with types sidebar: proper left padding */
.latest-content-page .content-with-sidebar > .documents {
    padding-left: 0px;
    padding-right: 0px;
}

/* Larger screens: add extra left padding */
@media (min-width: 1441px) {
    .latest-content-page .content-with-sidebar > .documents {
        padding-left: 130px;
    }
}

/* Grid mode: reduce left padding */
.latest-content-page.view-mode-grid .content-with-sidebar > .documents,
body.view-mode-grid .content-with-sidebar > .documents,
.container.view-mode-grid .content-with-sidebar > .documents {
    padding-left: 20px;
}

/* Mobile: no side padding */
@media (max-width: 767px) {
    .latest-content-page.view-mode-grid .content-with-sidebar > .documents,
    body.view-mode-grid .content-with-sidebar > .documents,
    .container.view-mode-grid .content-with-sidebar > .documents {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ============================================
   Pagination
   ============================================ */

.pagination-wrapper {
    text-align: center;
    margin: 30px auto 40px;
    padding: 0 15px 0 130px;
    clear: both;
    max-width: 1440px;
}

/* Larger monitors: match entry-content width */
@media (min-width: 1600px) {
    .pagination-wrapper {
        max-width: 1900px;
    }
}

@media (min-width: 1920px) {
    .pagination-wrapper {
        max-width: 1900px;
    }
}

/* Pagination button styling */
.pagination-wrapper .page-numbers {
    display: inline-block;
    padding: 10px 16px;
    margin: 0 4px;
    background: #fff;
    border: 2px solid #2c5282;
    border-radius: 6px;
    color: #2c5282;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 45px;
    text-align: center;
    cursor: pointer;
}

.pagination-wrapper .page-numbers:hover {
    background: #2c5282;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(44, 82, 130, 0.3);
}

.pagination-wrapper .page-numbers.current {
    background: #2c5282;
    color: #fff;
    border-color: #2c5282;
    cursor: default;
}

.pagination-wrapper .page-numbers:not(.current):not(.dots):hover {
    background: #2c5282;
    color: #fff;
}

.pagination-wrapper .page-numbers.dots {
    border: none;
    background: transparent;
    color: #6b7280;
    pointer-events: none;
    cursor: default;
}

.pagination-wrapper .page-numbers.prev,
.pagination-wrapper .page-numbers.next {
    padding: 10px 20px;
}

/* Adjust pagination padding in grid mode */
body.view-mode-grid .pagination-wrapper {
    padding: 0 !important;
}

@media (max-width: 1199px) {
    .pagination-wrapper {
        padding: 0 20px;
    }
}

/* ============================================
   Category-Specific Overrides
   ============================================ */

/* Override old flex layout on .documents from style.css line 1279 */
body.category .documents,
body.category .entry-product .documents,
body.category .entry-product .entry-content .documents {
    display: block !important;
    flex-direction: initial !important;
    flex-wrap: initial !important;
    max-width: none !important;
    width: auto !important;
}

/* Override old category CSS to work with new structure */
body.category .entry-content,
body.category .entry-product .entry-content {
    padding: 0 !important;
    max-width: 1440px !important;
    margin: 20px auto !important;
}

@media (min-width: 1200px) {
    body.category .entry-content,
    body.category .entry-product .entry-content {
        padding: 0 0 0 30px !important;
    }
}

/* Above 1440px: add extra left padding */
@media (min-width: 1441px) {
    body.category .entry-content,
    body.category .entry-product .entry-content {
        padding: 0px 0 0px 130px !important;
    }
}

/* Larger monitors: match global entry-content width */
@media (min-width: 1600px) {
    body.category .entry-content,
    body.category .entry-product .entry-content {
        padding: 0px 0 0px 130px !important;
        max-width: 1900px !important;
        justify-content: space-around;
    }
    body.sm-product-template .entry-content, body.sm-product-template .entry-product .entry-content,
    .page-template .entry-content, .page-template .entry-product .entry-content 
    {
        padding: 0px 10px !important;
        max-width: 1900px !important;
        justify-content: center;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    body.postid-1216 .entry-content,
    body.postid-1219 .entry-content,
    body.postid-1220 .entry-content,
    body.postid-2136 .entry-content,
    body.postid-1216 .entry-product .entry-content,
    body.postid-1219 .entry-product .entry-content,
    body.postid-1220 .entry-product .entry-content,
    body.postid-2136 .entry-product .entry-content {
        padding: 40px 40px 40px 130px !important;
        font-family: "Mulish", sans-serif;
        max-width: 1200px !important;
        text-align: left !important;
        margin: 0 auto !important;
        float: none !important;
    }

    .category-bar-inner{margin: 0 auto;}
        
    /* Center header text on large screens */
    .ssp-header {
        text-align: center !important;
    }
    
    .ssp-header .ssp-title {
        text-align: center !important;
    }
    
    .ssp-header .ssp-subtitle {
        text-align: center !important;
    }
}

@media (min-width: 1920px) {
    body.category .entry-content,
    body.category .entry-product .entry-content {
        max-width: 1900px !important;
    }
}

/* Remove left padding in grid mode for full width */
body.view-mode-grid.category .entry-content,
body.view-mode-grid.category .entry-product .entry-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
}

/* Mobile: no side padding */
@media (max-width: 767px) {
    body.view-mode-grid.category .entry-content,
    body.view-mode-grid.category .entry-product .entry-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

body.category .entry-content {
    padding-top: 20px !important;
}

@media (max-width: 1199px) {
    body.category .entry-content {
        padding-left: 30px !important;
    }
    
    body.view-mode-grid.category .entry-content {
        padding-left: 0 !important;
    }
}

@media (max-width: 767px) {
    body.category .entry-content,
    body.category .entry-product .entry-content,
    .container.smb-member .entry-content,
    .container.smc-member .entry-content {
        padding: 0 !important;
        margin: 10px auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    body.category .content-with-sidebar,
    .container.smb-member .content-with-sidebar,
    .container.smc-member .content-with-sidebar {
        display: block !important;
    }

    body.category .content-with-sidebar > .documents,
    .container.smb-member .documents,
    .container.smc-member .documents,
    body.category #ajax-posts,
    .container.smb-member #ajax-posts,
    .container.smc-member #ajax-posts {
        padding-left: 15px !important;
        padding-right: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .ssp-header {
        padding: 20px 15px !important;
    }
}

/* Category pagination */
body.category .pagination-wrapper {
    margin-bottom: 40px !important;
    text-align: center;
    clear: both !important;
    width: 100% !important;
    float: none !important;
    display: block !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* ============================================
   Video Player in Categories
   ============================================ */

/* Video player - centered above content in list mode */
body.category #ajax-posts > .player {
    margin: 0 auto;
    max-width: 900px;
    width: 100%;
}

body.category .player .title {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.player .video {
    width: 100%;
}

.player .video-wrapper {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    padding-left: 0 !important;
}

.player .video-wrapper iframe,
.player .video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Video player as card in grid mode */
body.view-mode-grid.category .documents-grid #ajax-posts > .player {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin: 0 0 24px 0;
    max-width: none;
    grid-column: 1 / -1; /* Span full width of grid */
    transition: all 0.3s ease;
}

body.view-mode-grid.category .documents-grid #ajax-posts > .player:hover {
    border-color: #2c5282;
    box-shadow: 0 8px 24px rgba(44, 82, 130, 0.12);
    transform: translateY(-2px);
}

body.view-mode-grid.category .player .title {
    font-size: 20px;
    margin-bottom: 16px;
    text-align: left;
    font-weight: 700;
}

body.view-mode-grid.category .player .video-wrapper {
    border-radius: 8px;
    overflow: hidden;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 1199px) {
    .entry-content {
        padding-left: 30px;
    }
}

@media (max-width: 768px) {
    .pagination-wrapper .page-numbers {
        padding: 8px 12px;
        margin: 0 2px;
        font-size: 13px;
        min-width: 38px;
    }
    
    .pagination-wrapper .page-numbers.prev,
    .pagination-wrapper .page-numbers.next {
        padding: 8px 14px;
    }
}

@media (max-width: 767px) {
    .entry-content {
        padding: 20px 0 0 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    body.view-mode-grid .entry-content,
    .container.view-mode-grid .entry-content {
        padding: 20px 0 0 0 !important;
    }
    
    body.smb-member .documents,
    .container.smb-member .documents {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}
