/**
 * 보험 Q&A 시스템 CSS
 * 언론사 뉴스 스타일 적용
 */

.qna-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 70px;
    background: white;
}

.qna-header {
    padding: 5px 0 0 0;
    margin-bottom: 10px;
}

.qna-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    gap: 30px;
}

.search-container {
    display: flex;
    align-items: center;
}

.search-form {
    margin: 0;
}

.qna-title-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.qna-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
    margin: 0;
    transition: all 0.3s ease;
}

.qna-header h1 a {
    color: inherit;
    text-decoration: none;
}

.qna-header h1 a:hover {
    opacity: 0.8;
}

.qna-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0;
    margin-left: 8px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 300px;
    padding: 10px 80px 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    background: #fff;
}

.search-input:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.search-btn:hover {
    background: #1e3a8a;
}

.search-clear {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    color: #9ca3af;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.search-clear:hover {
    color: #dc2626;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sort-options {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
}

.sort-btn {
    padding: 8px 15px;
    text-decoration: none;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-right: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sort-btn:last-child {
    border-right: none;
}

.sort-btn:hover {
    background: #f3f4f6;
    color: #1e40af;
}

.sort-btn.active {
    background: #1e40af;
    color: white;
    font-weight: 600;
}

.btn-primary {
    padding: 10px 20px;
    border: none;
    background: #1e40af;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    display: inline-block;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

/* 메인 레이아웃 */
.qna-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 10px;
}

.qna-main-content {
    min-width: 0;
}

.questions-list {
    margin-bottom: 40px;
}

.question-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.question-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.question-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #6b7280;
}

.answer-count,
.views-count,
.date {
    display: inline-block;
}

.answer-count {
    font-weight: 600;
    color: #3b82f6;
}

.question-title {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.5;
}

.question-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s;
}

.question-title a:hover {
    color: #3b82f6;
}

.question-content-preview {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 40px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #374151;
    font-size: 0.9rem;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: #1e40af;
    color: #1e40af;
    background: #f3f4f6;
}

.page-btn.active {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

/* 질문 작성/상세 페이지 */
.qna-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 70px 20px 40px 20px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-textarea {
    min-height: 300px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

/* 질문 상세 페이지 */
.question-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0px 20px;
}

.detail-header {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
}

.detail-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: #6b7280;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #111827;
    line-height: 1.4;
}

.detail-content {
    font-size: 1rem;
    line-height: 1.8;
    color: #374151;
    white-space: pre-wrap;
}

.answers-section {
    margin-top: 30px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    color: #111827;
}

.answer-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.answer-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.answer-author-wrapper {
    position: relative;
    display: inline-block;
}

.answer-author {
    font-weight: 600;
    color: #1e40af;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.answer-author:hover {
    color: #1e3a8a;
    background: #f3f4f6;
}

.author-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 160px;
    overflow: hidden;
}

.answer-author-wrapper:hover .author-dropdown,
.author-dropdown.active {
    display: block;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.dropdown-item:hover {
    background: #f9fafb;
    color: #1e40af;
}

.dropdown-item i {
    font-size: 0.85rem;
    width: 16px;
}

.answer-date {
    font-size: 0.85rem;
    color: #9ca3af;
}

.answer-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #374151;
}

.answer-content p {
    margin: 0 0 10px 0;
}

.answer-content p:last-child {
    margin-bottom: 0;
}

.answer-form {
    margin-top: 40px;
    padding: 25px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

/* 사이드바 */
.sidebar {
    background: #ffffff;
    border-radius: 8px;
    padding: 0;
    height: fit-content;
    min-width: 0;
}

.sidebar-section {
    padding: 20px 25px;
    border-bottom: 1px solid #f3f4f6;
}

.sidebar-toolbar {
    padding: 0px 25px 20px 25px;
    border-bottom: 1px solid #f3f4f6;
}

.sidebar-toolbar .sort-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.sidebar-toolbar .sort-btn {
    padding: 10px 8px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: block;
    text-align: center;
    white-space: nowrap;
}

.sidebar-toolbar .sort-btn:hover {
    border-color: #1e40af;
    color: #1e40af;
    background: #f3f4f6;
}

.sidebar-toolbar .sort-btn.active {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.sidebar-toolbar .sort-options .sidebar-question-btn {
    padding: 10px 8px;
    text-align: center;
    display: block;
    font-size: 0.85rem;
    border: 1px solid #86efac;
    background: #86efac; /* 파스텔톤 초록색 */
    color: #166534; /* 진한 초록색 텍스트 */
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-toolbar .sort-options .sidebar-question-btn:hover {
    background: #6ee7b7;
    border-color: #6ee7b7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(134, 239, 172, 0.3);
}

.my-content-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.my-content-btn {
    padding: 10px 8px;
    border: 1px solid #86efac;
    background: #86efac; /* 파스텔톤 초록색 */
    color: #166534; /* 진한 초록색 텍스트 */
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: block;
    text-align: center;
    white-space: nowrap;
}

.my-content-btn:hover {
    background: #6ee7b7;
    border-color: #6ee7b7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(134, 239, 172, 0.3);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-question-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-question-item {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.sidebar-question-item:last-child {
    border-bottom: none;
}

.sidebar-question-title {
    font-size: 0.95rem;
    line-height: 1.4;
    margin: 0 0 5px 0;
}

.sidebar-question-title a {
    color: #111827;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.sidebar-question-title a:hover {
    color: #3b82f6;
}

.sidebar-question-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* 쪽지 모달 */
.message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.message-modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #111827;
}

/* 반응형 */
@media (max-width: 768px) {
    .qna-container {
        padding: 0 !important;
        padding-top: 60px !important;
        max-width: 100% !important;
    }

    .qna-header {
        padding: 5px 10px !important;
        margin-bottom: 0 !important;
    }

    .qna-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-bottom: 8px !important;
    }

    .qna-title-section {
        padding: 0 !important;
    }

    .qna-header h1 {
        font-size: 1.3rem !important;
    }

    .qna-subtitle {
        font-size: 0.85rem !important;
        margin-left: 0 !important;
    }

    .question-item {
        border: none !important;
        padding : 10px;
        border-radius: 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        margin-bottom: 5px !important;
    }

    .question-content-preview {
        background: #adadad;
        border-radius: 8px;
        color: white;
        padding: 5px;
    }

    .question-meta {
        margin-bottom: 5px !important;
    }

    /* 모바일에서 기존 검색바 숨기기 */
    .search-container {
        display: none !important;
    }

    .qna-layout {
        grid-template-columns: 1fr;
        gap: 0 !important;
        margin-top: 0 !important;
    }

    .qna-main-content {
        padding: 0 !important;
    }

    .question-detail {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .detail-header {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        margin-bottom: 0 !important;
        padding: 10px 5px 15px 5px !important;
        box-shadow: none !important;
    }

    .detail-header {
        display: flex !important;
        flex-direction: column !important;
    }

    .detail-meta {
        font-size: 0.75rem !important;
        gap: 10px !important;
        margin-bottom: 0 !important;
        margin-top: 12px !important;
        flex-wrap: wrap;
        order: 3 !important; /* 모바일에서 하단으로 이동 */
        margin-left: 5px !important;
    }

    .detail-title {
        font-size: 1.1rem !important;
        margin-bottom: 12px !important;
        margin-top: 0 !important;
        padding: 0 5px !important;
        line-height: 1.4 !important;
        order: 1 !important; /* 모바일에서 상단으로 이동 */
    }

    .detail-content {
        font-size: 0.9rem !important;
        line-height: 1.7 !important;
        margin-bottom: 0 !important;
        order: 2 !important; /* 모바일에서 중간 위치 */
        background: #adadad;
        border-radius: 8px;
        color: white;
        padding: 5px;
    }

    .answers-section {
        margin-top: 0 !important;
        padding: 0 !important;
    }

    .section-title {
        font-size: 1rem !important;
        margin-bottom: 12px !important;
        padding: 10px 5px 8px 5px !important;
        border-bottom: 1px solid #e5e7eb !important;
        margin-left: 5px !important;
    }

    .answer-item {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        margin-bottom: 0 !important;
        padding: 12px 5px !important;
        box-shadow: none !important;
    }

    .answer-item:last-child {
        border-bottom: none !important;
    }

    .answer-header {
        margin-bottom: 10px !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .answer-author {
        font-size: 0.85rem !important;
    }

    .answer-date {
        font-size: 0.75rem !important;
    }

    .answer-content {
        font-size: 0.85rem !important;
        line-height: 1.6 !important;
        padding: 0 !important;
    }

    .answer-form {
        margin-top: 0 !important;
        padding: 15px 5px !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        border-bottom: none !important;
    }

    .answer-form h3 {
        font-size: 1rem !important;
        margin-bottom: 10px !important;
        padding: 0 !important;
    }

    #answer-editor-container {
        min-height: 300px !important;
    }

    #answer-editor-container .ql-editor {
        min-height: 300px !important;
        font-size: 13px !important;
        padding: 10px !important;
    }

    .sidebar {
        display: none !important;
    }

    .sidebar-toolbar .sort-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .my-content-options {
        grid-template-columns: repeat(1, 1fr);
    }

    /* 모바일에서 기존 검색바 숨기기 */
    .search-container {
        display: none !important;
    }

    /* 모바일 하단 검색바 */
    .mobile-qna-bottom-bar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        border-radius: 20px 20px 0px 0px;
        padding: 5px;
        z-index: 9999;
    }

    .mobile-qna-search-wrapper {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
        height: 44px;
        background: #f3f4f600;
        padding: 0 12px;
    }

    .mobile-qna-search-wrapper:focus-within {
        background: #ffffff;
        border-color: #d1d5db;
    }

    .mobile-qna-search-form {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
        height: 100%;
    }

    .mobile-qna-search-icon {
        width: 18px;
        height: 18px;
        color: #9ca3af;
        flex-shrink: 0;
        font-size: 0.95rem;
    }

    .mobile-qna-search-input {
        flex: 1;
        min-width: 0;
        height: 100%;
        border: none;
        background: transparent;
        font-size: 0.95rem;
        color: #111827;
        outline: none;
        padding: 0;
    }

    .mobile-qna-search-input::placeholder {
        color: #9ca3af;
    }

    .mobile-qna-search-submit-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: #e5e7eb;
        color: #6b7280;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        flex-shrink: 0;
    }

    .mobile-qna-search-submit-btn:hover {
        background: #d1d5db;
        color: #111827;
    }

    .mobile-qna-search-submit-btn:active {
        background: #d1d5db;
    }

    /* 하단바 공간 확보 */
    .qna-container {
        padding-bottom: calc(68px + env(safe-area-inset-bottom)) !important;
    }
}

/* PC에서는 하단바 숨김 */
@media (min-width: 769px) {
    .mobile-qna-bottom-bar {
        display: none !important;
    }
}
