/* ============================================
   PAGES.CSS - Shared Page Layout Styles
   Common styles for characters, threads, ledger, artwork pages
   ============================================ */

/* ============================================
   Main Container Layout
   ============================================ */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin: 0;
}

/* ============================================
   Search Input
   ============================================ */
.search-container input {
    width: 100%;
    padding: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    outline: none;
    border-bottom: 3px solid var(--text-primary, #333);
    background: transparent;
    color: var(--text-primary, #333);
}

.search-container input:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}

.search-container input::placeholder {
    color: var(--text-secondary, #666);
    opacity: 0.7;
}

/* ============================================
   Section Toggle Buttons
   ============================================ */
.section-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ============================================
   Grid Layout
   ============================================ */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Filter Tabs
   ============================================ */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.filter-tab {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-tab:hover {
    background: var(--bg-hover);
}

.filter-tab.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* ============================================
   Summary Cards - extends .card
   ============================================ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    padding: 1.25rem;
    text-align: center;
}

/* Disable hover effect on summary cards */
.summary-card:hover {
    transform: none;
    box-shadow: none;
}

.summary-card-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.summary-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-color);
}

.summary-card-value.xp {
    color: #22c55e;
}

.summary-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================
   Empty & Loading States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ============================================
   Card Edit Link - hover-reveal edit button
   ============================================ */
.card {
    position: relative;
}

.card-edit-link {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: none;
    color: var(--text-tertiary, #999);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10;
}

.card-edit-link:hover {
    opacity: 1;
    color: var(--accent-blue-dark, #124f8c);
}

.card:hover .card-edit-link {
    display: block;
}

/* ============================================
   Lightbox (shared for artwork, etc)
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.lightbox.active {
    display: flex;
    animation: lightbox-fadeIn 0.3s;
}

.lightbox-content {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    color: white;
    margin-top: 15px;
    font-size: 1.2em;
    text-align: center;
    background-color: #3c3b3b;
    padding: 0 5px;
    margin-top: -50px;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    top: max(20px, env(safe-area-inset-top));
    right: 30px;
    right: max(30px, env(safe-area-inset-right));
    color: rgb(151, 151, 151);
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    background: none;
    border: none;
    padding: 10px;
    line-height: 1;
    z-index: 1001;
}

.lightbox-close:hover {
    color: #535353;
    transform: scale(1.1);
}

@keyframes lightbox-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}