/* Frontend Styles for Coloring Pages Generator */

/* Gallery Grid Layout */
.cpg-gallery {
    margin: 20px 0;
}

.cpg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.cpg-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    background: white;
}

.cpg-gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.cpg-gallery-item.focused {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.cpg-gallery-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.cpg-gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cpg-gallery-item:hover img {
    transform: scale(1.05);
}

.cpg-gallery-item img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.cpg-gallery-item img:not(.lazy) {
    opacity: 1;
}

/* Gallery Overlay */
.cpg-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 25px 15px 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cpg-gallery-item:hover .cpg-gallery-overlay,
.cpg-gallery-overlay.visible {
    transform: translateY(0);
}

.cpg-gallery-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

/* Title below image styles */
.cpg-gallery-title-below {
    padding: 10px 15px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.cpg-gallery-title-below .cpg-gallery-title {
    color: #495057;
    font-size: 13px;
    line-height: 1.5;
}

/* Attachment Page Styles */
.cpg-attachment-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cpg-breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: #6c757d;
}

.cpg-breadcrumbs a {
    color: #007cba;
    text-decoration: none;
    transition: color 0.3s;
}

.cpg-breadcrumbs a:hover {
    color: #005a87;
    text-decoration: underline;
}

.cpg-breadcrumbs .separator {
    margin: 0 8px;
    color: #adb5bd;
}

.cpg-breadcrumbs .current {
    color: #495057;
    font-weight: 500;
}

.cpg-back-button {
    margin-bottom: 30px;
}

.cpg-attachment-title {
    font-size: 1.5rem;
    font-weight: 400;
    color: #212529;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.2;
}

.cpg-attachment-image {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.cpg-attachment-image img {
    max-width: 80%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.cpg-attachment-image img:hover {
    transform: scale(1.02);
}

/* Action Buttons */
.cpg-attachment-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.cpg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,124,186,0.3);
    position: relative;
    overflow: hidden;
}

.cpg-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.cpg-btn:hover::before {
    left: 100%;
}

.cpg-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,124,186,0.4);
    color: white;
}

.cpg-btn-secondary {
    background: #6c757d;
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

.cpg-btn-secondary:hover {
    background: #545b62;
    box-shadow: 0 6px 20px rgba(108,117,125,0.4);
}

.cpg-btn:active {
    transform: translateY(0);
}

/* Content Sections */
.cpg-attachment-description,
.cpg-attachment-details {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.cpg-attachment-description h3,
.cpg-attachment-details h3 {
    color: #212529;
    font-size: 1rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007cba;
}

.cpg-attachment-description p {
    color: #495057;
    line-height: 1.6;
    font-size: 16px;
}

.details-grid {
    display: grid;
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #495057;
}

.detail-value {
    color: #6c757d;
    font-family: 'Courier New', monospace;
}

/* Related Images */
.cpg-related-images {
    margin-top: 60px;
}

.cpg-related-images h3 {
    font-size: 1rem;
    color: #212529;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.cpg-related-images h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #007cba;
    border-radius: 2px;
}

.cpg-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 colunas no PC */
    gap: 20px;
    margin-top: 30px;
}

.cpg-related-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.cpg-related-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.cpg-related-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cpg-related-item:hover img {
    transform: scale(1.1);
}

.related-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cpg-related-item:hover .related-overlay {
    transform: translateY(0);
}

.related-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

/* Search and Filter */
.cpg-search-filter {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

#cpg-search {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#cpg-search:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
}

.cpg-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cpg-filter-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.cpg-filter-btn:hover,
.cpg-filter-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

#search-results-count {
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
}

/* Share Buttons */
.cpg-share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.cpg-share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 18px;
}

.cpg-share-btn:hover {
    transform: scale(1.1);
    color: white;
}

.cpg-share-btn[data-platform="facebook"] { background: #1877f2; }
.cpg-share-btn[data-platform="twitter"] { background: #1da1f2; }
.cpg-share-btn[data-platform="pinterest"] { background: #bd081c; }
.cpg-share-btn[data-platform="whatsapp"] { background: #25d366; }

/* Loading States */
.cpg-gallery-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.cpg-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .cpg-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .cpg-related-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas no celular */
    }
    
    .cpg-gallery-item img {
        height: 200px;
    }
    
    .cpg-attachment-page {
        padding: 15px;
    }
    
    .cpg-attachment-title {
        font-size: 2rem;
    }
    
    .cpg-attachment-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .cpg-btn {
        width: 200px;
        justify-content: center;
    }
    
    .cpg-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cpg-search-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    #cpg-search {
        min-width: auto;
    }
    
    .cpg-filter-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cpg-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .cpg-attachment-title {
        font-size: 1.5rem;
    }
    
    .cpg-btn {
        width: 100%;
        padding: 16px;
    }
    
    .cpg-related-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .cpg-attachment-actions,
    .cpg-breadcrumbs,
    .cpg-back-button,
    .cpg-related-images,
    .cpg-share-buttons {
        display: none !important;
    }
    
    .cpg-attachment-page {
        padding: 0;
        max-width: none;
    }
    
    .cpg-attachment-image {
        background: none;
        box-shadow: none;
        padding: 0;
    }
    
    .cpg-attachment-image img {
        max-width: 100%;
        box-shadow: none;
    }
    
    .cpg-attachment-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
}

/* Accessibility */
.cpg-gallery-item a:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.cpg-btn:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cpg-gallery-item,
    .cpg-gallery-item img,
    .cpg-gallery-overlay,
    .cpg-btn,
    .cpg-related-item {
        transition: none;
    }
    
    .cpg-loading-spinner {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cpg-gallery-item {
        border: 2px solid #000;
    }
    
    .cpg-btn {
        border: 2px solid #000;
    }
    
    .cpg-pagination a,
    .cpg-pagination span {
        border: 2px solid #000;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .cpg-attachment-page {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .cpg-attachment-title {
        color: #e0e0e0;
    }
    
    .cpg-attachment-description,
    .cpg-attachment-details {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .cpg-attachment-description h3,
    .cpg-attachment-details h3 {
        color: #e0e0e0;
    }
    
    .cpg-gallery-item {
        background: #2a2a2a;
    }
    
    .cpg-search-filter {
        background: #2a2a2a;
    }
    
    #cpg-search {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .cpg-filter-btn {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }
}



@media (max-width: 768px) {
    .cpg-attachment-page {
        background: white !important;
        color: #212529 !important;
    }
	.cpg-attachment-image img {
	max-width: 100% !important;
	height: auto !important;
 Â   }
    .cpg-attachment-title {
        color: #212529 !important;
    }
    .cpg-attachment-description,
    .cpg-attachment-details {
        background: white !important;
        border-color: #e9ecef !important;
    }
    .cpg-attachment-description h3,
    .cpg-attachment-details h3 {
        color: #212529 !important;
    }
}




/* Container do Grid para Outros Artigos */
.cpg-other-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Responsividade especÃ­fica */
@media (max-width: 768px) {
    .cpg-other-articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .cpg-other-articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1025px) {
    .cpg-other-articles-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1400px) {
    .cpg-other-articles-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1200px;
    }
}

/* Container do Grid para Outros Artigos */
.cpg-other-articles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Responsividade especÃ­fica */
@media (max-width: 768px) {
    .cpg-other-articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 16px;
    }
}

/* Other Articles Items */
.cpg-other-article-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.cpg-other-article-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.cpg-other-article-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.cpg-other-article-item:hover img {
    transform: scale(1.05);
}

.cpg-other-article-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35); /* leve escurecimento */
    z-index: 1;
    transition: background 0.3s ease;
}

.cpg-other-article-item:hover::after {
    background: rgba(0,0,0,0.5);
}

.other-article-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    z-index: 2; /* acima do fundo escurecido */
    padding: 0 15px;
    line-height: 1.3;
    transition: all 0.3s ease;
}

.cpg-other-article-item:hover .other-article-title {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Responsividade do tÃ­tulo */
@media (max-width: 480px) {
    .other-article-title {
        font-size: 16px;
        padding: 0 12px;
    }
}

@media (min-width: 1200px) {
    .other-article-title {
        font-size: 20px;
    }
}


