:root {
    --bg-color: #F8F9FA;
    --primary-color: #007782;
    /* Cyan/Vert d'eau Vinted-style */
    --primary-hover: #005f68;
    --text-main: #171717;
    /* Dark Grey */
    --text-secondary: #757575;
    --white: #FFFFFF;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --danger-color: #e74c3c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

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

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--white);
    padding: 0.8rem 1.2rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    text-decoration: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #f0f0f0;
    color: var(--text-main);
}

.btn-back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-main);
    margin-right: 0.5rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin: 0;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.02em;
    padding-left: 10px;
    /* Mobile safe padding */
}

@media (min-width: 768px) {
    h1 {
        padding-left: 20px;
        /* More padding on PC */
    }
}

/* --- Hero Banner --- */
.hero-banner {
    background: linear-gradient(135deg, #e0f7fa 0%, #fff 100%);
    padding: 2.5rem 1rem;
    text-align: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.hero-banner h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.hero-banner p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* --- Views Management --- */
.view-section {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.3s ease;
    flex: 1;
}

.view-section.active {
    display: block;
}

/* --- Home Menu Grid --- */
.category-menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 0.5rem;
}

.category-card {
    background: var(--white);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.2rem;
}

.category-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* --- Filters (Listing View) --- */
.filters-bar {
    display: none;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 5px;
    margin-top: 1rem;
    scrollbar-width: none;
    align-items: center;
}

.filters-bar::-webkit-scrollbar {
    display: none;
}

.filter-select,
.filter-search {
    padding: 10px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    /* Pill shape */
    font-size: 0.9rem;
    background: var(--white);
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    font-family: var(--font-body);
    font-weight: 500;
    min-width: 120px;
    outline: none;
}

.filter-select:hover,
.filter-search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 119, 130, 0.1);
}

.filter-search {
    border-radius: 50px;
    min-width: 150px;
}

.filter-btn:hover {
    background: #f8f8f8;
}

/* --- Items Grid --- */
.items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (min-width: 768px) {
    .items-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }

    .category-menu {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Card Design --- */
.card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-img-container {
    width: 100%;
    aspect-ratio: 3/4;
    background-color: #f4f4f4;
    overflow: hidden;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.card:hover .card-img {
    transform: scale(1.05);
}

.card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-date {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.card-desc {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.btn-action {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: auto;
    width: 100%;
    font-size: 0.95rem;
    transition: background 0.2s;
    font-family: var(--font-heading);
}

.btn-action:hover {
    background-color: var(--primary-hover);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 3rem 1rem;
    background-color: #f8f9fa;
    /* Light gray background */
    border-top: 1px solid #eee;
    margin-top: 4rem;
    font-size: 0.9rem;
    color: #666;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.footer-school {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.footer-school-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    /* Darker */
}

.footer-address {
    font-size: 0.85rem;
    color: #777;
}

.footer-pill {
    background-color: #e0f2f1;
    /* Soft teal to match aesthetics */
    color: #00695c;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.footer-legal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #777;
    margin-top: 1rem;
}

.footer-legal-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.footer-link {
    color: #555;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.divider {
    color: #ccc;
    font-size: 0.8rem;
}

/* Simplified Footer (Listing View) */
.footer-simple .footer-school,
.footer-simple .footer-pill {
    display: none;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.code-box {
    background: #f0f0f0;
    padding: 1rem;
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 2px;
    border-radius: 8px;
    margin: 1rem 0;
    color: var(--text-main);
    border: 2px dashed #ddd;
}

.btn-close {
    background: transparent;
    border: 1px solid #ccc;
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #f9f9f9;
    border-color: #999;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}