/**
 * 사전 플러그인 스타일시트
 */

/* 위젯 컨테이너 */
.dictionary-widget {
    max-width: 100%;
    margin: 20px auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    width: 100%;
}

/* 게시판/메인화면 통합 스타일 */
#bo_list .dictionary-widget,
#bo_v .dictionary-widget,
.main_content .dictionary-widget,
.content_area .dictionary-widget {
    margin: 20px 0;
    clear: both;
}

/* 사이드바나 좁은 영역에 배치될 때 */
.sidebar .dictionary-widget,
.aside .dictionary-widget,
.widget_area .dictionary-widget {
    margin: 15px 0;
}

.sidebar .dict-search-form,
.aside .dict-search-form,
.widget_area .dict-search-form {
    padding: 18px;
}

.sidebar .dict-title,
.aside .dict-title,
.widget_area .dict-title {
    font-size: 1.2rem;
    margin-bottom: 14px;
}

/* 검색 폼 */
.dict-search-form {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.dict-title {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #18224b;
    text-align: center;
    line-height: 1.3;
}

.dict-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    margin: 12px auto 0;
    background: linear-gradient(90deg, #3358ff 0%, #02c4ff 100%);
    border-radius: 999px;
}

.dict-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.dict-input {
    flex: 1 1 auto;
    min-width: 180px;
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    line-height: 1.5;
}

.dict-input:focus {
    outline: none;
    border-color: #3358ff;
    box-shadow: 0 0 0 3px rgba(51, 88, 255, 0.1);
}

.dict-select {
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    flex: 0 0 auto;
    box-sizing: border-box;
    line-height: 1.5;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.dict-select:focus {
    outline: none;
    border-color: #3358ff;
    box-shadow: 0 0 0 3px rgba(51, 88, 255, 0.1);
}

.dict-btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #3358ff 0%, #02c4ff 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    box-sizing: border-box;
    line-height: 1.5;
}

.dict-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 88, 255, 0.3);
}

.dict-btn:active {
    transform: translateY(0);
}

.dict-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(51, 88, 255, 0.2);
}

/* 검색 결과 */
.dict-results {
    margin-top: 20px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .dict-results {
        margin-top: 16px;
    }
}

@media (max-width: 480px) {
    .dict-results {
        margin-top: 12px;
    }
}

.dict-result-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.dict-result-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #18224b;
}

.dict-result-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 검색 결과 아이템 */
.dict-item {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.dict-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.dict-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dict-word {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #18224b;
}

.dict-pronunciation {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.dict-pos {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.85rem;
    background: linear-gradient(135deg, rgba(51, 88, 255, 0.1) 0%, rgba(2, 196, 255, 0.1) 100%);
    color: #3358ff;
    border-radius: 12px;
    font-weight: 600;
}

.dict-category {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.85rem;
    background: #f5f5f5;
    color: #666;
    border-radius: 12px;
}

.dict-item-content {
    margin-bottom: 12px;
}

.dict-definition {
    margin: 0 0 12px 0;
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
    word-break: keep-all;
}

.dict-example {
    margin: 12px 0 0 0;
    padding: 12px;
    background: rgba(51, 88, 255, 0.05);
    border-left: 3px solid #3358ff;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

.dict-example strong {
    color: #3358ff;
    font-weight: 600;
}

.dict-item-image {
    margin: 12px 0;
    text-align: center;
}

.dict-item-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dict-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.dict-label {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.85rem;
    background: #f0f0f0;
    color: #555;
    border-radius: 16px;
    font-weight: 500;
}

.dict-item-footer {
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    margin-top: 12px;
}

.dict-source {
    font-size: 0.85rem;
    color: #999;
}

/* 로딩 */
.dict-loading {
    text-align: center;
    padding: 40px 20px;
}

.dict-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #f0f0f0;
    border-top-color: #3358ff;
    border-radius: 50%;
    animation: dict-spin 1s linear infinite;
}

@keyframes dict-spin {
    to { transform: rotate(360deg); }
}

.dict-loading p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

@media (max-width: 480px) {
    .dict-loading {
        padding: 30px 15px;
    }
    
    .dict-spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
    
    .dict-loading p {
        font-size: 0.85rem;
    }
}

/* 에러 메시지 */
.dict-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    text-align: center;
    font-weight: 500;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .dict-error {
        padding: 16px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .dict-error {
        padding: 14px;
        font-size: 0.85rem;
        border-radius: 6px;
    }
}

/* 반응형 디자인 - 태블릿 (1024px 이하) */
@media (max-width: 1024px) {
    .dictionary-widget {
        margin: 16px auto;
    }
    
    .dict-search-form {
        padding: 20px;
    }
    
    .dict-title {
        font-size: 1.4rem;
    }
    
    .dict-input-group {
        gap: 8px;
    }
}

/* 반응형 디자인 - 태블릿 (768px 이하) */
@media (max-width: 768px) {
    .dictionary-widget {
        margin: 12px auto;
    }
    
    .dict-search-form {
        padding: 18px;
        border-radius: 10px;
    }
    
    .dict-title {
        font-size: 1.3rem;
        margin-bottom: 16px;
    }
    
    .dict-title::after {
        width: 50px;
        height: 2px;
        margin: 10px auto 0;
    }
    
    .dict-input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .dict-input {
        width: 100%;
        min-width: 0;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .dict-select {
        width: 100%;
        min-width: 0;
        padding: 12px 16px;
        padding-right: 40px;
        font-size: 0.95rem;
    }
    
    .dict-btn {
        width: 100%;
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .dict-item {
        padding: 16px;
        border-radius: 10px;
    }
    
    .dict-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .dict-word {
        font-size: 1.2rem;
    }
    
    .dict-pronunciation,
    .dict-pos,
    .dict-category {
        font-size: 0.8rem;
    }
    
    .dict-definition {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* 반응형 디자인 - 모바일 (480px 이하) */
@media (max-width: 480px) {
    .dictionary-widget {
        margin: 10px auto;
    }
    
    .dict-search-form {
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 16px;
    }
    
    .dict-title {
        font-size: 1.2rem;
        margin-bottom: 14px;
    }
    
    .dict-title::after {
        width: 40px;
        height: 2px;
        margin: 8px auto 0;
    }
    
    .dict-input-group {
        gap: 8px;
    }
    
    .dict-input,
    .dict-select {
        padding: 11px 14px;
        font-size: 0.9rem;
        border-radius: 6px;
    }
    
    .dict-select {
        padding-right: 36px;
        background-position: right 12px center;
    }
    
    .dict-btn {
        padding: 11px 20px;
        font-size: 0.9rem;
        border-radius: 6px;
    }
    
    .dict-item {
        padding: 14px;
        border-radius: 8px;
    }
    
    .dict-word {
        font-size: 1.1rem;
    }
    
    .dict-definition {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .dict-example {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .dict-item-image img {
        border-radius: 6px;
    }
}

/* 반응형 디자인 - 작은 모바일 (360px 이하) */
@media (max-width: 360px) {
    .dict-search-form {
        padding: 14px;
    }
    
    .dict-title {
        font-size: 1.1rem;
    }
    
    .dict-input,
    .dict-select,
    .dict-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .dict-item {
        padding: 12px;
    }
    
    .dict-word {
        font-size: 1rem;
    }
}

/* 사이드바 반응형 */
@media (max-width: 768px) {
    .sidebar .dictionary-widget,
    .aside .dictionary-widget,
    .widget_area .dictionary-widget {
        margin: 12px 0;
    }
    
    .sidebar .dict-search-form,
    .aside .dict-search-form,
    .widget_area .dict-search-form {
        padding: 16px;
    }
}

/* 검색 페이지 전용 스타일 */
.dictionary-search-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.dictionary-header {
    text-align: center;
    margin-bottom: 40px;
}

.dictionary-header h2 {
    margin: 0 0 12px 0;
    font-size: 2rem;
    font-weight: 700;
    color: #18224b;
}

.dict-subtitle {
    margin: 0;
    font-size: 1.1rem;
    color: #666;
}

.dict-search-form-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

.dict-search-form-page {
    max-width: 800px;
    margin: 0 auto;
}

.dictionary-results-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dict-result-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #18224b;
}

.dict-result-count {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
}

.dict-welcome {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

.dict-welcome p {
    margin: 0;
    font-size: 1.1rem;
}

.dict-suggestion {
    margin-top: 12px !important;
    font-size: 0.95rem !important;
    color: #999 !important;
}

.dict-link {
    margin-top: 12px;
}

.dict-link a {
    color: #3358ff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.dict-link a:hover {
    color: #02c4ff;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .dictionary-search-page {
        padding: 20px 15px;
    }
    
    .dictionary-header h2 {
        font-size: 1.6rem;
    }
    
    .dict-search-form-container,
    .dictionary-results-container {
        padding: 20px;
    }
    
    .dict-result-header h3 {
        font-size: 1.3rem;
    }
}
