/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item .icon {
    font-size: 20px;
    margin-right: 12px;
}

.nav-item .text {
    flex: 1;
    font-weight: 500;
}

.nav-item .badge {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.nav-item.active .badge {
    background: white;
    color: var(--primary);
}

/* 메인 컨텐츠 */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    width: calc(100% - var(--sidebar-width));
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 실행 중 버튼 스타일 (토글) */
.btn.running {
    background: var(--danger);
    color: white;
}

.btn.running:hover {
    background: #dc2626;
}

/* 모니터링 상태 */
.monitoring-status {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pulse {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

.status-text {
    font-size: 18px;
    font-weight: 600;
}

.status-details {
    font-size: 14px;
    opacity: 0.9;
}

/* 통계 카드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.blue { background: #dbeafe; }
.stat-icon.red { background: #fee2e2; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.gray { background: var(--gray-100); }

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
}

.stat-content p {
    font-size: 14px;
    color: var(--gray-600);
}

/* 카드 */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* 테이블 */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

tr:hover {
    background: var(--gray-50);
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

/* 필터 바 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-select, .search-input {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
}

.search-input {
    flex: 1;
}

/* 카테고리 배지 */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.category-suspicious { background: #fee2e2; color: #991b1b; }
.category-complaint { background: #fef3c7; color: #92400e; }
.category-report { background: #fecaca; color: #7f1d1d; }
.category-normal { background: #d1fae5; color: #065f46; }

/* 로그인 상태 */
.login-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    gap: 12px;
}

.status-item .label {
    font-weight: 600;
    color: var(--gray-600);
    min-width: 120px;
}

.status-item .value {
    font-weight: 500;
}

.value.success { color: var(--success); }
.value.error { color: var(--danger); }
.value.unknown { color: var(--gray-500); }

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 64px 24px;
    color: var(--gray-500);
}

.coming-soon .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* 토글 스위치 */
.toggle-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* 페르소나 */
.persona-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.persona-card {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px;
}

/* 폼 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group input, .form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
}

.keywords-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.keyword-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 24px;
}

/* 게시글 상세 */
.post-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    gap: 12px;
}

.detail-label {
    font-weight: 600;
    min-width: 100px;
    color: var(--gray-600);
}

.detail-value {
    flex: 1;
}

.problem-sentences {
    background: #fee2e2;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--danger);
}

/* Toast - 가시성 향상 */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--gray-900);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    font-size: 15px;
    font-weight: 500;
    max-width: 500px;
    min-width: 300px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.2);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #27ae60;
    border-color: #2ecc71;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.toast.error {
    background: #c0392b;
    border-color: #e74c3c;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.toast.warning {
    background: #d35400;
    border-color: #e67e22;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.toast.info {
    background: #2980b9;
    border-color: #3498db;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 마지막 실행 결과 영역 */
.last-result-card {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.last-result-card h4 {
    margin: 0 0 12px 0;
    color: var(--gray-300);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.last-result-content {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.last-result-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.last-result-status.success {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.last-result-status.stopped {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.last-result-status.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.last-result-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.last-result-stat {
    background: var(--gray-700);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--gray-300);
}

.last-result-stat strong {
    color: white;
    margin-left: 4px;
}

.last-result-time {
    color: var(--gray-500);
    font-size: 12px;
    margin-left: auto;
}

/* 활동 */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.activity-item.warning { border-left-color: var(--warning); }
.activity-item.danger { border-left-color: var(--danger); }

.activity-time {
    font-size: 12px;
    color: var(--gray-500);
}

/* 반응형 */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================ */
/* 계정 관리 스타일 */
/* ============================================================ */

/* 라디오 버튼 그룹 */
.radio-group {
    display: flex;
    gap: 24px;
    margin: 8px 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 계정 추가 폼 */
.account-add-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.account-add-form h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-700);
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-row .btn {
    height: 42px;
    white-space: nowrap;
}

/* 현재 계정 표시 */
.current-indicator {
    display: inline-block;
    padding: 4px 8px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* 토글 스위치 (계정용) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* 작은 버튼 */
.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 설정 그룹 스타일 개선 */
.settings-group {
    margin-bottom: 20px;
}

.settings-group > label:first-child {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.help-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.help-text.warning {
    color: var(--warning);
}

/* 모니터링 옵션 카드 */
.monitor-options-card {
    margin-bottom: 20px;
}

.monitor-options-grid {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 200px;
}

.option-group > label:first-child {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.range-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-input-group input {
    width: 80px;
}

.range-input-group span {
    color: var(--gray-500);
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.radio-label input,
.checkbox-label input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.inline-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.inline-input label {
    font-size: 13px;
    color: var(--gray-600);
}

.inline-input input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
}

.inline-input .hint {
    font-size: 13px;
    color: var(--gray-500);
}

/* 대량 계정 추가 폼 */
.account-bulk-form {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.account-bulk-form h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.account-bulk-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    min-height: 120px;
}

.result-text {
    font-size: 13px;
    margin-left: 12px;
}

.result-text.success {
    color: var(--success);
}

.result-text.warning {
    color: var(--warning);
}

.result-text.error {
    color: var(--danger);
}

/* ============================================================
   AI 모델 설정 섹션
   ============================================================ */
.ai-model-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-model-section .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
}

.ai-usage-stats {
    background-color: var(--gray-50);
    border-radius: 8px;
    padding: 16px;
}

.ai-usage-stats h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.usage-item {
    display: flex;
    flex-direction: column;
    background-color: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.usage-item.highlight {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.usage-item.highlight .usage-label,
.usage-item.highlight .usage-value {
    color: white;
}

.usage-label {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.usage-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.mini-table {
    margin-top: 12px;
    font-size: 13px;
}

.mini-table th,
.mini-table td {
    padding: 8px 12px;
}

.mini-table th {
    background-color: var(--gray-100);
}

/* ============================================================
   게시글 작성 페이지
   ============================================================ */

/* 폼 입력 스타일 */
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 작은 버튼 */
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* 상태 뱃지 */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-badge.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* 모바일 기기 상태 */
.device-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 12px;
    color: var(--gray-500);
}

.status-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

.status-value.text-success {
    color: var(--success);
}

.status-value.text-error {
    color: var(--danger);
}

/* 테이블 액션 버튼 그룹 */
.table-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* 로딩 상태 버튼 */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   게시글 작성 - 다중 선택 UI
   ============================================ */

/* 계정 체크박스 그리드 */
.account-selection {
    margin-top: 12px;
}

.select-all-wrapper {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.account-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.account-checkbox {
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    transition: all 0.2s;
}

.account-checkbox:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.account-checkbox input:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.account-checkbox small {
    color: var(--gray-500);
    font-size: 12px;
}

/* 입력 모드 탭 */
.input-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* 탭 컨텐츠 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 모바일 액션 버튼 */
.mobile-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ip-change-options {
    padding: 12px;
    background: var(--gray-50);
    border-radius: 6px;
}

/* 기기 상태 그리드 */
.device-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* 체크박스 라벨 공통 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 반응형 */
@media (max-width: 768px) {
    .account-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .device-status-grid {
        grid-template-columns: 1fr;
    }

    .mobile-actions {
        flex-direction: column;
    }
}

/* ============================================================
   카페 가입/탈퇴 관리 페이지 스타일
   ============================================================ */

.cafe-manager-container {
    padding: 20px;
}

.cafe-manager-container h2 {
    margin-bottom: 20px;
    color: var(--gray-900);
}

/* 상태 카드 그리드 */
.status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.status-card {
    padding: 20px;
    text-align: center;
}

.status-card h3 {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

/* 상태 배지 */
.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.status-running {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-stopped {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge.status-connected {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-disconnected {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-data {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-wifi {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-unknown {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* 현재 계정 */
.current-account {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

/* 디바이스/네트워크 정보 */
.device-info,
.network-ip {
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

/* 진행바 */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--gray-600);
}

/* 컨트롤 섹션 */
.control-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.control-section .card h3 {
    margin-bottom: 16px;
}

/* 탭 컨테이너 */
.tab-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--gray-100);
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* 카드 헤더 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    margin: 0;
}

/* 계정 리스트 */
.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.account-index {
    font-size: 12px;
    color: var(--gray-500);
    width: 40px;
}

.account-id {
    flex: 1;
    font-weight: 500;
}

.account-pw {
    color: var(--gray-400);
    font-family: monospace;
}

/* 히스토리 리스트 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-time {
    font-weight: 500;
}

.history-duration {
    color: var(--gray-500);
    font-size: 13px;
}

.history-stats {
    display: flex;
    gap: 16px;
}

.history-stats .stat {
    font-size: 13px;
}

.history-stats .stat.success {
    color: var(--success);
}

.history-stats .stat.failed {
    color: var(--danger);
}

.history-stats .stat.total {
    color: var(--gray-600);
}

/* 설정 폼 */
.config-form .form-group {
    margin-bottom: 16px;
}

.config-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.config-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

.config-form .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 빈 상태 */
.empty {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* 로딩 상태 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* 에러 상태 */
.error {
    text-align: center;
    padding: 40px;
    color: var(--danger);
}

/* 버튼 아이콘 */
.btn .icon {
    margin-right: 6px;
}

/* 계정 목록 통계 요약 */
.accounts-summary {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.summary-item {
    font-size: 14px;
    color: var(--gray-600);
}

/* 비활성화된 계정 행 스타일 */
.inactive-row {
    opacity: 0.6;
    background: var(--gray-50);
}

.inactive-row:hover {
    opacity: 0.8;
}

.text-warning {
    color: var(--warning);
}

.status-inactive {
    background: var(--gray-500);
    color: white;
}

.summary-item strong {
    font-weight: 600;
}

.summary-item.success strong {
    color: var(--success);
}

.summary-item.failed strong {
    color: var(--danger);
}

.summary-item.pending strong {
    color: var(--gray-500);
}

/* 계정 목록 래퍼 (접기/펼치기용) */
.accounts-list-wrapper {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.accounts-list-wrapper.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* 접기/펼치기 헤더 스타일 */
.card-header-collapsible {
    cursor: pointer;
    padding: 12px 0;
    user-select: none;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    margin: -20px -24px 16px -24px;
    padding: 16px 24px;
    border-radius: 8px 8px 0 0;
}

.card-header-collapsible:hover {
    background-color: var(--gray-50);
}

.card-header-collapsible h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex: 1;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
    color: var(--gray-500);
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.account-count-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

/* 접기/펼치기 콘텐츠 */
.collapsible-content {
    max-height: none;  /* 계정이 많을 때 잘리지 않도록 제한 해제 */
    overflow: visible;
    transition: opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* 개선된 계정 아이템 */
.account-item {
    display: grid;
    grid-template-columns: 50px 150px 100px 150px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    transition: background-color 0.2s;
}

.account-item:hover {
    background-color: var(--gray-50);
}

.account-item.status-success {
    border-left: 3px solid var(--success);
}

.account-item.status-failed {
    border-left: 3px solid var(--danger);
    background-color: rgba(239, 68, 68, 0.05);
}

.account-item.status-pending {
    border-left: 3px solid var(--gray-300);
}

/* 처리 중인 계정 하이라이트 */
.account-item.processing {
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.05));
    border-left: 4px solid #ff9800;
    animation: processingPulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
}

@keyframes processingPulse {
    0%, 100% {
        background: linear-gradient(90deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.05));
        box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
    }
    50% {
        background: linear-gradient(90deg, rgba(255, 152, 0, 0.25), rgba(255, 152, 0, 0.1));
        box-shadow: 0 4px 12px rgba(255, 152, 0, 0.35);
    }
}

/* 처리 중 뱃지 애니메이션 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.processing-badge {
    animation: pulse 1s infinite;
}

.account-index {
    color: var(--gray-500);
    font-size: 12px;
}

.account-id {
    font-weight: 500;
    color: var(--gray-900);
}

.account-status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

.account-status-badge.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.account-status-badge.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.account-status-badge.status-pending {
    background: var(--gray-100);
    color: var(--gray-500);
}

.account-time {
    color: var(--gray-500);
    font-size: 12px;
}

.account-message {
    color: var(--gray-600);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 카운트 배지 */
.count-badge {
    font-size: 13px;
    font-weight: normal;
    color: var(--gray-500);
}

.count-badge.failed {
    color: var(--danger);
}

/* 필터 셀렉트 */
.form-select-sm {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

/* 실패 계정 리스트 */
.failed-list .account-item {
    grid-template-columns: 150px 100px 150px 1fr;
}

/* 경고 버튼 */
.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

/* 반응형 - 카페 관리 */
@media (max-width: 768px) {
    .status-cards {
        grid-template-columns: 1fr 1fr;
    }

    .control-section {
        grid-template-columns: 1fr;
    }

    .tab-nav {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 50%;
    }

    .account-item {
        grid-template-columns: 40px 1fr 80px;
    }

    .account-time,
    .account-message {
        display: none;
    }

    .accounts-summary {
        gap: 10px;
    }
}

/* ===== 실행 로그 스타일 ===== */
.logs-container {
    max-height: 500px;
    overflow-y: auto;
    background: var(--gray-900);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.logs-container .empty {
    color: var(--gray-500);
    text-align: center;
    padding: 40px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
    color: #e5e7eb;  /* 밝은 회색 */
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-time {
    color: #9ca3af;  /* 밝은 회색으로 변경 (가독성 향상) */
    flex-shrink: 0;
    font-size: 12px;
}

.log-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.log-message {
    flex: 1;
    word-break: break-word;
}

.log-details {
    color: #d1d5db;  /* 밝은 회색으로 변경 (가독성 향상) */
    font-size: 12px;
}

/* 로그 타입별 색상 - 흰색 기반 (가독성 최적화) */
.log-info .log-message {
    color: #ffffff;
}

.log-success .log-message {
    color: #4ade80;  /* 밝은 녹색 */
}

.log-error .log-message {
    color: #f87171;  /* 빨강 유지 */
}

.log-warning .log-message {
    color: #fbbf24;  /* 노랑 유지 */
}

.log-ip_change .log-message {
    color: #93c5fd;  /* 밝은 파랑 */
}

.log-login .log-message {
    color: #c4b5fd;  /* 밝은 보라 */
}

.log-action .log-message {
    color: #67e8f9;  /* 밝은 시안 */
    font-weight: bold;
}

/* 자동 스크롤 체크박스 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-600);
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ============================================================
   게시글 작성 실시간 진행 상태
   ============================================================ */
.progress-container {
    margin-bottom: 20px;
}

.progress-status {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.progress-status.running {
    border-left: 4px solid var(--primary);
    animation: pulse-border 2s infinite;
}

.progress-status.completed {
    border-left: 4px solid var(--success);
}

.progress-status.failed {
    border-left: 4px solid var(--danger);
}

.progress-status.idle {
    border-left: 4px solid var(--gray-300);
}

@keyframes pulse-border {
    0%, 100% { border-left-color: var(--primary); }
    50% { border-left-color: var(--info); }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.running {
    background: var(--primary);
    color: white;
    animation: pulse-bg 1.5s infinite;
}

.status-badge.completed {
    background: var(--success);
    color: white;
}

.status-badge.failed {
    background: var(--danger);
    color: white;
}

.status-badge.idle {
    background: var(--gray-200);
    color: var(--gray-600);
}

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-container {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.progress-details .detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
}

.progress-details .label {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.progress-details .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-details .value.account {
    color: var(--primary);
}

.progress-details .value.step {
    color: var(--info);
}

.recent-logs {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.recent-logs .logs-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);  /* 더 진하게 변경 */
    margin-bottom: 8px;
    text-transform: uppercase;
}

.recent-logs .logs-content {
    background: var(--gray-900);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    max-height: 350px;
    overflow-y: auto;
}

.recent-logs .log-line {
    color: #ffffff;  /* 흰색으로 변경 */
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text {
    color: var(--gray-600);
    font-size: 14px;
    margin-left: 12px;
}
