/* ==========================================================================
   DIHA STORY - CLIENT PHOTO GALLERY & DELIVERY
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #fafafa;
    color: #18181b;
    line-height: 1.6;
}

.font-serif-display {
    font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
}

/* Hero Cover Banner (Compact & Elegant) */
.album-hero {
    position: relative;
    height: 28vh;
    min-height: 180px;
    max-height: 260px;
    width: 100%;
    overflow: hidden;
    background-color: #09090b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.02);
    transition: transform 8s ease-out, opacity 0.5s ease;
}

.album-hero:hover .album-hero-bg {
    transform: scale(1.06);
}

.album-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(9, 9, 11, 0.35) 0%,
        rgba(9, 9, 11, 0.45) 50%,
        rgba(9, 9, 11, 0.82) 100%
    );
}

/* Gallery Grid Layouts */
.photo-grid {
    display: grid;
    gap: 14px;
    transition: all 0.25s ease;
}

.photo-grid.cols-4 {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.photo-grid.cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.photo-grid.cols-2 {
    grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
}

@media (max-width: 640px) {
    .photo-grid.cols-4,
    .photo-grid.cols-3,
    .photo-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .album-hero {
        height: 24vh;
        min-height: 160px;
        max-height: 200px;
    }
}

/* Photo Card Item */
.photo-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background-color: #f1f5f9;
    aspect-ratio: 4 / 5;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.photo-card.landscape {
    aspect-ratio: 4 / 5;
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.14);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-card:hover img {
    transform: scale(1.04);
}

/* Selected State Ring */
.photo-card.is-selected {
    box-shadow: 0 0 0 3px #e11d48, 0 10px 20px -5px rgba(225, 29, 72, 0.25);
}

/* Card Overlay */
.photo-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.38) 0%,
        transparent 30%,
        transparent 62%,
        rgba(0, 0, 0, 0.68) 100%
    );
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
}

.photo-card:hover .photo-card-overlay,
.photo-card.is-selected .photo-card-overlay,
.photo-card.has-note .photo-card-overlay {
    opacity: 1;
}

@media (max-width: 768px) {
    .photo-card-overlay {
        opacity: 1;
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.2) 0%,
            transparent 40%,
            rgba(0, 0, 0, 0.55) 100%
        );
        padding: 8px;
    }
}

/* Action Icon Buttons inside Photo Card */
.card-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.card-icon-btn:hover {
    transform: scale(1.08);
    background: #ffffff;
}

.card-icon-btn.active-heart {
    background: #e11d48;
    color: #ffffff;
}

.card-icon-btn.active-note {
    background: #f59e0b;
    color: #ffffff;
}

/* Responsive 16:9 Video Player */
.video-container,
.aspect-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    background-color: #000000;
}

.video-container iframe,
.aspect-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Lightbox Zoom & Free Pan/Zoom */
#lightboxImage {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    cursor: zoom-in;
    display: block;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* Lightbox Image Container */
#lightboxImageContainer {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    touch-action: none;
    cursor: zoom-in;
}

#lightboxImage.lightbox-dragging {
    cursor: grabbing !important;
}

#lightboxStage.lightbox-dragging {
    cursor: grabbing !important;
}

.lightbox-img-zoomed {
    cursor: grab !important;
}

/* Utility & Scrollbar */
.hidden:not(.sm\:flex):not(.md\:flex):not(.lg\:flex):not(.xl\:flex):not(.sm\:block):not(.md\:block):not(.lg\:block):not(.xl\:block):not(.sm\:inline-flex):not(.md\:inline-flex) {
    display: none !important;
}

@media (min-width: 640px) {
    .album-desktop-meta {
        display: flex !important;
    }
    .album-mobile-meta {
        display: none !important;
    }
}
@media (max-width: 639px) {
    .album-desktop-meta {
        display: none !important;
    }
    .album-mobile-meta {
        display: flex !important;
    }
}

/* ==========================================================================
   VIEW-ONLY PROTECTION MODE (Chặn tải ảnh, kéo ảnh, chụp màn hình & in ấn trên cả PC & Di động)
   ========================================================================== */
body.view-only-protected {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important; /* Chặn popup menu lưu ảnh khi nhấn giữ trên iOS Safari / Android Chrome */
}

body.view-only-protected img {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
    pointer-events: none !important; /* Triệt tiêu sự kiện chạm trực tiếp vào thẻ ảnh trên di động để trình duyệt không bắt sự kiện lưu */
}

/* Trong Lightbox trang chỉ xem: lớp phủ watermark che toàn bộ trên ảnh và bắt touch/pointer để di động không bao giờ chạm được vào thẻ <img> */
body.view-only-protected #lightboxImage {
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
}

/* Lớp phủ watermark trong Lightbox nhận sự kiện chuột/touch để zoom và kéo pan ảnh mà thẻ img bên dưới vẫn hoàn toàn được che chắn */
body.view-only-protected #lightboxWatermarkOverlay {
    pointer-events: auto !important;
    -webkit-touch-callout: none !important;
}

/* Cho phép click vào thẻ ảnh photo-card cha và container để mở xem Lightbox bình thường */
body.view-only-protected .photo-card {
    pointer-events: auto !important;
    -webkit-touch-callout: none !important;
}

body.view-only-protected #lightboxStage,
body.view-only-protected #lightboxImageContainer {
    pointer-events: auto !important;
    -webkit-touch-callout: none !important;
}

/* Chặn chụp bằng in ấn (Print / Save PDF) */
@media print {
    body.view-only-protected {
        display: none !important;
    }
}

/* Màn chắn bảo vệ chống chụp màn hình / Snipping Tool */
#viewOnlyAntiCaptureShield {
    position: fixed;
    inset: 0;
    background-color: #000000;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: opacity 0.15s ease;
}

#viewOnlyAntiCaptureShield.active {
    display: flex !important;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==========================================================================
   WATERMARK REPEATED PATTERN OVERLAY (DIHASTORY)
   ========================================================================== */
.watermark-pattern-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none !important;
    z-index: 10;
    overflow: hidden;
    background-repeat: repeat;
    background-position: center;
    background-size: 160px 90px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='90' viewBox='0 0 160 90'%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dominant-baseline='middle' transform='rotate(-22 80 45)' fill='%23ffffff' fill-opacity='0.45' stroke='%23000000' stroke-width='0.7' stroke-opacity='0.35' font-family='sans-serif' font-size='13' font-weight='800' letter-spacing='2'%3EDIHASTORY%3C/text%3E%3C/svg%3E");
}

/* Máy tính (chuột, màn hình lớn): giảm 1/2 mật độ watermark, giữ nguyên cỡ chữ (ô lặp lớn gấp đôi diện tích) */
@media (min-width: 1024px) and (pointer: fine) {
    .watermark-pattern-overlay {
        background-size: 226px 127px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='226' height='127' viewBox='0 0 226 127'%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dominant-baseline='middle' transform='rotate(-22 113 63.5)' fill='%23ffffff' fill-opacity='0.45' stroke='%23000000' stroke-width='0.7' stroke-opacity='0.35' font-family='sans-serif' font-size='13' font-weight='800' letter-spacing='2'%3EDIHASTORY%3C/text%3E%3C/svg%3E");
    }
}

/* Kích thước ô nhập lời nhắc cho khách hàng trên màn hình dưới 800px */
@media (max-width: 799px) {
    #adminReminderTextInput {
        height: 80px !important;
    }
}

/* ==========================================================================
   TỐI ƯU HÓA HIỂN THỊ ĐỒNG BỘ TRÊN TRÌNH DUYỆT IOS (SAFARI & WEBKIT)
   ========================================================================== */

/* Khử style mặc định của iOS (bóng mờ, bo tròn tự động của Apple) - trừ checkbox và radio */
input:not([type="checkbox"]):not([type="radio"]), select, textarea, button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Khắc phục lỗi iOS tự động phóng to (auto-zoom) giao diện khi focus vào ô input */
@media screen and (max-width: 768px) {
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Hỗ trợ vùng an toàn (Safe Area Insets: tai thỏ, Dynamic Island, thanh gạt đáy của iPhone) */
body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    -webkit-text-size-adjust: 100%;
}

/* Mượt cuộn cảm ứng và chống giật trên thiết bị di động WebKit */
html, body {
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   CHUẨN HÓA ĐỒNG BỘ TYPOGRAPHY & KÍCH THƯỚC CHỮ CHUYÊN NGHIỆP (STUDIO STANDARD)
   ========================================================================== */

/* Nâng cao độ sắc nét khi render chữ trên mọi trình duyệt & màn hình Retina / OLED */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Đồng bộ hiển thị chữ số (Tabular Nums) cho ngày giờ, mã ảnh để không bị giật layout */
.font-mono,
#heroShootDate,
#managePageDateBadge,
#albumCountdownTimerText,
[id*="Date"],
[id*="Time"] {
    font-variant-numeric: tabular-nums;
}

/* Chuẩn hóa các cỡ chữ quá nhỏ trên di động để tăng độ tinh tế, dễ đọc */
.text-\[8px\],
.text-\[9px\] {
    font-size: 11px !important;
}

.text-\[10px\] {
    font-size: 11.5px !important;
}

.text-\[10\.5px\],
.text-\[11px\],
.text-\[11\.5px\] {
    font-size: 12px !important;
}

/* Chuẩn hóa thanh thông tin góc dưới ảnh (Mã ảnh & Ngày giờ chụp) */
.photo-card-wrap .bg-black\/60 {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
}

/* Đồng bộ ảnh bìa danh sách Album trên mobile (<= 443px) */
@media (max-width: 443px) {
    .admin-album-cover-box {
        aspect-ratio: auto !important;
    }
}

/* Thẻ người dùng: Căn thẳng hàng và đồng bộ duy nhất 1 khoảng cách giữa 3 thành phần */
.user-card-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.user-card-actions-row > span {
    height: 32px;
    padding-left: 7px;
    padding-right: 7px;
}

.user-card-actions-row button {
    height: 32px;
    padding-left: 14px;
    padding-right: 14px;
}







