/* Gallery Page Styles */

.gallery-page {
    min-height: 100vh;
    background: #1a1a2e;
    color: white;
}

.gallery-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.gallery-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
}

.gallery-header p {
    margin: 0;
    color: #888;
    font-size: 16px;
}

/* Search bar */
.gallery-search {
    max-width: 600px;
    margin: 20px auto 0;
    display: flex;
    gap: 10px;
}

.gallery-search input {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #2d2d2d;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

.gallery-search input:focus {
    border-color: #667eea;
}

.gallery-search input::placeholder {
    color: #666;
}

.gallery-search button {
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-search button:hover {
    transform: translateY(-1px);
}

/* Gallery grid */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Fiddle card */
.fiddle-card {
    background: #2d2d2d;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.fiddle-card-thumbnail {
    width: 100%;
    height: 180px;
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.fiddle-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fiddle-card-thumbnail .placeholder {
    color: #444;
    font-size: 48px;
}

.fiddle-card-content {
    padding: 16px;
}

.fiddle-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fiddle-card-url {
    font-size: 13px;
    color: #667eea;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fiddle-card-description {
    font-size: 13px;
    color: #888;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fiddle-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.fiddle-card-hits {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fiddle-card-hits i {
    color: #888;
}

/* Loading state */
.gallery-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.gallery-loading i {
    font-size: 32px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty state */
.gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.gallery-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gallery-empty h3 {
    margin: 0 0 8px 0;
    color: #888;
}

.gallery-empty p {
    margin: 0;
}

/* Load more button */
.gallery-load-more {
    text-align: center;
    padding: 30px 0;
}

.gallery-load-more button {
    padding: 14px 32px;
    background: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-load-more button:hover {
    background: #444;
    border-color: #555;
}

/* Back to editor link */
.gallery-back {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    z-index: 100;
}

.gallery-back:hover {
    background: rgba(0,0,0,0.7);
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-header {
        padding: 24px 16px;
    }

    .gallery-header h1 {
        font-size: 24px;
    }

    .gallery-search {
        flex-direction: column;
    }

    .gallery-container {
        padding: 20px 16px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .gallery-back {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }
}
