/* 업체 목록 테이블 디자인 */
.admin-table tbody tr td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* 업체명 및 ID 스타일 */
.company-name {
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 2px;
}

.user-id {
    font-size: 12px;
    color: #888;
}

/* 상태 뱃지 스타일 */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status-locked {
    background: #ffebee;
    color: #c62828;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 잔여 횟수 스타일 */
.quota-count {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

/* 버튼 그룹 및 개별 버튼 스타일 */
.action-group {
    display: flex;
    gap: 6px;
}

.btn-admin {
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    color: white;
}

.btn-quota {
    background: #3f51b5;
}

.btn-lock {
    background: #ff9800;
}

.btn-delete {
    background: #d32f2f;
}

.btn-admin:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* admin.html 상단에 있던 스타일들입니다 */
.admin-body {
    background-color: #f4f6f9;
    min-height: 100vh;
    padding: 20px;
    font-family: 'Pretendard', sans-serif;
    margin: 0;
}

.admin-top-header {
    margin-bottom: 25px;
    text-align: left;
}

.admin-top-header h2 {
    margin: 0;
    color: #333;
}

.admin-top-header p {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: #666;
}

/* 탭 메뉴 스타일 */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.admin-tab-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #e5e7eb;
    color: #666;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.3s;
}

.admin-tab-btn.active {
    background: #1976d2;
    color: white;
}

/* 컨텐츠 카드 */
.content-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.content-card h3 {
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: #444;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
}

/* 테이블 공통 스타일 */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto;
}

.admin-table th {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 14px;
    background: #f8f9fa;
    color: #666;
}

/* 버튼 스타일 (등록 버튼 등) */
.primary-button {
    width: 100%;
    padding: 15px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
}

.secondary-button {
    padding: 6px 12px;
    background: #eee;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* 탭 숨김/표시 처리 */
.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* 모바일 전용 카드 레이아웃 */
@media (max-width: 768px) {
    .admin-body {
        padding: 10px;
    }

    /* 탭 메뉴 가로 스크롤 허용 */
    .admin-tabs {
        display: flex;
        overflow-x: hidden; 
        justify-content: space-between; 
        gap: 2px; 
        width: 100%;
    }

    .admin-tab-btn {
        flex: 1; 
        padding: 10px 1px; 
        font-size: 11px; 
        text-align: center;
        min-width: 0; 
    }

    /* 테이블을 카드로 변환 */
    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .admin-table tr {
        background: white;
        margin-bottom: 15px;
        border-radius: 12px;
        border: 1px solid #eee;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .admin-table td {
        padding: 8px 0;
        text-align: left;
        border-bottom: none;
    }

    /* 텍스트 줄바꿈 보정 (잘림 방지 핵심) */
    .company-name {
        font-size: 18px;
        white-space: normal;
        word-break: break-all;
    }

    .user-id {
        word-break: break-all;
        margin-bottom: 10px;
    }

    /* 잔여 횟수 박스화 */
    .quota-count {
        font-size: 15px;
        background: #f8f9fa;
        padding: 12px;
        border-radius: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .quota-count::before {
        content: "📊 잔여 횟수";
        font-weight: normal;
        color: #666;
    }

    /* 버튼 그룹 최적화 (유동적 배치) */
    .action-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 15px;
    }

    .btn-admin {
        flex: 1 1 calc(33.33% - 8px);
        min-width: 80px;
        padding: 12px 5px;
        font-size: 12px;
    }

    /* 탭 숨김/표시 */
    .admin-tab-content {
        display: none;
    }

    .admin-tab-content.active {
        display: block;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 모달 배경 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* 모달 본체 */
.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-out;
}

.modal-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

/* 탐지된 앱 리스트 스타일 */
.threat-item {
    background: #fff5f5;
    border-left: 4px solid #d32f2f;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.threat-item strong {
    color: #c62828;
    display: block;
    margin-bottom: 3px;
}

.threat-item span {
    font-size: 12px;
    color: #666;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.report-device-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
}

/* 상담 메시지 박스 */
.report-msg-box {
    background: #fff9db;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #fab005;
    margin-bottom: 20px;
    font-size: 14px;
}

/* 위협 항목 카드 */
.threat-card {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.threat-card.spy {
    background: #fff5f5;
    border-color: #ffc9c9;
}

.threat-card.privacy {
    background: #fff9db;
    border-color: #faebcc;
}

/* AI 해석 영역 */
.ai-interpretation {
    background: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #444;
    margin-top: 10px;
}

/* 상세 근거 리스트 */
.evidence-list-small {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    font-size: 12px;
}

/* 관리자 페이지 상단 네비바 스타일 */
.admin-nav-bar {
    display: flex;
    justify-content: flex-end; /* 오른쪽 정렬 */
    padding: 15px 40px;
    background: transparent; /* 배경색 없이 깔끔하게 */
}

.nav-right-menu {
    display: flex;
    align-items: center;
    gap: 20px; /* 버튼 사이 간격 */
}

.btn-go-home {
    text-decoration: none;
    color: #64748b; /* 차분한 회색조 */
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.btn-go-home:hover {
    color: #1e293b; /* 호버 시 진하게 */
}

.btn-admin-logout {
    text-decoration: none;
    background: #f1f5f9;
    color: #ef4444; /* 로그아웃은 빨간색 강조 */
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #fee2e2;
    transition: all 0.2s;
}

.btn-admin-logout:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.detail-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid #eee; padding-bottom: 15px; margin-bottom: 20px;
}
.detail-title { margin: 0; font-size: 24px; }
.detail-meta { color: #666; margin-top: 5px; }

.detail-quota-wrapper { text-align: right; }
.detail-quota-num { font-size: 28px; font-weight: bold; color: #3A539B; }
.detail-quota-label { font-size: 13px; color: #888; }

.detail-section-title { margin-bottom: 10px; }

.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 30px;
}
.stat-box {
    background: #f8f9fa; padding: 15px; border-radius: 8px; 
    text-align: center; border: 1px solid #e1e4e8;
}
.stat-label { color: #666; font-size: 14px; margin-bottom: 5px; }
.stat-num { font-size: 22px; font-weight: bold; color: #2c3e50; }

.detail-action-group {
    background: #fff; border: 1px solid #e1e4e8; padding: 15px; 
    border-radius: 8px; margin-bottom: 30px; display: flex; gap: 10px;
}

.detail-action-group button,
#filter-logs-btn, 
#reset-logs-btn {
    width: auto !important; 
    flex: none !important; 
    padding: 6px 16px;
    font-size: 13px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-desktop-back {
    background-color: #6c757d; color: white; border: none;
    padding: 6px 12px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-desktop-back:hover { background-color: #5a6268; }

/* ➕/➖ 횟수 조정 (보라/남색 계열) */
.btn-desktop-purple { background-color: #6658a6; color: white; }
.btn-desktop-purple:hover { background-color: #524687; }

/* 🚫 접속 차단 (주황색) */
.btn-desktop-warning { background-color: #f0ad4e; color: white; }
.btn-desktop-warning:hover { background-color: #ec971f; }

/* ⚠️ 업체 영구 삭제 (빨간색) */
.btn-desktop-danger { background-color: #d9534f; color: white; }
.btn-desktop-danger:hover { background-color: #c9302c; }

/* 🔍 조회 버튼 (파란색) */
.btn-desktop-primary { background-color: #337ab7; color: white; }
.btn-desktop-primary:hover { background-color: #286090; }

/* 🔄 전체 보기, 상세보기 (회색) */
.btn-desktop-gray { background-color: #777; color: white; border: none; border-radius: 4px; }
.btn-desktop-gray:hover { background-color: #555; }

/* =========================================================
   [검사 상세 리포트 (데스크톱 프로그램 스타일 매칭)]
========================================================= */

/* 모달창 넓게 확장 */
#report-modal .modal-content {
    max-width: 950px !important;
    width: 95%;
}

/* 3단 요약 정보 카드 (전송 업체 / 고객 정보 / 디바이스) */
.report-info-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px;
}
.report-info-card {
    background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 8px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.report-info-card h4 {
    margin: 0 0 12px 0; color: #555; font-size: 14px; border-bottom: 2px solid #eee; padding-bottom: 8px;
}
.report-info-row {
    display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px;
}
.report-info-label { color: #888; }
.report-info-value { font-weight: bold; color: #333; text-align: right; }

/* 노란색 전달 메시지 박스 */
.report-msg-box {
    background: #fff9c4; border: 1px solid #ffe082; color: #795548;
    padding: 15px; border-radius: 6px; margin-bottom: 25px; font-size: 13px; font-weight: bold;
}

/* 탐지된 위협 타이틀 */
.threat-section-title {
    font-size: 18px; color: #d9534f; border-bottom: 2px solid #d9534f; padding-bottom: 8px; margin-bottom: 20px; display: block;
}

/* 위협 앱 상세 카드 (빨간색 테두리) */
.threat-app-card {
    background: #fff; border: 1px solid #f5c6cb; border-left: 4px solid #d9534f; border-radius: 4px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.threat-app-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.threat-app-name-group { display: flex; align-items: baseline; gap: 8px; }
.threat-app-idx { color: #666; font-weight: bold; font-size: 16px; }
.threat-app-name { color: #d9534f; font-weight: bold; font-size: 20px; }
.threat-app-pkg { color: #888; font-size: 13px; }

/* 뱃지들 */
.threat-app-badges { display: flex; gap: 5px; }
.badge-sideload { background: #fff3e0; color: #e65100; font-size: 12px; padding: 4px 8px; border-radius: 4px; font-weight: bold; border: 1px solid #ffe0b2; }
.badge-running { background: #e3f2fd; color: #1565c0; font-size: 12px; padding: 4px 8px; border-radius: 4px; font-weight: bold; border: 1px solid #bbdefb; }

/* 위협 사유 (빨간 배경) */
.threat-app-reason { background: #fff0f0; color: #d9534f; padding: 10px 12px; border-radius: 4px; font-size: 13px; font-weight: bold; margin-bottom: 20px; }

/* 하단 상세 그리드 (경로 / 권한) */
.threat-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px dashed #ddd; padding-top: 20px; }
.detail-box-title { color: #666; font-size: 13px; font-weight: bold; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.path-box { background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 4px; padding: 12px; font-family: monospace; font-size: 11px; color: #333; word-break: break-all; }
.installer-text { font-size: 13px; color: #333; margin-top: 5px; display: block; }

/* =========================================================
   [검사 상세 리포트 (데스크톱 프로그램 스타일 매칭)]
========================================================= */

/* 모달창 넓게 확장 */
#report-modal .modal-content {
    max-width: 950px !important;
    width: 95%;
}

/* 3단 요약 정보 카드 (전송 업체 / 고객 정보 / 디바이스) */
.report-info-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px;
}
.report-info-card {
    background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 8px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.report-info-card h4 {
    margin: 0 0 12px 0; color: #555; font-size: 14px; border-bottom: 2px solid #eee; padding-bottom: 8px;
}
.report-info-row {
    display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px;
}
.report-info-label { color: #888; }
.report-info-value { font-weight: bold; color: #333; text-align: right; }

/* 노란색 전달 메시지 박스 */
.report-msg-box {
    background: #fff9c4; border: 1px solid #ffe082; color: #795548;
    padding: 15px; border-radius: 6px; margin-bottom: 25px; font-size: 13px; font-weight: bold;
}

/* 탐지된 위협 타이틀 */
.threat-section-title {
    font-size: 18px; color: #d9534f; border-bottom: 2px solid #d9534f; padding-bottom: 8px; margin-bottom: 20px; display: block;
}

/* 위협 앱 상세 카드 (빨간색 테두리) */
.threat-app-card {
    background: #fff; border: 1px solid #f5c6cb; border-left: 4px solid #d9534f; border-radius: 4px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.threat-app-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.threat-app-name-group { display: flex; align-items: baseline; gap: 8px; }
.threat-app-idx { color: #666; font-weight: bold; font-size: 16px; }
.threat-app-name { color: #d9534f; font-weight: bold; font-size: 20px; }
.threat-app-pkg { color: #888; font-size: 13px; }

/* 뱃지들 */
.threat-app-badges { display: flex; gap: 5px; }
.badge-sideload { background: #fff3e0; color: #e65100; font-size: 12px; padding: 4px 8px; border-radius: 4px; font-weight: bold; border: 1px solid #ffe0b2; }
.badge-running { background: #e3f2fd; color: #1565c0; font-size: 12px; padding: 4px 8px; border-radius: 4px; font-weight: bold; border: 1px solid #bbdefb; }

/* 위협 사유 (빨간 배경) */
.threat-app-reason { background: #fff0f0; color: #d9534f; padding: 10px 12px; border-radius: 4px; font-size: 13px; font-weight: bold; margin-bottom: 20px; }

/* 하단 상세 그리드 (경로 / 권한) */
.threat-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px dashed #ddd; padding-top: 20px; }
.detail-box-title { color: #666; font-size: 13px; font-weight: bold; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.path-box { background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 4px; padding: 12px; font-family: monospace; font-size: 11px; color: #333; word-break: break-all; }
.installer-text { font-size: 13px; color: #333; margin-top: 5px; display: block; }

/* 초록색 권한 뱃지들 */
.perm-container { background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 4px; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.perm-badge { background: #e8f5e9; color: #28a745; border: 1px solid #c3e6cb; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }