/**
 * Browse by Year - Mobile Centered Layout Fix
 * Ensures all content is centered and readable on mobile devices
 */

/* ========================================
   BROWSE TAB - CENTERED LAYOUT
   ======================================== */

#browse-tab {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.browse-section {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

.browse-section h2 {
    text-align: center;
    width: 100%;
    margin: 0 auto 24px;
    padding: 0 16px;
    color: #2a5298;
    font-size: 1.5rem;
}

/* ========================================
   YEAR GRID - MOBILE CENTERED
   ======================================== */

.year-grid {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    justify-items: center;
    box-sizing: border-box;
}

.year-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
}

.year-card h3 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    font-weight: 700;
    color: #2a5298;
}

.year-card p {
    font-size: 0.9375rem;
    margin: 0;
    color: #666;
}

.document-breakdown {
    margin-top: 8px;
}

.document-breakdown small {
    font-size: 0.8125rem;
    color: #888;
}

/* ========================================
   YEAR RESULTS - CENTERED DOCUMENTS
   ======================================== */

#yearResults,
.year-results {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.year-results-header {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 24px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    text-align: center;
    box-sizing: border-box;
}

.year-results-header h3 {
    color: white;
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.year-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.stat-item {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: white;
}

.back-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 12px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.back-btn:active {
    transform: scale(0.97);
}

/* ========================================
   DOCUMENT CARDS IN YEAR VIEW - CENTERED
   ======================================== */

.year-results .ordinance-card,
.year-results .document-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    text-align: left;
}

.year-results .ordinance-number,
.year-results .document-number {
    font-size: 0.875rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    display: block;
    text-align: center;
    width: 100%;
}

.year-results .ordinance-title,
.year-results .document-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 12px;
    color: #333;
    text-align: center;
    width: 100%;
}

.year-results .ordinance-meta,
.year-results .document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 12px;
    text-align: center;
    justify-content: center;
    width: 100%;
}

.year-results .ordinance-excerpt,
.year-results .document-excerpt {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 16px;
    text-align: center;
    width: 100%;
}

.year-results .ordinance-actions,
.year-results .document-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 16px;
}

.year-results .view-ordinance-btn,
.year-results .view-pdf-btn,
.year-results .view-btn,
.year-results .pdf-btn {
    width: 100%;
    min-height: 48px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.year-results .view-ordinance-btn,
.year-results .view-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.year-results .view-pdf-btn,
.year-results .pdf-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.year-results .view-ordinance-btn:active,
.year-results .view-pdf-btn:active,
.year-results .view-btn:active,
.year-results .pdf-btn:active {
    transform: scale(0.97);
}

/* ========================================
   DOCUMENT TYPE FILTER - CENTERED
   ======================================== */

.document-type-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.document-type-filter .filter-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.document-type-filter .filter-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

.document-type-filter .filter-btn:active {
    transform: scale(0.97);
}

/* ========================================
   MOBILE OPTIMIZATIONS (320px+)
   ======================================== */

@media (max-width: 480px) {
    .browse-section {
        padding: 12px;
    }

    .browse-section h2 {
        font-size: 1.375rem;
        padding: 0 12px;
    }

    .year-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        padding: 0 4px;
    }

    .year-card {
        padding: 16px;
    }

    .year-card h3 {
        font-size: 1.5rem;
    }

    .year-results-header {
        padding: 16px;
    }

    .year-results-header h3 {
        font-size: 1.25rem;
    }

    .year-breakdown {
        gap: 6px;
    }

    .stat-item {
        font-size: 0.875rem;
        padding: 6px 12px;
    }

    .year-results .ordinance-card,
    .year-results .document-card {
        padding: 16px;
    }

    .year-results .ordinance-title,
    .year-results .document-title {
        font-size: 1rem;
    }
}

/* ========================================
   LARGER PHONES (375px+)
   ======================================== */

@media (min-width: 375px) {
    .year-results .ordinance-actions,
    .year-results .document-actions {
        flex-direction: row;
    }

    .year-results .view-ordinance-btn,
    .year-results .view-pdf-btn,
    .year-results .view-btn,
    .year-results .pdf-btn {
        flex: 1;
    }

    .document-type-filter {
        flex-direction: row;
    }

    .document-type-filter .filter-btn {
        flex: 1;
    }
}

/* ========================================
   TABLETS AND UP (768px+)
   ======================================== */

@media (min-width: 768px) {
    .browse-section {
        max-width: 720px;
        padding: 24px;
    }

    .browse-section h2 {
        font-size: 2rem;
        margin-bottom: 32px;
    }

    .year-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 16px;
        max-width: 720px;
    }

    .year-results-header {
        max-width: 720px;
        padding: 24px;
    }

    .year-breakdown {
        flex-direction: row;
        gap: 16px;
    }

    .year-results .ordinance-card,
    .year-results .document-card {
        max-width: 720px;
        padding: 24px;
    }

    .document-type-filter {
        max-width: 720px;
        padding: 20px;
    }
}

/* ========================================
   DESKTOP (1024px+)
   ======================================== */

@media (min-width: 1024px) {
    .browse-section {
        max-width: 960px;
    }

    .year-grid {
        max-width: 960px;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 20px;
    }

    .year-results-header {
        max-width: 960px;
    }

    .year-results .ordinance-card,
    .year-results .document-card {
        max-width: 960px;
    }

    .document-type-filter {
        max-width: 960px;
    }
}

/* ========================================
   LARGE DESKTOP (1200px+)
   ======================================== */

@media (min-width: 1200px) {
    .browse-section {
        max-width: 1140px;
    }

    .year-grid {
        max-width: 1140px;
    }

    .year-results-header {
        max-width: 1140px;
    }

    .year-results .ordinance-card,
    .year-results .document-card {
        max-width: 1140px;
    }

    .document-type-filter {
        max-width: 1140px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus indicators */
.year-card:focus,
.back-btn:focus,
.filter-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .year-card,
    .back-btn,
    .filter-btn {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .year-card,
    .back-btn,
    .filter-btn,
    .view-ordinance-btn,
    .view-pdf-btn {
        transition: none;
    }
}
