/* Reset và base style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header - Tinh gọn */
header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a, #2c2c2c);
    color: white;
    position: relative;
    overflow: hidden;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fadeInDown 1s ease;
}

header p {
    font-size: 1rem;
    margin-top: 5px;
}

/* Grid - Pinterest style */
.grid {
    column-count: 3;
    column-gap: 20px;
    padding: 30px;
    max-width: 1440px;
    margin: 0 auto;
}

.grid-item {
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

.grid-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.grid-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.grid-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-item:hover .overlay {
    opacity: 1;
}

.grid-item .title {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: capitalize;
}

.grid-item .count {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Button */
button, a.button {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

button:hover, a.button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Footer và Loading Bar */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px; /* Thanh mỏng */
    background: transparent;
    z-index: 1000;
}

.loading-bar {
    height: 100%;
    width: 0;
    background: #00ccff; /* Màu xanh cyan */
    transition: width 0.5s ease, opacity 0.3s ease;
    opacity: 0;
}

/* Animation */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .grid { column-count: 2; column-gap: 15px; padding: 20px; }
    header h1 { font-size: 1.8rem; }
}

@media (max-width: 480px) {
    .grid { column-count: 2; column-gap: 8px; padding: 15px; }
    header { padding: 15px; }
    header h1 { font-size: 1.5rem; }
    header p { font-size: 0.8rem; }
    button, a.button { width: 40px; height: 40px; font-size: 1rem; }
}

/* ... (giữ nguyên phần trước) */

/* Overlay cải tiến */
.grid-item .overlay {
    background: rgba(0, 0, 0, 0.7); /* Đậm hơn */
    font-size: 1.2rem; /* To hơn */
}

.grid-item .title { font-size: 1.3rem; font-weight: 700; }
.grid-item .count { font-size: 1rem; }

/* Photo viewer */
.photo-container {
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    transform-origin: center;
}

/* ... (giữ nguyên phần trước) */

/* Grid - Pinterest style */
.grid {
    column-count: 3;
    column-gap: 20px;
    padding: 30px;
    max-width: 1440px;
    margin: 0 auto;
}

.grid-item {
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

.grid-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.grid-item .skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e0e0e0; /* Màu xám nhạt làm placeholder */
    opacity: 1;
    transition: opacity 0.3s ease;
}

.grid-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease; /* Chỉ giữ hiệu ứng tối đi */
}

.grid-item:hover .overlay {
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid { column-count: 2; column-gap: 15px; padding: 20px; }
}

@media (max-width: 480px) {
    .grid { column-count: 2; column-gap: 8px; padding: 15px; }
}