/* Container */
.tehtud-tood-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Admin controls */
.tehtud-tood-admin-controls {
    margin-bottom: 30px;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #B8A65C 0%, #8B7355 100%);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(184, 166, 92, 0.2);
    position: relative;
    overflow: hidden;
}

.tehtud-tood-admin-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
    pointer-events: none;
}

.tehtud-tood-admin-btn {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
    padding: 14px 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tehtud-tood-admin-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: white;
    text-decoration: none;
}

.admin-icon {
    font-size: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Masonry Gallery */
.tehtud-tood-gallery {
    column-count: 4;
    column-gap: 15px;
    margin-top: 30px;
}

/* Work item - Masonry style */
.tehtud-tood-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    break-inside: avoid;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.tehtud-tood-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: rgba(184, 166, 92, 0.3);
}

/* Media */
.work-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #F8F9FA;
    display: block;
}

/* Ühtlane proportsioon – suuremad kaardid mobiilis/tahvlis */
.work-media img,
.work-media video {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.tehtud-tood-item:hover .work-media img {
    transform: scale(1.05);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(45, 63, 92, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(45, 63, 92, 0.4);
    border: 2px solid rgba(255,255,255,0.2);
}

.video-play-button:hover {
    background: rgba(45, 63, 92, 1);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(45, 63, 92, 0.5);
}

/* Work info */
.work-info {
    padding: 15px;
    background: #FFFFFF;
}

.work-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2D3F5C;
    line-height: 1.3;
    letter-spacing: -0.1px;
}

.work-description {
    margin: 0;
    color: #6B7280;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 400;
}

/* Overlay */
.work-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(184, 166, 92, 0.9) 0%,
        rgba(139, 115, 85, 0.95) 50%,
        rgba(45, 63, 92, 0.9) 100%
    );
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    padding: 20px;
    text-align: center;
}

.tehtud-tood-item:hover .work-overlay {
    opacity: 1;
}

.work-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateY(15px);
    transition: transform 0.3s ease 0.1s;
}

.tehtud-tood-item:hover .work-overlay-content {
    transform: translateY(0);
}

.overlay-icon {
    font-size: 32px;
    margin-bottom: 4px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.overlay-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3));
}

/* Load More Button */
.tehtud-tood-load-more-container {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
}

.tehtud-tood-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #B8A65C 0%, #8B7355 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(184, 166, 92, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255,255,255,0.2);
}

.tehtud-tood-load-more-btn:hover {
    background: linear-gradient(135deg, #c9b96a 0%, #9d8765 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 166, 92, 0.4);
}

.tehtud-tood-load-more-btn:disabled {
    background: #D1D5DB;
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.load-more-text {
    font-weight: 600;
}

.load-more-count {
    background: rgba(255,255,255,0.2);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.load-more-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.tehtud-tood-load-more-btn:hover .load-more-icon {
    transform: translateY(2px);
}

.tehtud-tood-load-more-btn.loading {
    pointer-events: none;
}

.tehtud-tood-load-more-btn.loading .load-more-icon {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

/* New items loading animation */
.tehtud-tood-item.loading {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.tehtud-tood-item.loaded {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.5s ease;
}

/* Complete state */
.load-more-complete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #B8A65C;
    font-size: 15px;
    font-weight: 600;
    padding: 16px;
    background: rgba(184, 166, 92, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(184, 166, 92, 0.2);
    margin-top: 30px;
}

/* PARANDATUD LIGHTBOX - KINDEL SULGEMISE NUPP */
.tehtud-tood-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(8px) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.tehtud-tood-lightbox.active {
    display: flex !important;
}

.lightbox-content {
    position: relative !important;
    width: 95vw !important;
    height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000000 !important;
}

/* SULGEMISE NUPP - ALATI NÄHTAV */
.lightbox-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    background: rgba(45, 63, 92, 0.95) !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 28px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    z-index: 1000001 !important;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4) !important;
    line-height: 1 !important;
    text-decoration: none !important;
    outline: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.lightbox-close:hover {
    background: rgba(220, 38, 38, 1) !important;
    transform: scale(1.15) !important;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.6) !important;
    color: white !important;
}

.lightbox-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8) !important;
    outline-offset: 2px !important;
}

.lightbox-close span {
    display: block !important;
    line-height: 1 !important;
    font-size: 28px !important;
    pointer-events: none !important;
}

.lightbox-media-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 80vh;
    margin-bottom: 20px;
}

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

.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.lightbox-info {
    text-align: center;
    color: #2D3F5C;
    max-width: 800px;
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(45, 63, 92, 0.1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.lightbox-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #2D3F5C;
    letter-spacing: -0.3px;
}

.lightbox-description {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: #6B7280;
    font-weight: 400;
}

/* Navigation - tumed nupud */
.lightbox-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
    pointer-events: none !important;
    z-index: 1000001 !important;
}

.lightbox-prev,
.lightbox-next {
    width: 60px !important;
    height: 60px !important;
    background: rgba(45, 63, 92, 0.95) !important;
    border: 3px solid white !important;
    color: white !important;
    font-size: 24px !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    backdrop-filter: blur(8px) !important;
    box-shadow: 0 6px 20px rgba(45, 63, 92, 0.4) !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(45, 63, 92, 1) !important;
    transform: scale(1.15) !important;
    box-shadow: 0 8px 24px rgba(45, 63, 92, 0.6) !important;
}

.lightbox-prev.disabled,
.lightbox-next.disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    background: rgba(45, 63, 92, 0.3) !important;
}

.lightbox-prev.disabled:hover,
.lightbox-next.disabled:hover {
    background: rgba(45, 63, 92, 0.3) !important;
    transform: none !important;
    box-shadow: 0 6px 20px rgba(45, 63, 92, 0.4) !important;
}

.lightbox-prev span,
.lightbox-next span {
    pointer-events: none !important;
}

/* Backdrop */
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    z-index: 999999;
}

/* Empty state */
.tehtud-tood-empty {
    text-align: center;
    padding: 60px 20px;
    background: #F8F9FA;
    border-radius: 8px;
    border: 2px dashed rgba(184, 166, 92, 0.3);
}

.empty-state-admin,
.empty-state-public {
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-admin h3,
.empty-state-public h3 {
    font-size: 24px;
    color: #2D3F5C;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.empty-state-admin p,
.empty-state-public p {
    color: #6B7280;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
    font-weight: 400;
}

/* Body class when lightbox is open */
body.lightbox-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .tehtud-tood-gallery {
        column-count: 3;
        column-gap: 14px;
    }

    .tehtud-tood-item {
        margin-bottom: 14px;
    }

    .lightbox-close {
        width: 54px !important;
        height: 54px !important;
        font-size: 24px !important;
    }

    .lightbox-close span {
        font-size: 24px !important;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 54px !important;
        height: 54px !important;
        font-size: 22px !important;
    }
}

/* Responsive - Mobile (SUUREMAD kaardid: 1 veerg) */
@media (max-width: 768px) {
    .tehtud-tood-container {
        padding: 15px;
    }

    .tehtud-tood-gallery {
        column-count: 1;
        column-gap: 0;
        margin-top: 18px;
    }

    .tehtud-tood-item {
        margin-bottom: 14px;
    }

    .work-info {
        padding: 14px;
    }

    .work-title {
        font-size: 17px;
    }

    .work-description {
        font-size: 14px;
    }

    .lightbox-content {
        width: 98vw !important;
        height: 98vh !important;
    }

    .lightbox-close {
        top: 10px !important;
        right: 10px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 22px !important;
    }

    .lightbox-close span {
        font-size: 22px !important;
    }

    .lightbox-nav {
        padding: 0 10px !important;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }

    .lightbox-title {
        font-size: 20px;
    }

    .lightbox-description {
        font-size: 14px;
    }

    .lightbox-info {
        padding: 16px 20px;
        margin: 0 10px;
    }

    .lightbox-media-container {
        max-height: 75vh;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .tehtud-tood-gallery {
        column-count: 1;
        column-gap: 0;
    }

    .overlay-icon {
        font-size: 28px;
    }

    .overlay-text {
        font-size: 14px;
    }

    .lightbox-close {
        top: 5px !important;
        right: 5px !important;
        width: 46px !important;
        height: 46px !important;
        font-size: 20px !important;
    }

    .lightbox-close span {
        font-size: 20px !important;
    }

    .lightbox-nav {
        padding: 0 5px !important;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 46px !important;
        height: 46px !important;
        font-size: 18px !important;
    }

    .lightbox-title {
        font-size: 18px;
    }

    .lightbox-description {
        font-size: 13px;
    }

    .lightbox-media-container {
        max-height: 70vh;
    }

    .tehtud-tood-load-more-btn {
        width: 100%;
        max-width: 260px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tehtud-tood-item {
    animation: fadeInUp 0.5s ease forwards;
}

/* Loading state */
.tehtud-tood-loading {
    text-align: center;
    padding: 40px;
    color: #6B7280;
    font-size: 15px;
    font-weight: 500;
}

.tehtud-tood-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(184, 166, 92, 0.2);
    border-top: 2px solid #B8A65C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Focus states for accessibility */
.tehtud-tood-item:focus,
.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus,
.tehtud-tood-admin-btn:focus,
.tehtud-tood-load-more-btn:focus {
    outline: 2px solid rgba(184, 166, 92, 0.5);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .tehtud-tood-lightbox,
    .work-overlay,
    .tehtud-tood-admin-controls,
    .tehtud-tood-load-more-container {
        display: none !important;
    }

    .tehtud-tood-gallery {
        column-count: 2;
        column-gap: 10px;
    }

    .tehtud-tood-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* PARANDATUD LIGHTBOX - INLINE STIILID */
.tehtud-tood-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(8px) !important;
    display: none !important;
}

.tehtud-tood-lightbox.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.lightbox-content {
    position: relative !important;
    width: 95vw !important;
    height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000000 !important;
}

.lightbox-media-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 80vh;
    margin-bottom: 20px;
}

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

.lightbox-info {
    text-align: center;
    color: #2D3F5C;
    max-width: 800px;
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(45, 63, 92, 0.1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.lightbox-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #2D3F5C;
    letter-spacing: -0.3px;
}

.lightbox-description {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: #6B7280;
    font-weight: 400;
}

/* Backdrop */
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    z-index: 999999;
}

/* Body lock when lightbox is open */
body.lightbox-open {
    overflow: hidden !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px !important;
        right: 10px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }

    .lightbox-prev {
        left: 10px !important;
    }

    .lightbox-next {
        right: 10px !important;
    }

    .lightbox-info {
        padding: 16px 20px;
        margin: 0 10px;
    }
}
/* Image counter and multi-image support */
.image-count-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, rgba(184, 166, 92, 0.95), rgba(139, 115, 85, 0.95));
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    letter-spacing: 0.3px;
}

.lightbox-image-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 63, 92, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(45, 63, 92, 0.4);
    border: 2px solid rgba(255,255,255,0.2);
    z-index: 1000002;
    letter-spacing: 0.5px;
}

/* Enhanced work items for multi-image indication */
.tehtud-tood-item {
    position: relative;
}

.tehtud-tood-item[data-all-images] .work-media::after {
    content: attr(data-image-count);
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, rgba(184, 166, 92, 0.95), rgba(139, 115, 85, 0.95));
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Improved lightbox navigation for mobile */
@media (max-width: 768px) {
    .lightbox-image-counter {
        bottom: 15px;
        font-size: 13px;
        padding: 6px 12px;
    }

    .image-count-badge {
        top: 8px;
        right: 8px;
        font-size: 11px;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .lightbox-image-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 5px 10px;
    }

    .image-count-badge {
        top: 6px;
        right: 6px;
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Loading states for new items */
.tehtud-tood-item.loading {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.tehtud-tood-item.loaded {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.5s ease;
}

/* Enhanced overlay for multi-image works */
.tehtud-tood-item:hover .work-overlay-content .overlay-text {
    transition: all 0.3s ease;
}

.tehtud-tood-item[data-all-images]:hover .work-overlay-content .overlay-text::after {
    content: " (" attr(data-image-count) " pilti)";
    opacity: 0.8;
    font-size: 0.9em;
}
