/* ==========================================================================
   Text Alignment Utilities
   ========================================================================== */
.text-justify-center {
    text-align: center;
}

.text-justify-left {
    text-align: left;
}

/* ==========================================================================
   Tab Components
   ========================================================================== */
.tabs {
    text-align: center;
    margin-bottom: 20px;
}

.tab-link {
    background-color: var(--nav-bg-color);
    color: var(--text-color);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: background-color 0.2s;
    cursor: pointer;
    margin: 0 5px;
}

.tab-link:hover, .tab-link.active {
    background-color: var(--link-hover-color);
    color: var(--main-color);
}

/* ==========================================================================
   Title Components
   ========================================================================== */
.page-main-title {
    background-color: var(--bg-color);
    border: 3px solid var(--link-hover-color);
    border-radius: 15px;
    padding: 10px 30px;
    text-align: center;
    margin-bottom: 30px;
    display: inline-block; /* Ensures the border fits the content */
}

.page-main-title h1 {
    font-family: 'Lora', serif;
    font-size: 2.8em;
    margin: 0;
}

.content-section h2 {
    font-family: 'Lora', serif;
    font-size: 2em;
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid var(--nav-bg-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Backwards compatibility for series page title if it's still in use */
.series-page-title {
    background-color: var(--bg-color);
    border: 3px solid var(--link-hover-color);
    border-radius: 15px;
    padding: 10px 30px;
    text-align: center;
    margin-bottom: 30px;
}

.series-page-title h2 {
    font-family: 'Lora', serif;
    font-size: 2.5em;
    margin: 0;
    border-bottom: none; /* Override the border from the general h2 */
}


/* ==========================================================================
   Grid Components
   ========================================================================== */
.series-grid,
.gallery-grid,
.product-grid {
    display: grid;
    column-gap: 25px;
    row-gap: 50px;
    padding-bottom: 25px; /* Add space after the last row of the grid */
}

.series-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* --- Dynamic Gallery Grid Classes --- */
.gallery-grid.grid-cols-1 { grid-template-columns: 1fr; }
.gallery-grid.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-grid.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-grid.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }


/* --- Responsive Grid Adjustments --- */
@media (max-width: 992px) {
    .gallery-grid.grid-cols-4, .gallery-grid.grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .series-grid, 
    .gallery-grid.grid-cols-4, .gallery-grid.grid-cols-3, .gallery-grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .series-grid,
    .gallery-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Grid View Controls
   ========================================================================== */
.grid-view-controls {
    text-align: right;
    margin-bottom: 20px;
}

.view-btn {
    background-color: var(--nav-bg-color);
    color: var(--text-color);
    border: 2px solid var(--link-hover-color);
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s, color 0.2s;
}

.view-btn:hover {
    background-color: var(--link-hover-color);
    color: var(--main-color);
}

.view-btn.active {
    background-color: var(--link-hover-color);
    color: var(--main-color);
}


/* ==========================================================================
   Card Components
   ========================================================================== */

/* --- Base Card Style --- */
.card {
    background-color: transparent;
    color: var(--text-color);
    text-align: center;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
}

.card img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.card .card-info {
    padding: 15px 5px;
}

/* --- Structured Grid Card (for series index, resource images, and gallery lists) --- */
.series-grid .card,
.resource-images .card,
.gallery-grid .card {
    background-color: var(--main-color);
    border: 3px solid var(--link-hover-color);
    border-radius: 12px;
    padding: 10px;
}

.card .card-header {
    height: 1.5em; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.card .card-header h2,
.card .card-header h3 {
    margin: 0;
    font-size: 1.2em;
    line-height: 1.2;
    border-bottom: none;
}

.card .card-image-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.card .card-image-container img {
    max-height: 400px;
    width: auto;
    object-fit: contain;
}

.card .card-footer {
    margin-top: auto;
    padding: 5px;
}

/* ==========================================================================
   Redemption Card Specific Styling
   ========================================================================== */
.redemption-card {
    max-width: 20%;
    margin: 0 auto; /* Center the smaller card within its grid container */
}

.redemption-letter {
    max-width: 50%; /* Make the letter larger */
    margin: 0 auto;
}


/* ==========================================================================
   Button Components
   ========================================================================== */
.series-grid-button {
    background-color: var(--link-hover-color);
    color: var(--main-color);
    border-radius: 8px;
    padding: 10px 20px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: background-color 0.2s;
}

.series-grid-button:hover {
    background-color: var(--text-color);
}

.card-info a.series-grid-button,
.card-footer a.series-grid-button {
    transition: background-color 0.2s, transform 0.2s;
}

.card-info a.series-grid-button:hover,
.card-footer a.series-grid-button:hover {
    transform: translateY(-2px);
}

/* ==========================================================================
   Catalogue Form
   ========================================================================== */
.catalogue-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Justify to the left */
    gap: 20px; /* Vertical spacing between rows */
}

.catalogue-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 25px; /* Spacing between form elements in a row */
    width: 100%;
}

.catalogue-form .form-group {
    display: flex;
    flex-direction: column; /* Stack label on top of input */
    gap: 5px;
    flex: 1; /* Allow groups to grow */
    min-width: 200px; /* Prevent elements from becoming too small */
}

.catalogue-form .form-group label {
    font-weight: bold;
    text-align: left;
}

.catalogue-form .form-group select,
.catalogue-form .form-group input {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--nav-bg-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1em;
}

.catalogue-form .form-group button {
    align-self: flex-end; /* Align button to the bottom of its container */
    height: 100%;
}

.form-row-adv {
    display: flex;
    gap: 25px;
    width: 100%;
}
.form-group-adv {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--nav-bg-color);
    padding: 10px;
    border-radius: 5px;
    text-align: left;
}
.checkbox-list div {
    margin-bottom: 5px;
}

/* --- Catalogue Contents Summary --- */
.catalogue-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    background-color: #2d3748; /* A slightly lighter shade from your theme */
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #4a5568; /* Border color from your theme */
    margin-bottom: 0.5rem; /* Adjusted back to 2rem for better spacing */
}
.summary-item {
    background-color: #1a202c; /* Main dark background from your theme */
    padding: 7px;
    border-radius: 6px;
    text-align: center;
    font-size: 1em;
    color: #cbd5e0; /* A light text color from your theme */
}
.summary-item strong {
    display: block;
    margin-bottom: 8px;
    color: #a0aec0; /* A slightly dimmer text color for the label */
    font-family: 'Roboto', sans-serif;
}