/* ══════════════════════════════════════════
   LAYOUT — Grid, containers, spacing
   ══════════════════════════════════════════ */

/* Container */
.cg-container {
    width: 100%;
    max-width: var(--cg-container);
    margin: 0 auto;
    padding: 0 20px;
}

.cg-container-wide {
    max-width: var(--cg-container-wide);
    margin: 0 auto;
    padding: 0 20px;
}

.cg-container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main content area */
.cg-main {
    min-height: calc(100vh - var(--cg-nav-height) - 300px);
    padding-bottom: 60px;
    overflow-x: hidden;
}

.cg-main-blank {
    padding-bottom: 0;
}

.cg-main-login {
    padding-bottom: 0;
}

/* Dashboard images constrain */
.cg-main-dashboard img,
.cg-main-blank img {
    max-width: 100%;
    height: auto;
}

/* ── Student Dashboard Emoji Fix ──
   WordPress converts emoji characters (☀️📅📊) into <img class="wp-smiley"> SVGs.
   These render at natural 150px. We constrain them to icon size per context. */

/* WordPress emoji SVGs — universal dashboard constraint */
.cg-dashboard-wrap img.wp-smiley,
.cg-dashboard-wrap img[src*="/images/core/emoji/"],
.cg-dashboard-wrap img[src*="s.w.org/images/core/emoji"] {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 4px !important;
}

/* Hero banner — greeting emoji slightly larger */
#cg-hero-banner img.wp-smiley,
#cg-hero-banner img[src*="emoji"] {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
}

/* Stats bar — compact icons */
#cg-stats-bar img.wp-smiley,
#cg-stats-bar img[src*="emoji"] {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

/* Quick actions — button icons */
#cg-quick-actions img.wp-smiley,
#cg-quick-actions img[src*="emoji"] {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
}

/* Gamification section — trophy/streak icons */
#cg-gamification-row img.wp-smiley,
#cg-gamification-row img[src*="emoji"] {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
}

/* Dashboard cards — card heading icons */
#cg-dashboard-cards img.wp-smiley,
#cg-dashboard-cards img[src*="emoji"],
.cgd-card img.wp-smiley,
.cgd-card img[src*="emoji"] {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
}

/* Non-emoji images in dashboard cards (avatars, charts) — keep reasonable */
#cg-dashboard-cards img:not(.wp-smiley):not([src*="emoji"]) {
    max-width: 100% !important;
    height: auto !important;
}

/* Dashboard cards — 2-column grid for medium+ screens */
#cg-dashboard-cards {
    overflow-x: hidden;
}

@media (min-width: 768px) {
    #cg-dashboard-cards {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
    /* Profile card spans full width */
    #cg-dashboard-cards > div:first-child {
        grid-column: 1 / -1 !important;
    }
    /* Quick Links card spans full width */
    #cg-dashboard-cards > div:last-child {
        grid-column: 1 / -1 !important;
    }
    .cgd-card {
        margin-bottom: 0 !important;
    }
}

/* Force dashboard sections to respect container width */
.cg-dashboard-wrap > div {
    max-width: 100%;
    overflow-x: hidden;
}

/* Page content */
.cg-page-content {
    padding-top: 40px;
    padding-bottom: 60px;
}

.cg-page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cg-text-heading);
    margin-bottom: 24px;
}

/* Entry content (WordPress default) */
.cg-entry-content {
    font-size: 16px;
    line-height: 1.75;
    color: var(--cg-text);
}

.cg-entry-content h2 {
    margin-top: 32px;
    margin-bottom: 16px;
}

.cg-entry-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
}

.cg-entry-content p {
    margin-bottom: 16px;
}

.cg-entry-content img {
    border-radius: var(--cg-radius-sm);
    margin: 16px 0;
}

.cg-entry-content ul, .cg-entry-content ol {
    margin-bottom: 16px;
}

.cg-entry-content li {
    margin-bottom: 6px;
}

.cg-entry-content blockquote {
    border-left: 4px solid var(--cg-orange);
    padding: 16px 20px;
    margin: 24px 0;
    background: var(--cg-border-light);
    border-radius: 0 var(--cg-radius-sm) var(--cg-radius-sm) 0;
    font-style: italic;
}

/* Posts grid */
.cg-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Pagination */
.cg-pagination {
    margin-top: 40px;
    text-align: center;
}

.cg-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cg-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--cg-radius-sm);
    border: 1px solid var(--cg-border);
    color: var(--cg-text);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--cg-transition);
}

.cg-pagination .page-numbers:hover {
    border-color: var(--cg-orange);
    color: var(--cg-orange);
}

.cg-pagination .page-numbers.current {
    background: var(--cg-orange);
    color: #fff;
    border-color: var(--cg-orange);
}

/* 404 page */
.cg-404 {
    text-align: center;
    padding: 80px 20px;
}

.cg-404 h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--cg-border);
    line-height: 1;
    margin-bottom: 16px;
}

.cg-404 h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.cg-404 p {
    color: var(--cg-text-light);
    margin-bottom: 32px;
}

.cg-404-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* No content state */
.cg-no-content {
    text-align: center;
    padding: 60px 20px;
}

/* Archive header */
.cg-archive-header {
    margin-bottom: 24px;
}

.cg-archive-desc {
    color: var(--cg-text-light);
    font-size: 16px;
    margin-top: 8px;
}

/* Nav spacer */
.cg-nav-spacer {
    height: var(--cg-nav-height);
}

/* Dashboard wrap */
.cg-dashboard-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px;
    overflow-x: hidden;
}

/* Staff dashboard pages — full-width shortcode output */
.cg-main-blank > .cg-cd,
.cg-main-blank > [class*="cg-mgr"],
.cg-main-blank > [class*="cg-ops"],
.cg-main-blank > [class*="cg-fac"] {
    overflow-x: hidden;
}

/* Login wrap — cg-ui-overhaul injects full 2-panel layout, no max-width constraint */
.cg-login-wrap {
    max-width: none;
    margin: 0 auto;
    padding: 0;
}

/* Single post */
.cg-post-header {
    margin-bottom: 32px;
    padding-top: 40px;
}

.cg-post-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
}

.cg-post-meta {
    color: var(--cg-text-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cg-post-meta a {
    color: var(--cg-blue);
}

.cg-post-featured-image {
    margin-bottom: 32px;
    border-radius: var(--cg-radius);
    overflow: hidden;
}

.cg-post-featured-image img {
    width: 100%;
}

.cg-post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--cg-border);
}

.cg-post-nav a {
    font-size: 14px;
    font-weight: 500;
    color: var(--cg-blue);
    max-width: 45%;
}
