/**
 * KBoard Image Auto Upload - Styles
 * 
 * @package KBoardImageAutoload
 * @version 1.0.0
 */

/* 로딩 이미지 스타일 */
.kbia-loading {
    display: inline-block;
    animation: kbia-spin 1s linear infinite;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    margin: 5px;
}

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

/* 업로드된 이미지 스타일 */
.note-editable img[data-filename] {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 5px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.note-editable img[data-filename]:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

/* 에러 메시지 스타일 */
.kbia-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* 성공 메시지 스타일 */
.kbia-success {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Summernote 에디터 내 이미지 최적화 */
.note-editable {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.note-editable img {
    max-width: 100% !important;
    height: auto !important;
}

/* 드래그 앤 드롭 영역 스타일 */
.kbia-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    color: #999;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.kbia-drop-zone.dragover {
    border-color: #007cba;
    background-color: #f0f8ff;
    color: #007cba;
}

/* 에디터 드래그 오버 스타일 */
.note-editable.kbia-drag-over {
    border: 2px dashed #007cba !important;
    background-color: rgba(0, 124, 186, 0.1) !important;
    position: relative;
    transition: all 0.3s ease;
}

.note-editable.kbia-drag-over:before {
    content: "이미지를 여기에 드롭하세요";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 124, 186, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .note-editable img[data-filename] {
        margin: 3px 0;
    }
    
    .kbia-loading {
        width: 16px;
        height: 16px;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .note-editable img[data-filename] {
        border-color: #555;
        box-shadow: 0 1px 3px rgba(255,255,255,0.12), 0 1px 2px rgba(255,255,255,0.24);
    }
    
    .note-editable img[data-filename]:hover {
        box-shadow: 0 3px 6px rgba(255,255,255,0.16), 0 3px 6px rgba(255,255,255,0.23);
    }
    
    .kbia-drop-zone {
        border-color: #666;
        color: #ccc;
    }
    
    .kbia-drop-zone.dragover {
        border-color: #4a9eff;
        background-color: #1a2332;
        color: #4a9eff;
    }
    
    .note-editable.kbia-drag-over {
        border-color: #4a9eff !important;
        background-color: rgba(74, 158, 255, 0.1) !important;
    }
    
    .note-editable.kbia-drag-over:before {
        background: rgba(74, 158, 255, 0.9);
    }
}

/* 접근성 개선 */
.kbia-loading[aria-label] {
    position: relative;
}

.kbia-loading[aria-label]:after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0; /* 스크린 리더만 읽도록 */
}

/* 인쇄 시 스타일 */
@media print {
    .kbia-loading {
        display: none;
    }
    
    .note-editable img[data-filename] {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}