/* 차봄 관리자 시스템 스타일 */

/* 관리자 모달 */
.admin-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: adminFadeIn 0.3s ease;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

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

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

.admin-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: adminSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-modal-content.upload-modal {
    max-width: 600px;
}

@keyframes adminSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-modal-header {
    padding: 24px 28px;
    background: linear-gradient(135deg, #3A3126, #6B5D54);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.admin-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.admin-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.admin-modal-body {
    padding: 32px 28px;
}

/* 비밀번호 입력 */
.admin-password-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.admin-password-input:focus {
    outline: none;
    border-color: #6B5D54;
    box-shadow: 0 0 0 4px rgba(107, 93, 84, 0.1);
}

.admin-error {
    padding: 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c33;
    font-size: 14px;
    margin-bottom: 12px;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

/* 버튼 스타일 */
.admin-login-btn,
.admin-btn,
.admin-btn-primary,
.admin-btn-secondary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.admin-login-btn,
.admin-btn-primary {
    background: linear-gradient(135deg, #6B5D54, #9B8B7E);
    color: white;
}

.admin-login-btn:hover,
.admin-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(107, 93, 84, 0.3);
}

.admin-btn {
    background: #f5f5f5;
    color: #333;
}

.admin-btn:hover {
    background: #e8e8e8;
}

.admin-btn-secondary {
    background: #fff;
    color: #666;
    border: 2px solid #e0e0e0;
}

.admin-btn-secondary:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

/* 관리자 패널 */
.admin-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 9999;
    overflow: hidden;
    animation: adminSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 600px;
}

@keyframes adminSlideIn {
    from {
        opacity: 0;
        transform: translateY(-100%);
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.admin-panel-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #3A3126, #6B5D54);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.admin-panel-header span {
    font-weight: 600;
    font-size: 14px;
}

.admin-panel-actions {
    display: flex;
    gap: 8px;
}

.admin-btn-sm {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-btn-sm:hover {
    background: rgba(255, 255, 255, 0.2);
}

.admin-panel-body {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.admin-section {
    margin-bottom: 20px;
}

.admin-section:last-child {
    margin-bottom: 0;
}

.admin-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.admin-action-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #333;
    font-family: inherit;
}

.admin-action-btn:hover {
    background: #fff;
    border-color: #6B5D54;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 파일 업로드 영역 */
.upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #6B5D54;
    background: #f5f5f5;
}

.upload-area.drag-over {
    border-color: #6B5D54;
    background: #f0ede8;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #999;
    font-weight: 300;
    line-height: 1;
}

.upload-text {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

/* 파일 미리보기 */
.file-preview {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 10px;
    margin-bottom: 8px;
    gap: 12px;
}

.file-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.file-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 12px;
    font-weight: bold;
    background: #f0f0f0;
    padding: 8px 12px;
    border-radius: 6px;
    color: #666;
    font-family: monospace;
}

.file-details {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    word-break: break-all;
}

.file-size {
    font-size: 12px;
    color: #999;
}

.file-remove {
    width: 28px;
    height: 28px;
    background: #ff4444;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.file-remove:hover {
    background: #cc0000;
    transform: rotate(90deg);
}

.upload-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

/* 업로드 진행 */
.upload-progress {
    text-align: center;
    padding: 40px 20px;
}

.upload-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6B5D54;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.upload-progress p {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6B5D54, #9B8B7E);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 업로드 완료 */
.upload-success {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: successPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.upload-success h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #333;
}

.upload-success p {
    margin: 0 0 24px 0;
    color: #666;
    font-size: 14px;
}

/* 편집 버튼 (이미지에 오버레이) */
.edit-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(107, 93, 84, 0.3);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6B5D54;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.slide:hover .edit-btn,
.gallery-item:hover .edit-btn {
    opacity: 1;
}

.edit-btn:hover {
    background: white;
    border-color: #6B5D54;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 스크롤바 스타일 */
.admin-panel-body::-webkit-scrollbar,
.file-preview::-webkit-scrollbar {
    width: 6px;
}

.admin-panel-body::-webkit-scrollbar-track,
.file-preview::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.admin-panel-body::-webkit-scrollbar-thumb,
.file-preview::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.admin-panel-body::-webkit-scrollbar-thumb:hover,
.file-preview::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 편집 모드 스타일 */
.admin-edit-mode .admin-editable-image {
    position: relative !important;
    outline: 2px solid transparent;
    outline-offset: 4px;
    transition: all 0.3s ease;
}

/* 배경 이미지를 가진 요소들 */
.admin-edit-mode .slide.admin-editable-image,
.admin-edit-mode div[style*="background-image"].admin-editable-image {
    display: block;
    position: relative !important;
}

.admin-edit-mode .admin-editable-image:hover {
    outline-color: #4CAF50;
    filter: brightness(1.1);
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 10;
}

.admin-edit-mode .admin-editable-image::after {
    content: 'EDIT';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.admin-edit-mode .admin-editable-image:hover::after {
    opacity: 1;
}

/* 제품 카드는 모달에서만 편집 가능 - 전체 카드 단위로 표시 */
.admin-edit-mode .product-card:not(.add-item-card) {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer !important;
}

.admin-edit-mode .product-card:hover {
    outline: 3px solid #4CAF50 !important;
    outline-offset: 4px;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(76, 175, 80, 0.2) !important;
}

.admin-edit-mode .product-card::after {
    content: '✏️ Click to Edit';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
}

.admin-edit-mode .product-card:hover::after {
    opacity: 1;
}

.admin-edit-mode .product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 99;
    pointer-events: none;
    border-radius: inherit;
}

.admin-edit-mode .product-card:hover::before {
    opacity: 1;
}

/* 제품 카드 내부 개별 요소들은 편집 효과 완전 제거 */
.admin-edit-mode .product-card *,
.admin-edit-mode .product-card .admin-editable-text,
.admin-edit-mode .product-card .admin-editable-image,
.admin-edit-mode .product-card h1,
.admin-edit-mode .product-card h2,
.admin-edit-mode .product-card h3,
.admin-edit-mode .product-card h4,
.admin-edit-mode .product-card p,
.admin-edit-mode .product-card .product-name,
.admin-edit-mode .product-card .product-desc,
.admin-edit-mode .product-card .product-category,
.admin-edit-mode .product-card .product-price {
    outline: none !important;
    pointer-events: auto !important;
    border: none !important;
}

.admin-edit-mode .product-card *:hover,
.admin-edit-mode .product-card .admin-editable-text:hover,
.admin-edit-mode .product-card .admin-editable-image:hover {
    outline: none !important;
    background: none !important;
    filter: none !important;
    transform: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    border: none !important;
}

.admin-edit-mode .product-card *::before,
.admin-edit-mode .product-card *::after,
.admin-edit-mode .product-card .admin-editable-text::before,
.admin-edit-mode .product-card .admin-editable-image::after,
.admin-edit-mode .product-card .admin-editable-text::after,
.admin-edit-mode .product-card .admin-editable-image::before {
    display: none !important;
}

/* 텍스트 편집 스타일 */
.admin-edit-mode .admin-editable-text {
    position: relative;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.admin-edit-mode .admin-editable-text:hover {
    outline-color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
    cursor: text;
}

.admin-edit-mode .admin-editable-text::before {
    content: 'EDIT';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #2196F3;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.admin-edit-mode .admin-editable-text:hover::before {
    opacity: 1;
}

/* 텍스트 편집 중 스타일 */
.admin-editing {
    outline: 2px solid #2196F3 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 8px !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.2) !important;
    z-index: 100 !important;
    position: relative !important;
}

/* URL 입력 필드 */
.admin-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.admin-input:focus {
    outline: none;
    border-color: #6B5D54;
    box-shadow: 0 0 0 3px rgba(107, 93, 84, 0.1);
}

/* 빠른 업로드 영역 */
.current-image-preview {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-image-preview img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
}

/* 업로드 영역 스타일 */
#quickUploadArea {
    border: 2px dashed #ddd !important;
    background: white !important;
    cursor: pointer !important;
}

#quickUploadArea:hover {
    border-color: #6B5D54 !important;
    background: #fafafa !important;
}

#quickUploadArea.drag-over {
    border-color: #4CAF50 !important;
    background: #f0f8f0 !important;
}

/* 반응형 */
@media (max-width: 768px) {
    .admin-panel {
        width: 280px;
        right: 10px;
        top: 60px;
    }
    
    .admin-modal-content {
        width: 95%;
        max-width: none;
    }
}
