/* ============================================
   ARCHIVES LIGUE TIR PROVENCE
   CSS Principal - Style Bootstrap-like
   ============================================ */

/* ---------- Variables CSS ---------- */
:root {
    --primary: #8B0000;
    --primary-dark: #5c0000;
    --secondary: #6c757d;
    --success: #28a745;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-base: 1rem;
    --line-height-base: 1.5;
    
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    
    --transition: all 0.2s ease-in-out;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: var(--line-height-base);
    color: var(--gray-900);
    background-color: var(--gray-100);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col {
    flex: 1;
    padding: 0 0.75rem;
}

/* ---------- Header ---------- */
.header {
    background: var(--white);
    padding: 0.75rem 0 0 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    /*color: #F62963;*/
	color: #585858;
}

.header-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.95rem;
    color: var(--gray-600);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-logo img {
    height: 120px;
    width: auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-right {
    text-align: right;
}

.back-link {
    color: #F62963;
    font-size: 0.95rem;
    text-decoration: underline;
}

.back-link:hover {
    color: #d41e50;
}

.header-separator {
    height: 5px;
    background-color: #F62963;
    margin-top: 0.75rem;
}

.header-stats {
    font-size: 0.875rem;
    opacity: 0.9;
    text-align: right;
}

/* ---------- Filtres ---------- */
.filters {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    margin: 1.5rem 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--white);
    border: 1px solid var(--gray-400);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.15);
}

.form-control::placeholder {
    color: var(--gray-500);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
    appearance: none;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-primary {
    color: var(--white);
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    color: var(--white);
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    text-decoration: none;
}

.btn-outline {
    color: var(--gray-700);
    background-color: transparent;
    border-color: var(--gray-400);
}

.btn-outline:hover {
    background-color: var(--gray-200);
    text-decoration: none;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ---------- Results Info ---------- */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.results-count {
    font-weight: 500;
    color: var(--gray-700);
}

.results-count strong {
    color: var(--primary);
}

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

/* ---------- Article Card ---------- */
.article-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.article-card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.article-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--gray-200);
}

.article-thumbnail-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 3rem;
}

.article-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.article-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    flex: 1;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--gray-600);
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

.article-date {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.article-docs {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--success);
    font-weight: 500;
}

/* ---------- Article Documents List ---------- */
.article-documents {
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
}

.doc-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    font-size: 0.8125rem;
    color: var(--gray-700);
    transition: var(--transition);
}

.doc-link:hover {
    color: var(--primary);
}

.doc-link svg {
    flex-shrink: 0;
}

.doc-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled):not(.active) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.page-btn.active {
    color: var(--white);
    background: var(--primary);
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-600);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ---------- Loading ---------- */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--gray-600);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Footer ---------- */
.footer {
    background: var(--gray-800);
    color: var(--gray-400);
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    font-size: 0.875rem;
}

.footer a {
    color: var(--gray-300);
}

.footer a:hover {
    color: var(--white);
}

/* ---------- Icons (inline SVG) ---------- */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

.icon-lg {
    width: 1.25em;
    height: 1.25em;
}

/* ---------- Utilities ---------- */
.text-muted { color: var(--gray-600); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.25rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .header-logo img {
        height: 80px;
    }
    
    .header-center {
        order: 2;
    }
    
    .header-right {
        order: 3;
        text-align: center;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .results-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .pagination {
        gap: 0.25rem;
    }
    
    .page-btn {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .filters {
        padding: 1rem;
    }
    
    .article-thumbnail,
    .article-thumbnail-placeholder {
        height: 150px;
    }
}

/* ---------- Modal ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-lg);
    max-width: 900px;
    width: 100%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: var(--gray-200);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-700);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-300);
    color: var(--gray-900);
}

.modal-header {
    padding: 1.5rem 3rem 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-category {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #F62963;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.modal-date {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    line-height: 1.7;
    color: var(--gray-800);
}

.modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: var(--border-radius);
}

.modal-body a {
    color: #F62963;
}

.modal-body a:hover {
    color: #d41e50;
}

.modal-body p {
    margin-bottom: 1rem;
}

/* Empêcher le scroll du body quand la modal est ouverte */
body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .modal {
        padding: 1rem 0.5rem;
    }
    
    .modal-header {
        padding: 1rem 2.5rem 1rem 1rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* ---------- Print ---------- */
@media print {
    .header {
        position: static;
        background: var(--gray-800);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .filters,
    .pagination,
    .footer {
        display: none;
    }
    
    .articles-grid {
        display: block;
    }
    
    .article-card {
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
