/* ATI Package Gallery - 갤러리 전용 CSS */

/* ===== 갤러리 컨테이너 ===== */
.ati-package-gallery {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    line-height: 1.6;
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 20px 0;
}

.ati-package-gallery * {
    box-sizing: border-box;
}

/* ===== 브랜드 헤더 ===== */
.ati-package-brand-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #007cba 0%, #005a9e 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.ati-package-brand-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.03) 10px,
        rgba(255,255,255,0.03) 20px
    );
    animation: slide 20s linear infinite;
}

@keyframes slide {
    0% { transform: translateX(-50px) translateY(-50px); }
    100% { transform: translateX(50px) translateY(50px); }
}

.ati-package-brand-title {
    margin: 0 0 10px 0; 
    color: white;
    font-size: 24px; 
    font-weight: 700; 
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 2;
}

.ati-package-brand-subtitle {
    margin: 0 0 20px 0; 
    color: rgba(255,255,255,0.95);
    font-size: 14px; 
    text-align: center;
    opacity: 0.95;
    position: relative;
    z-index: 2;
}

/* ===== 필터 및 검색 ===== */
.ati-package-filters {
    padding: 30px 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    z-index: 3;
}

.ati-package-filters input,
.ati-package-filters select,
.ati-package-filters button {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
}

.ati-package-filters input:focus,
.ati-package-filters select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* ===== 선택 영역 ===== */
.ati-package-selection-area {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 20px;
    position: relative;
    z-index: 3;
}

.ati-package-selection-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.ati-package-stats-line {
    font-weight: 600;
}

#ati-package-selected-count {
    color: #007cba;
}

#ati-package-total-price {
    color: #28a745;
}

/* 전체 선택 해제 버튼 */
#ati-package-clear-selection {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#ati-package-clear-selection:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* ===== 갤러리 그리드 (강제 3열 레이아웃) ===== */
.ati-package-gallery-grid {
    position: relative;
    z-index: 2;
    min-height: 200px;
    margin-bottom: 30px;
    background: #fefefe;
    padding: 30px 20px;
    display: grid !important;
    gap: 25px;
    /* 🔥 강제로 3열 그리드 설정 */
    grid-template-columns: repeat(3, 1fr) !important;
}

/* 데스크톱: 3열 그리드 (강제) */
@media (min-width: 1200px) {
    .ati-package-gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        max-width: 1400px;
        padding: 30px 60px;
        gap: 30px;
        margin: 0 auto;
    }
}

/* 태블릿: 3열 그리드 (강제) */
@media (min-width: 769px) and (max-width: 1199px) {
    .ati-package-gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        padding: 30px 40px;
        gap: 25px;
    }
}

/* 모바일: 2열 그리드 */
@media (max-width: 768px) {
    .ati-package-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .ati-package-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;  /* minmax 제거하고 2열 유지 */
        gap: 15px;
        padding: 20px 15px;
    }
}

/* ===== 패키지 카드 (고정 크기) ===== */
.ati-package-card {
    /* 🔥 카드 크기 고정 */
    width: 100%;
    min-height: 380px;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.ati-package-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-5px);
}

.ati-package-card.selected {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
    transform: translateY(-3px);
}

/* 품절 패키지 */
.ati-package-card.sold-out {
    opacity: 0.75;
}

.ati-package-card.sold-out::before {
    content: '품절';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.ati-package-card.sold-out .ati-package-video-container {
    filter: grayscale(60%) brightness(0.8);
}

.ati-package-card.sold-out:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== 비디오 컨테이너 (9:16 비율) ===== */
.ati-package-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16; /* 🔥 고정 비율 */
    overflow: hidden;
    background: #000;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0; /* 높이 유지 */
}

.ati-package-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.ati-package-card:hover .ati-package-video-container video {
    transform: scale(1.05);
}

.ati-package-video-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* 재생 오버레이 */
.ati-package-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 124, 186, 0.8);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.ati-package-card:hover .ati-package-play-overlay {
    background: rgba(0, 124, 186, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* 영상 길이 배지 */
.ati-package-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 5;
}

/* 🔥 개선된 카드 정보 구조 (2줄로 정리) */
.ati-package-card-info {
    padding: 12px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex: 1; /* 남은 공간 모두 사용 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ati-package-card-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* 메타 정보와 선택 버튼을 한 줄에 배치 */
.ati-package-card-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    flex-wrap: wrap;
}

/* 메타 정보 스타일 */
.ati-package-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}

.ati-package-meta-item {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.ati-package-meta-divider {
    font-size: 10px;
    color: #ccc;
    margin: 0 2px;
}

.ati-package-meta-price {
    font-size: 13px;
    color: #007cba;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.ati-package-card-actions {
    flex-shrink: 0;
    margin-left: auto;
}

/* 🔥 개선된 선택 버튼 스타일 */
.ati-package-select-label {
    background: #007cba;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    white-space: nowrap;
    text-align: center;
}

.ati-package-select-label:hover {
    background: #005a87;
    transform: translateY(-1px);
}

/* 선택된 상태의 버튼 */
.ati-package-card.selected .ati-package-select-label {
    background: #dc3545;
    color: white;
}

.ati-package-card.selected .ati-package-select-label:hover {
    background: #c82333;
}

/* 품절 상태 */
.ati-package-select-label.disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}

.ati-package-select-label.disabled:hover {
    background: #6c757d;
    transform: none;
}

/* ===== 페이지네이션 ===== */
.ati-package-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
    padding: 20px;
}

.ati-package-page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ati-package-page-btn:hover:not(.disabled) {
    background: #007cba;
    color: white;
    border-color: #007cba;
    transform: translateY(-1px);
}

.ati-package-page-btn.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
    font-weight: 600;
}

.ati-package-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
}

.ati-package-page-dots {
    padding: 0 5px;
    color: #999;
    font-weight: 600;
}

/* ===== 선택된 패키지 썸네일 영역 ===== */
.ati-package-thumbnails-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, 120px) !important;
    gap: 12px !important;
    align-items: start;
    justify-content: start;
}

.ati-package-thumbnail-item {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    position: relative;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
}

.ati-package-thumbnail-container {
    width: 120px !important;
    max-width: 120px !important;
    aspect-ratio: 9/16;
    overflow: hidden;
    border-radius: 4px;
    position: relative;
}

.ati-package-thumbnail-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

.ati-package-thumbnail-info {
    padding: 6px;
    text-align: center;
}

.ati-package-thumbnail-name {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ati-package-thumbnail-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    line-height: 1;
}

.ati-package-thumbnail-remove:hover {
    background: #c82333;
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ===== 로딩 및 오류 상태 ===== */
.ati-package-loading,
.ati-package-error,
.ati-package-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

.ati-package-loading::before {
    content: '...';
    display: inline;
    font-size: 14px;
    margin: 0;
    animation: none !important;
}

.ati-package-error::before {
    content: '⚠️';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
}

.ati-package-no-results::before {
    content: '🔍';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
}

/* ===== 장바구니 버튼 ===== */
.ati-package-action-buttons {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    justify-content: center;
    flex-wrap: wrap;
}

.ati-package-action-buttons button {
    padding: 15px 30px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    text-align: center;
}

#ati-package-add-to-cart {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #28a745;
}

#ati-package-add-to-cart:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

#ati-package-add-to-cart:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===== 이메일 입력 ===== */
.ati-package-email-section {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.ati-package-email-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.ati-package-email-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    max-width: 600px;
}

.ati-package-email-form input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.ati-package-email-form input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

@media (max-width: 768px) {
    .ati-package-email-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ati-package-action-buttons {
        padding: 20px 15px;
    }
}

/* ===== 접근성 및 사용성 개선 ===== */
.ati-package-gallery button:focus,
.ati-package-gallery input:focus,
.ati-package-gallery select:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1) !important;
}

.ati-package-card:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1) !important;
}

/* 모달 열렸을 때 body 스크롤 방지 */
body.ati-package-modal-open {
    overflow: hidden;
}

/* 터치 디바이스 최적화 */
.ati-package-modal-content {
    touch-action: pan-y pinch-zoom !important;
}

.ati-package-video-container {
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

@media (hover: none) and (pointer: coarse) {
    .ati-package-video-container video,
    .ati-package-video-container img {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-user-drag: none;
    }
}

/* ===== 애니메이션 감소 옵션 ===== */
@media (prefers-reduced-motion: reduce) {
    .ati-package-card,
    .ati-package-action-boxes button,
    .ati-package-page-btn,
    .ati-package-notification,
    .ati-package-thumbnail-item,
    .ati-package-modal-image-item,
    .ati-package-select-label {
        transition: none;
        animation: none;
    }
    
    .ati-package-play-overlay:hover,
    .ati-package-modal-close:hover,
    .ati-package-select-label:hover {
        transform: none;
    }
}

/* 로딩 애니메이션 */
.ati-package-loading {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: none !important;
    border: none !important;
    width: auto;
    height: auto;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 이메일 검증 메시지 */
#ati-package-email-validation {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
}

#ati-package-email-validation.valid {
    color: #28a745;
}

#ati-package-email-validation.error {
    color: #dc3545;
}

/* 가격 가이드 */
.ati-package-price-guide {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* 선택 상태 표시 */
.ati-package-price-status {
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}