/* ============================================
   학습자 쪽지 시스템 스타일 (Bootstrap 없음)
   ============================================ */

/* 헤더 쪽지 아이콘 */
.header-msg-link {
    position: relative;
    font-size: 18px;
    color: #666 !important;
    cursor: pointer;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
}
.header-msg-link:hover {
    color: #333 !important;
}
.header-msg-badge {
    display: none;
    position: absolute;
    top: -6px;
    right: -10px;
    background: #dc3545;
    color: #fff !important;
    padding: 1px 5px;
    border-radius: 10px;
    font-size: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
}
/* PC: main-member 아이콘만 표시 */
.header-msg-pc {
    margin-right: 14px;
    margin-top: 2px;
}
.header-msg-mobile {
    display: none !important;
}
/* 모바일: main-bar 아이콘만 표시 */
@media (max-width: 991px) {
    .header-msg-pc {
        display: none !important;
    }
    .header-msg-mobile {
        display: inline-flex !important;
        align-items: center;
        font-size: 18px !important;
    }
    .header-msg-mobile i {
        font-size: 18px !important;
    }
    header .header-main .main-bar {
        display: flex !important;
        align-items: center;
        gap: 12px;
    }
}

/* 탭 스타일 */
.msg-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
    gap: 8px;
}

.msg-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
    top: 2px;
}

.msg-tab:hover {
    color: #333;
    background: #f8f9fa;
}

.msg-tab.active {
    color: var(--brand-color);
    border-bottom-color: var(--brand-color);
    font-weight: 600;
}

.msg-tab i {
    margin-right: 6px;
}

/* 배지 */
.msg-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    white-space: nowrap;
}

/* 테이블 내 배지 (탭 배지가 아닌 경우) */
.msg-table .msg-badge {
    margin-left: 0;
    padding: 3px 8px;
}

/* 체크박스 */
.msg-check-all,
.msg-check-item {
    width: 16px;
    height: 16px;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: checkbox;
    opacity: 1;
    position: static;
    margin: 0;
}

.msg-badge-danger {
    background: #ff6b6b;
    color: white;
}

.msg-badge-secondary {
    background: #adb5bd;
    color: white;
}

/* 검색 영역 - input-group 스타일 */
.msg-search-area {
    display: flex;
    margin-bottom: 16px;
}

.msg-search-area .msg-select {
    flex: 0 0 100px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.msg-search-input-wrap {
    flex: 1;
    display: flex;
}

.msg-search-input-wrap .msg-input {
    flex: 1;
    border-radius: 0;
    border-right: none;
}

.msg-search-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid #ced4da;
    border-left: none;
    background: var(--brand-color);
    color: white;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.msg-search-btn:hover {
    background: var(--brand-color-hover);
}

.msg-search-btn i {
    font-size: 14px;
}

/* 폼 요소 */
.msg-select,
.msg-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: white;
    width: 100%;
}

.msg-select:focus,
.msg-input:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.1);
}

.msg-textarea {
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: white;
    width: 100%;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.msg-textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.1);
}

/* 버튼 */
.msg-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.msg-btn-primary {
    background: var(--brand-color);
    color: white;
}

.msg-btn-primary:hover {
    background: var(--brand-color-hover);
}

.msg-btn-danger {
    background: #ff6b6b;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
}

.msg-btn-danger:hover {
    background: #ee5a6f;
}

.msg-btn-outline-danger {
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 4px 8px;
    font-size: 12px;
}

.msg-btn-outline-danger:hover {
    background: #ff6b6b;
    color: white;
}

.msg-btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.msg-btn-secondary:hover {
    background: #e0e0e0;
}

/* 통계 텍스트 */
.msg-stats {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.msg-stats b {
    color: var(--brand-color);
    font-weight: 600;
}

.msg-stats .msg-text-danger {
    color: #ff6b6b;
    margin-left: 12px;
}

/* 테이블 컨테이너 */
.msg-table-container {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

/* 테이블 */
.msg-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.msg-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.msg-table th {
    padding: 12px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.msg-table td {
    padding: 10px 8px;
    font-size: 13px;
    color: #495057;
    border-bottom: 1px solid #f1f3f5;
}

.msg-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.msg-table tbody tr:hover {
    background: #f8f9fa;
}

.msg-table tbody tr.msg-table-warning {
    background: #fff3cd;
}

.msg-table tbody tr.msg-table-warning:hover {
    background: #ffe69c;
}

.msg-table .msg-text-center {
    text-align: center;
}

.msg-table .msg-fw-bold {
    font-weight: 600;
}

/* 텍스트 정렬 */
.msg-text-center {
    text-align: center;
}

.msg-text-muted {
    color: #6c757d;
}

/* 빈 상태 */
.msg-empty {
    padding: 40px 20px;
    text-align: center;
    color: #adb5bd;
}

.msg-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

/* 페이지네이션 */
.msg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
}

.msg-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-page-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.msg-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.msg-page-btn.active {
    background: var(--brand-color);
    color: white;
    border-color: var(--brand-color);
    font-weight: 600;
}

/* 쪽지 상세 */
.msg-detail-header {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 16px;
}

.msg-detail-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 12px;
}

.msg-detail-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6c757d;
}

.msg-detail-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-detail-content {
    padding: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-height: 200px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

.msg-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* 쪽지 작성 */
.msg-compose-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.msg-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.msg-form-label.required::after {
    content: " *";
    color: #ff6b6b;
}

.msg-course-group {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.msg-course-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.msg-recipient-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.msg-recipient-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-recipient-btn:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
}

.msg-recipient-btn.selected {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: white;
    font-weight: 600;
}

/* 답장 모드 - 고정 수신자 */
.msg-reply-recipient {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.msg-recipient-fixed {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.msg-recipient-fixed i {
    color: var(--brand-color);
}

.msg-course-badge {
    margin-left: auto;
    padding: 4px 10px;
    background: #e7f1ff;
    border-radius: 12px;
    font-size: 12px;
    color: var(--brand-color);
}

.msg-course-badge i {
    margin-right: 4px;
}

.msg-char-count {
    text-align: right;
    font-size: 12px;
    color: #6c757d;
}

/* 로딩 스피너 */
.msg-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.msg-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--brand-color);
    border-radius: 50%;
    animation: msg-spin 1s linear infinite;
}

@keyframes msg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 반응형 */
@media (max-width: 768px) {
    .msg-tabs {
        flex-direction: column;
        gap: 0;
    }

    .msg-tab {
        border-bottom: 1px solid #e9ecef;
        border-right: none;
    }

    .msg-tab.active {
        border-bottom-color: var(--brand-color);
    }

    .msg-search-area .msg-select {
        flex: 0 0 80px;
    }

    .msg-table th,
    .msg-table td {
        padding: 8px 4px;
        font-size: 12px;
    }

    .msg-detail-info {
        flex-direction: column;
        gap: 8px;
    }

    .msg-page-btn {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* 유틸리티 클래스 */
.msg-d-none {
    display: none !important;
}

.msg-d-block {
    display: block !important;
}

.msg-w-100 {
    width: 100% !important;
}

.msg-mb-2 {
    margin-bottom: 8px !important;
}

.msg-mb-3 {
    margin-bottom: 16px !important;
}

.msg-mt-2 {
    margin-top: 8px !important;
}

.msg-py-4 {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
}
