/**
 * Tiles Widget - Frontend Styles
 * Version: 1.0.0
 */

/* Container */
.tiles-widget-container {
    width: 100%;
    position: relative;
}

/* Grid Layout */
.tiles-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Tile Item Base */
.tile-item {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2c2c2c;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 350px;
}

/* Tile Image */
.tile-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tile Overlay */
.tile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    z-index: 2;
}

/* Tile Content */
.tile-content {
    position: relative;
    z-index: 3;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.tile-content-inner {
    max-width: 100%;
}

/* Typography */
.tile-title {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tile-subtitle {
    margin: 0 0 20px 0;
    color: #ffffff;
    font-size: 16px;
    opacity: 0.9;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Button */
.tile-button-wrapper {
    margin-top: 20px;
}

.tile-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background-image: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tile-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(118, 75, 162, 0.35);
}

.tile-button .button-icon {
    display: inline-flex;
    transition: transform 0.3s ease;
}

.tile-button:hover .button-icon {
    transform: translateX(4px);
}

/* Hover Effects */
.tile-item:hover .tile-overlay {
    opacity: 0.6;
}

/* Animation: Zoom */
[data-animation="zoom"] .tile-item:hover .tile-image img {
    transform: scale(1.1);
}

/* Animation: Slide */
[data-animation="slide"] .tile-item:hover .tile-image img {
    transform: translateX(10px);
}

/* Animation: Rotate */
[data-animation="rotate"] .tile-item:hover .tile-image img {
    transform: scale(1.05) rotate(2deg);
}

/* Animation: Blur */
[data-animation="blur"] .tile-item:hover .tile-image img {
    filter: blur(2px);
    transform: scale(1.05);
}

/* Layout: Overlay (Default) */
.layout-overlay .tile-item {
    border-radius: 0;
}

/* Layout: Card */
.layout-card .tile-item {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.layout-card .tile-content {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    justify-content: flex-end;
    text-align: left;
    align-items: flex-start;
    padding-bottom: 40px;
}

.layout-card .tile-title,
.layout-card .tile-subtitle {
    text-align: left;
}

.layout-card .tile-item:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Layout: Minimal */
.layout-minimal .tile-overlay {
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
}

.layout-minimal .tile-content {
    justify-content: flex-end;
    padding-bottom: 40px;
}

.layout-minimal .tile-button {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
}

.layout-minimal .tile-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(118, 75, 162, 0.35);
}

/* Layout: Hover Lift */
.layout-hover-lift .tile-item {
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.layout-hover-lift .tile-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Layout: Gradient */
.layout-gradient .tile-overlay {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
}

.layout-gradient .tile-item:hover .tile-overlay {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
}

/* Layout: Modern */
.layout-modern .tile-item {
    border-radius: 16px;
    background: #1a1a1a;
}

.layout-modern .tile-border {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6347, #FFD700);
    background-size: 300% 300%;
    border-radius: 16px;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: gradientShift 3s ease infinite;
}

.layout-modern .tile-item:hover .tile-border {
    opacity: 1;
}

.layout-modern .tile-image,
.layout-modern .tile-overlay,
.layout-modern .tile-content {
    border-radius: 14px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Lightbox */
.tiles-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.tiles-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.3s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .tile-item {
        min-height: 300px;
    }
    
    .tile-content {
        padding: 20px;
    }
    
    .tile-title {
        font-size: 20px;
    }
    
    .tile-subtitle {
        font-size: 14px;
    }
    
    .tile-button {
        padding: 10px 20px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .tiles-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .tile-item {
        min-height: 250px;
    }
    
    .tile-content {
        padding: 15px;
    }
    
    .tile-title {
        font-size: 18px;
    }
}

/* Accessibility */
.tile-item:focus-within {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

.tile-button:focus {
    outline: 3px solid #000000;
    outline-offset: 2px;
}

/* Loading State */
.tiles-grid.loading .tile-item {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Print Styles */
@media print {
    .tiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tile-overlay {
        opacity: 0.2 !important;
    }
    
    .tile-button {
        display: none;
    }
}

/* Stretched link to make the whole tile clickable (only when lightbox off) */
.tile-stretched-link{
    position:absolute;
    top:0;left:0;right:0;bottom:0;
    z-index:5;
    text-indent:-9999px;
}
.tile-item { position: relative; }
