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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 스타일 */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: rgba(255,255,255,0.9);
    color: #667eea;
    border-color: white;
}

.nav-icon {
    font-size: 1.2rem;
}

/* 메인 콘텐츠 */
.app-main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e8ed;
}

.page-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 600;
}

.page-actions {
    display: flex;
    gap: 1rem;
}

/* 버튼 스타일 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: 1px solid #667eea !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%) !important;
}

.btn-secondary {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 2px solid #dee2e6 !important;
}

.btn-secondary:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

/* 작은 버튼 스타일 */
.btn-sm {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem !important;
    border-radius: 0.375rem !important;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* 검색 및 필터 섹션 */
.search-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 120px;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 그리드 레이아웃 */
.players-container {
    width: 100%;
}

.tournaments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* 카드 스타일 */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-btn.edit {
    background: #17a2b8;
    color: white;
}

.card-btn.delete {
    background: #dc3545;
    color: white;
}

.card-btn:hover {
    transform: scale(1.1);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.card-label {
    font-weight: 500;
    color: #6c757d;
}

.card-value {
    font-weight: 600;
    color: #2c3e50;
}

/* 뱃지 스타일 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.badge-skill {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-gender-male {
    background: #007bff;
    color: white;
}

.badge-gender-female {
    background: #e83e8c;
    color: white;
}

.badge-age {
    background: #6f42c1;
    color: white;
}

/* 설정 페이지 */
.settings-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e1e8ed;
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #f8f9fa;
}

.setting-item label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.setting-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.form-help {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
    font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .main-nav {
        justify-content: center;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .search-section {
        flex-direction: column;
    }
    
    .tournaments-grid {
        grid-template-columns: 1fr;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .setting-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* 로딩 스피너 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-state-description {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
/* 폼 행 레이아웃 */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .form-group:last-child {
    margin-bottom: 0;
}

/* 체크박스가 포함된 행의 정렬 */
.form-row .checkbox-label {
    margin-bottom: 0;
    padding-top: 0.5rem;
}

/* 반응형: 작은 화면에서는 세로 배치 */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-row .form-group {
        margin-bottom: 1rem;
    }
    
    .form-row .checkbox-label {
        padding-top: 0;
    }
}
/* 폼 그리드 레이아웃 */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-grid .form-row {
    margin-bottom: 0;
}

/* 대회 수정 폼 스타일 개선 */
.tournament-edit-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.tournament-edit-form .form-grid {
    margin-bottom: 1rem;
}

.tournament-edit-form .form-options {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* 라벨과 입력 필드 정렬 */
.form-row .form-group label {
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 500;
}

.form-row .form-group input,
.form-row .form-group select {
    width: 100%;
}

/* 체크박스 라벨 정렬 */
.form-row .checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    padding-top: 1.5rem; /* 라벨 높이만큼 조정 */
}

/* 헤더 액션 버튼 스타일 */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-docs {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
    position: relative;
}

.btn-docs:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-docs:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-home {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
}

.btn-home:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: white;
}

.btn-home:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 문서보기 모달 스타일 */
.docs-modal-content {
    max-width: 800px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

#docs-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#docs-modal.show {
    opacity: 1;
}

#docs-modal .modal-content {
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

#docs-modal.show .modal-content {
    transform: translateY(0);
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.doc-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
}

.doc-item:hover {
    border-color: #007bff;
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.doc-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.doc-info {
    flex: 1;
}

.doc-info h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.doc-info p {
    margin: 0 0 0.75rem 0;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.doc-badge {
    display: inline-block;
    background: #6c757d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.doc-badge.recommended {
    background: linear-gradient(135deg, #28a745, #20c997);
    animation: pulse 2s infinite;
}

.doc-badge.기술 {
    background: #007bff;
}

.doc-badge.시각화 {
    background: #fd7e14;
}

.doc-badge.개발 {
    background: #6f42c1;
}

.doc-badge.전체 {
    background: #dc3545;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.docs-footer {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.quick-tips {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
}

.quick-tips h4 {
    margin: 0 0 0.75rem 0;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-tips ul {
    margin: 0;
    padding-left: 1.25rem;
}

.quick-tips li {
    margin-bottom: 0.5rem;
    color: #856404;
    line-height: 1.4;
}

.quick-tips li:last-child {
    margin-bottom: 0;
}

.quick-tips strong {
    color: #533f03;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
        order: -1;
    }
    
    .docs-grid {
        grid-template-columns: 1fr;
    }
    
    .docs-modal-content {
        width: 95vw;
        margin: 1rem;
    }
    
    .doc-item {
        padding: 1rem;
    }
    
    .doc-icon {
        font-size: 2rem;
    }
}

/* 급수/실력 표시 스타일 */
.match-player, .player-name {
    position: relative;
}

/* 급수 표시 스타일 - 깔끔한 검정색 */
.grade-display {
    color: #333;
    font-weight: 500;
    margin-left: 2px;
}

/* 대진표에서 선수 이름과 급수 간격 조정 */
.bracket-table .match-player,
.bracket-table .player-name {
    line-height: 1.3;
}

/* 간단한 대진표에서 급수 표시 */
.simple-bracket .player-name {
    display: inline;
}

/* 급수 표시가 있을 때 선수 이름 스타일 조정 */
.player-with-grade {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
