/**
 * Animal Adoption Gallery Styles
 */

/* Container */
.aag-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Filters */
.aag-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.aag-filter-form {
    display: block;
}

.aag-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.aag-filter-field {
    display: flex;
    flex-direction: column;
}

.aag-filter-field label {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
}

.aag-filter-field input[type="text"],
.aag-filter-field select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.aag-filter-field input[type="text"]:focus,
.aag-filter-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.aag-filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.aag-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.aag-btn-primary {
    background: #0073aa;
    color: white;
}

.aag-btn-primary:hover {
    background: #005a87;
}

.aag-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.aag-btn-secondary:hover {
    background: #e0e0e0;
}

/* Loading */
.aag-loading {
    text-align: center;
    padding: 40px;
}

.aag-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: aag-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes aag-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Gallery Grid - CSS Grid Layout */
.aag-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
    grid-auto-flow: row; /* Default to row direction */
}

/* Column layout option */
.aag-gallery[data-layout="column"] {
    grid-auto-flow: column;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-columns: minmax(200px, 1fr);
}

.aag-animal-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.aag-animal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.aag-animal-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.aag-animal-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio - forces equal heights */
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.aag-animal-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures images fill the space uniformly */
}

.aag-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #999;
    font-size: 14px;
}

.aag-animal-info {
    padding: 15px;
    flex-grow: 1; /* Allow info section to grow */
    display: flex;
    flex-direction: column;
}

.aag-animal-name {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.aag-animal-details {
    margin-bottom: 10px;
}

.aag-animal-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

.aag-animal-details strong {
    color: #333;
}

.aag-animal-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.aag-status-available {
    background: #d4edda;
    color: #155724;
}

.aag-status-adopted {
    background: #cce5ff;
    color: #004085;
}

.aag-status-foster {
    background: #fff3cd;
    color: #856404;
}

.aag-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Animal Details Page */
.aag-details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.aag-details-header {
    margin-bottom: 30px;
}

.aag-back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.aag-back-link:hover {
    text-decoration: underline;
}

.aag-details-title {
    margin: 0 0 10px 0;
    font-size: 36px;
    font-weight: 700;
}

.aag-details-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Gallery Section */
.aag-details-gallery {
    /* position: sticky;
    top: 20px; */
}

.aag-main-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.aag-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Video Container */
.aag-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
}

.aag-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Video Overlay on Thumbnails */
.aag-thumbnail {
    position: relative;
}

.aag-video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.aag-thumbnail:hover .aag-video-overlay {
    opacity: 1;
}

.aag-lightbox-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s ease;
}

.aag-lightbox-btn:hover {
    background: rgba(0,0,0,0.9);
}

.aag-thumbnail-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding-bottom: 5px; /* Space for scrollbar if shown */
}

.aag-thumbnail-gallery::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.aag-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.aag-thumbnail:hover,
.aag-thumbnail.active {
    border-color: #0073aa;
}

.aag-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aag-thumbnail-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.aag-scroll-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.aag-scroll-btn:hover {
    background: #005a87;
}

.aag-no-image-large {
    background: #f0f0f0;
    padding: 100px 20px;
    text-align: center;
    border-radius: 8px;
    color: #999;
}

/* Info Section */
.aag-details-info {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.aag-info-section h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.aag-info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    margin: 0;
}

.aag-info-list dt {
    font-weight: 600;
    color: #333;
}

.aag-info-list dd {
    margin: 0;
    color: #666;
}

.aag-description {
    line-height: 1.6;
    color: #666;
}

/* Lightbox */
.aag-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.aag-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}

.aag-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aag-lightbox-content img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.aag-lightbox-close,
.aag-lightbox-prev,
.aag-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    font-size: 40px;
    cursor: pointer;
    padding: 10px 20px;
    transition: background 0.3s ease;
    z-index: 10000;
}

.aag-lightbox-close:hover,
.aag-lightbox-prev:hover,
.aag-lightbox-next:hover {
    background: rgba(255,255,255,0.3);
}

.aag-lightbox-close {
    top: 20px;
    right: 20px;
}

.aag-lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.aag-lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.aag-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
}

/* Error Message */
.aag-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 992px) {
    .aag-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .aag-gallery[data-layout="column"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .aag-filter-row {
        grid-template-columns: 1fr;
    }
    
    .aag-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .aag-gallery[data-layout="column"] {
        grid-template-columns: 1fr;
    }
    
    .aag-details-title {
        font-size: 28px;
    }
    
    .aag-lightbox-prev,
    .aag-lightbox-next {
        font-size: 30px;
        padding: 5px 15px;
    }
}

@media (min-width: 1400px) {
    /* Ensure exactly 3 columns on large screens */
    .aag-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Made with Bob */
