/* CSS 변수 정의 - 프리미엄 다크 & 스틸 테마 */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 31, 48, 0.7);
    --card-border: rgba(37, 53, 78, 0.8);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-glow: rgba(6, 182, 212, 0.4);
    --highlight-bg: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --font-main: 'Noto Sans KR', sans-serif;
    --font-eng: 'Outfit', sans-serif;
}

/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100/vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(11, 15, 25, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(37, 53, 78, 0.8);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 상단 헤더 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rotateIcon 12s linear infinite;
}

@keyframes rotateIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.user-status {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.badge {
    background: rgba(37, 53, 78, 0.5);
    border: 1px solid var(--card-border);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.live-clock {
    font-family: var(--font-eng);
    font-size: 0.9rem;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* 대시보드 그리드 레이아웃 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.dashboard-grid.admin-mode {
    grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 카드 공통 스타일 */
.grid-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.date-highlight {
    color: var(--accent-cyan);
}

.header-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.5rem;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.25rem;
}

/* 관원 추가 미니 폼 */
.add-member-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.add-member-form input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.add-member-form input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.add-member-form button {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.add-member-form button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.add-member-form button:active {
    transform: translateY(1px);
}

/* 테이블 공통 스타일 */
.table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* 1번 테이블 높이 개별 상향 (최소 9개 행 노출) */
.table1-card .table-wrapper {
    max-height: 630px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table th {
    background: rgba(11, 15, 25, 0.4);
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* 동그라미 커스텀 체크박스 스타일 */
.checkbox-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    height: 24px;
    width: 24px;
    background-color: rgba(11, 15, 25, 0.8);
    border: 2px solid var(--card-border);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: scale(1.1);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7.5px;
    top: 3.5px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* 테이블 3: 격자형 요약 통계 박스 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-box {
    background: rgba(11, 15, 25, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.stat-box:hover {
    border-color: rgba(37, 53, 78, 1);
    transform: translateY(-2px);
}

.stat-box.highlight {
    background: var(--highlight-bg);
    border-color: rgba(6, 182, 212, 0.3);
}

.stat-box.highlight:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-box.highlight .stat-label {
    color: var(--accent-cyan);
}

.stat-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.stat-value {
    font-family: var(--font-eng);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-box.highlight .stat-value {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 누적 수련 횟수 강조 */
.count-badge {
    font-family: var(--font-eng);
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* 푸터 */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    margin-top: 2rem;
}

/* 관원 이름 및 삭제 버튼 레이아웃 */
.member-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9rem;
    border-radius: 4px;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 마우스 오버 시 삭제 버튼 자연스럽게 노출 */
tr:hover .delete-btn {
    opacity: 0.6;
    transform: scale(1);
}

tr:hover .delete-btn:hover {
    color: #ef4444;
    opacity: 1;
    transform: scale(1.15);
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4));
}

/* 헤더 액션 버튼 스타일 */
.header-action-btn {
    background: rgba(37, 53, 78, 0.3);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.header-action-btn:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}

.header-action-btn.logout:hover {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

/* 모달 오버레이 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* 모달 카드 */
.modal-card {
    background: rgba(22, 31, 48, 0.95);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h3 i {
    color: var(--accent-cyan);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal-btn:hover {
    color: var(--accent-cyan);
}

/* 모달 폼 그룹 */
.modal-card .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-card label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-card input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.modal-card input:focus {
    border-color: var(--accent-cyan);
}

.modal-submit-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.modal-submit-btn:hover {
    opacity: 0.9;
}

.modal-error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    display: none;
}

/* 관리자 목록 삭제 버튼 스타일 */
.delete-btn-cell {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.delete-btn-cell:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* 관원 명단 교차 매트릭스 테이블 전용 스타일 */
.matrix-wrapper {
    overflow-x: hidden; /* 가로 스크롤 완전 차단 */
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(17, 24, 39, 0.6);
}

.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    table-layout: fixed; /* 전체 셀 크기를 화면 폭에 맞춰 강제 고정 분할 */
}

.matrix-table th, 
.matrix-table td {
    border-bottom: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    text-align: center;
    vertical-align: middle;
}

.matrix-table td {
    padding: 0.4rem 0.1rem;
    font-size: 0.7rem;
}

/* 첫 번째 열(행 이름 헤더) 스타일 */
.matrix-table th:first-child,
.matrix-table td:first-child {
    font-weight: 700;
    border-right: 2px solid var(--accent-cyan);
    text-align: left;
    width: 110px; /* 행 헤더명 가로폭 고정 */
    min-width: 110px;
    padding-left: 0.6rem;
}

/* 열 이름 헤더 세로쓰기 처리 (가로폭 압축) */
.matrix-table thead th {
    writing-mode: vertical-rl; /* 텍스트를 위에서 아래로 흐르게 설정 */
    text-orientation: upright; /* 글자 각각이 회전하지 않고 똑바로 서서 내려가도록 설정 */
    letter-spacing: -1px;
    text-align: center;
    padding: 0.8rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    background: #1e293b;
    border-bottom: 2px solid var(--accent-cyan);
}

/* 첫 번째 열이자 첫 번째 행의 교차 헤더 셀 ('관원명') 수평 쓰기 유지 */
.matrix-table thead th:first-child {
    writing-mode: horizontal-tb;
    transform: none;
    text-align: left;
    vertical-align: bottom;
    padding: 0.6rem;
    font-size: 0.8rem;
}

/* 대각선 자기 자신 매칭 셀 음영 처리 */
.matrix-self {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-weight: bold;
}

/* 빈 교차 셀 스타일 */
.matrix-cell-empty {
    color: rgba(255, 255, 255, 0.25);
}

/* 활성 교차 셀 스타일 (수련 횟수 존재) */
.matrix-cell-active {
    color: var(--accent-cyan);
    font-weight: 700;
}


