/* Image Preview Modal CSS */
.img-preview-modal {
    position: fixed;
    z-index: 100003; /* สูงกว่า navbar */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(15, 23, 42, 0.95); /* สีเข้มสุดหรู */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

/* ปุ่มปิดมุมบนขวา */
.img-preview-close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #f1f5f9;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    z-index: 100005;
}

.img-preview-close:hover {
    color: #ef4444; /* แดงเมื่อ Hover */
    transform: scale(1.1);
}

/* แผงปุ่มควบคุมการหมุนและย่อขยาย */
.img-preview-controls {
    position: absolute;
    bottom: 30px;
    display: flex;
    gap: 15px;
    z-index: 100005;
    background: rgba(30, 41, 59, 0.85);
    padding: 10px 20px;
    border-radius: 9999px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.img-control-btn {
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 20px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.img-control-btn:hover {
    background-color: #3b82f6;
    color: #ffffff;
    transform: translateY(-2px);
}

.img-control-btn:active {
    transform: scale(0.95);
}

/* กรอบเนื้อหาภาพ */
.img-preview-content {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible; /* ให้หมุนแล้วไม่โดนบีบ */
    transition: transform 0.1s ease;
}

.img-preview-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
}

/* Responsive Mobile overrides */
@media (max-width: 767px) {
    .img-preview-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
    .img-preview-controls {
        bottom: 20px;
        padding: 8px 15px;
        gap: 10px;
    }
    .img-control-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    .img-preview-content img {
        max-height: 70vh;
    }
}
