/**
 * COPO Reusable Components
 * Court of Public Opinion - YOU BE THE JUDGE
 * 
 * Version: 1.0.0
 * Created: 2025-12-15
 * 
 * This file contains all shared UI components that follow the
 * COPO design system. Always import design-tokens.css before this file.
 * 
 * Usage:
 * @import url('/styles/design-tokens.css');
 * @import url('/styles/components.css');
 */

 /* ========================================
   PAGE WRAPPER (for public pages)
   ======================================== */

.copo-page-wrapper {
    max-width: var(--page-max-width);
    margin: 0 auto;
    background: var(--copo-white);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

.copo-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
    width: 100%;
}

.copo-section {
    background: var(--copo-white);
    padding: var(--spacing-3) 0; /* Changed from --spacing-8 (32px) to --spacing-3 (12px) */
}

/* ========================================
   TOP NAVIGATION
   ======================================== */

/* Nav wrapper is a direct child of .copo-page-wrapper — sticky here has the full page height */
#nav-placeholder {
    position: sticky;
    top: 0;
    z-index: 500;
}

.copo-top-nav {
    background: var(--copo-blue);
    height: var(--header-height);
    border: none;
}

.copo-top-nav-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-8);
}

.copo-nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
    color: var(--copo-white);
}

/* Ensure logo link is properly centered */
.copo-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    line-height: 0; /* Remove any line-height spacing */
}

.copo-logo {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--copo-white);
    text-decoration: none;
    letter-spacing: var(--letter-spacing-wide);
}

.copo-logo:hover {
    color: var(--copo-white);
}

.copo-tagline {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    font-style: italic;
    color: var(--copo-white);
    opacity: 0.95;
}

/* Ensure logo is consistent in both public and auth nav */
.copo-top-nav .copo-logo-image {
    height: 40px;
    width: auto;
    display: block; /* Remove inline spacing */
    vertical-align: middle; /* Ensure proper vertical alignment */
}

.copo-nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

/* Hamburger button used in auth-nav and shared nav components */
.copo-top-nav .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--copo-white);
    cursor: pointer;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}
.copo-top-nav .mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========================================
   SUBJECT MENU BAR
   ======================================== */

.copo-subject-menu {
    background: var(--copo-white);
    height: var(--subject-menu-height);
    border-bottom: 0.25px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Changed from center to flex-start */
    padding: 0 var(--spacing-8);
}

.copo-subject-menu-list {
    display: flex;
    gap: var(--spacing-3); /* Changed from --spacing-8 (32px) to --spacing-5 (20px) - 37.5% reduction */
    list-style: none;
    margin: 0;
    padding: 0;
}

.copo-subject-menu-item {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--copo-black);
    text-transform: capitalize; /* Changed from uppercase to capitalize */
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    padding: var(--spacing-2) var(--spacing-4);
    transition: color var(--transition-fast);
    border: none;
    background: transparent;
}

.copo-subject-menu-item:hover {
    color: var(--copo-blue);
}

.copo-subject-menu-item.active {
    color: var(--copo-black);
    font-weight: var(--font-weight-bold);
}

/* ========================================
   PAGE TYPE LOZENGE
   Shared across source, item, and entity pages.
   Usage: <div class="page-type-lozenge">SOURCE</div>
   ======================================== */

.page-type-lozenge {
    flex-shrink: 0;
    align-self: center;
    background: rgba(84, 109, 180, 0.30); /* COPO blue at 30% */
    color: rgba(84, 109, 180, 0.80);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 18px 36px;
    border-radius: 40px;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .page-type-lozenge {
        font-size: 1.5rem;
        padding: 10px 20px;
        border-radius: 24px;
    }
}

/* ========================================
   BUTTONS
   ======================================== */

/* Base button - flat with rounded corners */
.copo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-6);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    min-height: var(--button-height-md);
    white-space: nowrap;
}

.copo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button on blue/charcoal background - white with blue text */
.copo-btn-white-blue {
    background: var(--copo-white);
    color: var(--copo-blue);
}

.copo-btn-white-blue:hover:not(:disabled) {
    background: var(--copo-gray-100);
    color: var(--copo-blue-dark);
}

/* Button on white background - blue with white text */
.copo-btn-blue {
    background: var(--copo-blue);
    color: var(--copo-white);
}

.copo-btn-blue:hover:not(:disabled) {
    background: var(--copo-blue-dark);
}

/* Button on white background - red with white text (key actions) */
.copo-btn-red {
    background: var(--copo-red);
    color: var(--copo-white);
}

.copo-btn-red:hover:not(:disabled) {
    background: var(--copo-red-dark);
}

/* Button on white background - charcoal with white text */
.copo-btn-charcoal {
    background: var(--copo-charcoal);
    color: var(--copo-white);
}

.copo-btn-charcoal:hover:not(:disabled) {
    background: var(--copo-charcoal-dark);
}

/* Outline button */
.copo-btn-outline {
    background: transparent;
    color: var(--copo-blue);
    border: var(--border-width-base) solid var(--copo-blue);
}

.copo-btn-outline:hover:not(:disabled) {
    background: var(--copo-blue);
    color: var(--copo-white);
}

/* Button sizes */
.copo-btn-sm {
    padding: var(--spacing-2) var(--spacing-4);
    font-size: var(--font-size-sm);
    min-height: var(--button-height-sm);
    border-radius: var(--radius-sm);
}

.copo-btn-lg {
    padding: var(--spacing-4) var(--spacing-8);
    font-size: var(--font-size-lg);
    min-height: var(--button-height-lg);
    border-radius: var(--radius-lg);
}

/* ========================================
   TIMELINE CARDS
   ======================================== */

.copo-timeline-card {
    background: var(--copo-white);
    border: 0.25px solid var(--border-color);
    border-radius: var(--radius-none); /* Square corners for cards */
    padding: var(--spacing-6);
    transition: box-shadow var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.copo-timeline-card:hover {
    box-shadow: var(--shadow-md);
}

.copo-timeline-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--copo-gray-100);
}

.copo-timeline-card-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--copo-black);
    margin: 0;
}

.copo-timeline-card-description {
    font-size: var(--font-size-base);
    color: var(--copo-gray-700);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

.copo-timeline-card-meta {
    display: flex;
    gap: var(--spacing-4);
    font-size: var(--font-size-sm);
    color: var(--copo-gray-500);
}

.copo-timeline-card-author,
.copo-timeline-card-date {
    margin: 0;
}

/* ========================================
   SIDEBAR
   ======================================== */

.copo-sidebar {
    background: var(--copo-white);
    border-left: 1px solid var(--border-color);
    padding: var(--spacing-6);
}

.copo-sidebar-header {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--copo-red);
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-3);
    border-bottom: 0.25px solid var(--border-color);
    text-transform: capitalize; /* Add this line */
}

.copo-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.copo-sidebar-item {
    padding-bottom: var(--spacing-4);
    border-bottom: 0.25px solid var(--border-color-light);
}

.copo-sidebar-item:last-child {
    border-bottom: none;
}

.copo-sidebar-link {
    font-size: var(--font-size-base);
    color: var(--copo-black);
    text-decoration: none;
    line-height: var(--line-height-normal);
    display: block;
}

.copo-sidebar-link:hover {
    color: var(--copo-blue);
}

/* ========================================
   FOOTER
   ======================================== */

.copo-footer {
    background: var(--copo-charcoal);
    color: var(--copo-white);
    padding: var(--spacing-8) 0;
    border: none;
}

.copo-footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-6);
    list-style: none;
    margin: 0;
    padding: 0;
}

.copo-footer-link {
    color: var(--copo-white);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.copo-footer-link:hover {
    color: var(--copo-white);
    opacity: 0.8;
}

.copo-footer-divider {
    color: var(--copo-gray-400);
}

.copo-footer-copyright {
    margin: var(--spacing-4) 0 0;
    text-align: center;
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--copo-gray-400);
}

/* ========================================
   HEADINGS WITH SECTIONS
   ======================================== */


.copo-section-header {
    font-size: var(--font-size-lg); /* Changed from --font-size-3xl (30px) to --font-size-lg (18px) */
    font-weight: var(--font-weight-bold);
    color: var(--copo-red);
    text-transform: capitalize;
    letter-spacing: var(--letter-spacing-wide);
    margin: 0 0 var(--spacing-6) 0;
    padding-bottom: var(--spacing-3);
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   GRID LAYOUTS
   ======================================== */

.copo-grid {
    display: grid;
    gap: var(--spacing-6);
}

/* 2-column grid for main content + sidebar */
.copo-grid-main-sidebar {
    grid-template-columns: 1fr var(--sidebar-width);
}

/* Timeline card grids */
.copo-grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Featured story layout (3 pinned stories) */
.copo-grid-featured {
    grid-template-columns: repeat(3, 1fr);
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

@media (max-width: 1023px) {
    .copo-grid-main-sidebar {
        grid-template-columns: 1fr;
    }
    
    .copo-sidebar {
        border-left: none;
        border-top: 0.25px solid var(--border-color);
    }
}

@media (max-width: 767px) {
    .copo-grid-featured {
        grid-template-columns: 1fr;
    }
    
    .copo-subject-menu-list {
        gap: var(--spacing-4);
    }
    
    .copo-subject-menu-item {
        font-size: var(--font-size-sm);
        padding: var(--spacing-1) var(--spacing-2);
    }
    
    .copo-top-nav {
        padding: 0 var(--spacing-4);
    }
    
    .copo-tagline {
        display: none; /* Hide on mobile */
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.copo-text-center { text-align: center; }
.copo-text-left { text-align: left; }
.copo-text-right { text-align: right; }

.copo-mt-0 { margin-top: 0; }
.copo-mt-2 { margin-top: var(--spacing-2); }
.copo-mt-4 { margin-top: var(--spacing-4); }
.copo-mt-6 { margin-top: var(--spacing-6); }
.copo-mt-8 { margin-top: var(--spacing-8); }

.copo-mb-0 { margin-bottom: 0; }
.copo-mb-2 { margin-bottom: var(--spacing-2); }
.copo-mb-4 { margin-bottom: var(--spacing-4); }
.copo-mb-6 { margin-bottom: var(--spacing-6); }
.copo-mb-8 { margin-bottom: var(--spacing-8); }

.copo-hidden { display: none; }
.copo-visible { display: block; }

/* Screen reader only */
.copo-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}