/**
 * Library Styles - Symbols, Patterns, Lenny
 * Extends ugc.css patterns
 * @version 1.0.0
 */

/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */
:root {
    --library-primary: #2E7D32;
    --library-primary-dark: #2E7D32;
    --library-success: #1B5E20;
    --library-border: #e0e0e0;
    --library-text-light: #666;
    --library-radius: 8px;
    --library-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --library-shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

/* ==========================================================================
   QUICK ACCESS ROW (Hero section)
   ========================================================================== */
.quick-access {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 20px 0 40px;
    padding: 15px 0 15px;
}

.quick-item {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    text-decoration: none;
    line-height: 1;
}

.quick-item:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
    text-decoration: none;
    color: white;
}

.quick-item.copied {
    background: var(--library-success);
    border-color: var(--library-success);
}

/* Patterns need smaller font in quick access */
.quick-item--pattern {
    font-size: 14px;
    padding: 10px 14px;
}

/* Lenny faces medium font */
.quick-item--lenny {
    font-size: 16px;
    padding: 10px 14px;
}

/* ==========================================================================
   CATEGORY CARDS (Index pages)
   ========================================================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.category-card {
    background: white;
    border-radius: var(--library-radius);
    padding: 25px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--library-shadow);
    transition: all 0.2s ease;
    display: block;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--library-shadow-hover);
    text-decoration: none;
    color: inherit;
}

.category-card-preview {
    font-size: 28px;
    margin-bottom: 15px;
    letter-spacing: 4px;
    line-height: 1.4;
    word-break: break-word;
    overflow: hidden;
    max-height: 80px;
}

/* Patterns preview - smaller font */
.category-card--pattern .category-card-preview {
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.8;
}

/* Lenny preview - medium font */
.category-card--lenny .category-card-preview {
    font-size: 18px;
    letter-spacing: 0;
}

.category-card h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #222;
}

.category-card-count {
    font-size: 14px;
    color: var(--library-text-light);
    margin: 0;
}

/* ==========================================================================
   ITEMS GRID (View pages)
   ========================================================================== */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin: 30px 0;
}

/* Wider grid for patterns */
.library-grid--patterns {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Medium grid for lenny faces */
.library-grid--lenny {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* ==========================================================================
   INDIVIDUAL ITEMS
   ========================================================================== */
.library-item {
    background: white;
    border: 1px solid var(--library-border);
    border-radius: var(--library-radius);
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.library-item:hover {
    border-color: var(--library-primary);
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.15);
    transform: translateY(-2px);
}

.library-item:active {
    transform: translateY(0);
}

.library-item.copied {
    background: var(--library-success);
    border-color: var(--library-success);
    color: white;
}

.library-item.copied .library-item-name {
    color: rgba(255,255,255,0.9);
}

/* Symbol character display */
.library-item-char {
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 8px;
    word-break: break-word;
}

/* Pattern display - smaller */
.library-item--pattern {
    min-height: 60px;
    padding: 12px 15px;
}

.library-item--pattern .library-item-char {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-bottom: 0;
}

/* Lenny face display */
.library-item--lenny {
    min-height: 70px;
    padding: 12px;
}

.library-item--lenny .library-item-char {
    font-size: 18px;
    margin-bottom: 0;
    white-space: nowrap;
}

/* Item name/label */
.library-item-name {
    font-size: 11px;
    color: var(--library-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 4px;
}

/* Unicode code display */
.library-item-code {
    font-size: 10px;
    color: #999;
    font-family: monospace;
    margin-top: 2px;
}

/* ==========================================================================
   RELATED CATEGORIES SECTION
   ========================================================================== */
.related-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #eee;
}

.related-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.related-card {
    background: #f8f9fa;
    border-radius: var(--library-radius);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    text-align: center;
}

.related-card:hover {
    background: #fff;
    box-shadow: var(--library-shadow);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.related-card-preview {
    font-size: 22px;
    margin-bottom: 10px;
}

.related-card h4 {
    font-size: 14px;
    margin: 0;
    color: #333;
}

/* ==========================================================================
   CROSS-LINKS SECTION
   ========================================================================== */
.cross-links {
    margin-top: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    text-align: center;
}

.cross-links h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.cross-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.cross-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: white;
    border: 1px solid var(--library-border);
    border-radius: 25px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cross-link:hover {
    border-color: var(--library-primary);
    color: var(--library-primary);
    text-decoration: none;
}

.cross-link-icon {
    font-size: 18px;
}

/* ==========================================================================
   SEO CONTENT SECTION
   ========================================================================== */
.seo-content {
    margin-top: 60px;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 12px;
}

.seo-content h2 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #222;
}

.seo-content p {
    color: #555;
    line-height: 1.7;
    margin-bottom: 15px;
}

.seo-content ul {
    margin: 15px 0;
    padding-left: 25px;
}

.seo-content li {
    margin-bottom: 8px;
    color: #555;
}

/* ==========================================================================
   STATS BAR
   ========================================================================== */
.stats-bar {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--library-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--library-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   COPY ALL BUTTON
   ========================================================================== */
.copy-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--library-primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 20px 0;
}

.copy-all-btn:hover {
    background: var(--library-primary-dark);
    transform: translateY(-1px);
}

.copy-all-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   BREADCRUMBS (Override/extend from base)
   ========================================================================== */
.breadcrumbs {
    font-size: 14px;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.7);
}

.breadcrumbs a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: white;
    text-decoration: underline;
}

/* ==========================================================================
   HERO SUBTITLE
   ========================================================================== */
.hero-subtitle {
    font-size: 18px;
    color: rgba(255,255,255,0.85);
    margin-top: 10px;
}

/* ==========================================================================
   NO RESULTS
   ========================================================================== */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.no-results p {
    color: var(--library-text-light);
    margin-bottom: 25px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    /* Quick access */
    .quick-access {
        gap: 12px;
        padding: 12px 0 12px;
    }
    
    .quick-item {
        font-size: 20px;
        padding: 10px 14px;
    }
    
    /* Category grid */
    .category-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-card {
        padding: 20px;
    }
    
    .category-card-preview {
        font-size: 24px;
    }
    
    /* Items grid */
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }
    
    .library-grid--patterns {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .library-grid--lenny {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .library-item {
        padding: 10px 5px;
        min-height: 60px;
    }
    
    .library-item-char {
        font-size: 24px;
    }
    
    .library-item-name {
        display: none;
    }
    
    .library-item-code {
        display: none;
    }
    
    /* Related grid */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Cross links */
    .cross-links {
        padding: 20px;
    }
    
    .cross-link {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    /* SEO content */
    .seo-content {
        padding: 25px 20px;
    }
    
    /* Stats bar */
    .stats-bar {
        gap: 20px;
    }
    
    .stat-number {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 6px;
    }
    
    .library-item-char {
        font-size: 20px;
    }
    
    .library-grid--patterns {
        grid-template-columns: 1fr 1fr;
    }
    
    .library-grid--lenny {
        grid-template-columns: 1fr 1fr;
    }
    
    .library-item--pattern .library-item-char,
    .library-item--lenny .library-item-char {
        font-size: 14px;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */
.library-item:focus,
.quick-item:focus,
.category-card:focus {
    outline: 2px solid var(--library-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   SNIPPET ANSWER (Category Introduction)
   ========================================================================== */
.snippet-answer {
    background: #f8f9fb;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid var(--library-primary);
}

.snippet-answer p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

.snippet-answer p:first-child {
    font-weight: 500;
}
