/* 대회 정보 페이지 전용 스타일 */


/* 페이지 타이틀 섹션 */

.page-title-section {
    background: white;
    padding: 24px 20px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
}

.title-container h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.title-container p {
    font-size: 0.95rem;
    color: #666;
}


/* 관리자 전용 등록 버튼 */

.admin-add-btn {
    position: absolute;
    top: 24px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.admin-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.admin-add-btn:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .admin-add-btn {
        position: static;
        margin-top: 16px;
        width: 100%;
    }
}


/* 필터 섹션 */

.filter-section {
    background: white;
    padding: 20px;
    margin-top: 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.filter-select {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #333;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.date-filter-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-date-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #333;
    background: white;
    transition: all 0.3s ease;
}

.filter-date-input:focus {
    outline: none;
    border-color: #667eea;
}

.date-separator {
    color: #999;
    font-weight: 500;
}

.filter-reset-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.filter-reset-btn:hover {
    background: #667eea;
    color: white;
}


/* 대회 목록 섹션 */

.race-list-section {
    padding: 20px 0;
}

.race-list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 20px;
}

@media (max-width: 480px) {
    .race-list-container {
        gap: 12px;
        padding: 0 16px;
    }
}


/* 로딩 상태 */

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: #666;
    font-size: 0.9rem;
}


/* 빈 상태 */

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-state p {
    color: #666;
    font-size: 0.95rem;
}


/* 대회 카드 */

.race-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.race-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.race-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.race-card-content {
    padding: 14px;
}

.race-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

@media (max-width: 480px) {
    .race-card-title {
        font-size: 0.85rem;
    }
}

.race-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.race-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #666;
}

.race-info-icon {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.race-info-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-card-distances {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.distance-badge {
    padding: 4px 8px;
    background: #f0f0f0;
    color: #666;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.race-card-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.status-open {
    background: #e3f2fd;
    color: #1976d2;
}

.status-upcoming {
    background: #fff3e0;
    color: #f57c00;
}

.status-closed {
    background: #f5f5f5;
    color: #757575;
}

.race-card-link {
    display: block;
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.race-card-link:hover {
    opacity: 0.9;
}


/* 관리자 액션 버튼 */

.admin-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.admin-edit-btn,
.admin-delete-btn {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-edit-btn {
    background: #e3f2fd;
    color: #1976d2;
}

.admin-edit-btn:hover {
    background: #bbdefb;
}

.admin-delete-btn {
    background: #ffebee;
    color: #c62828;
}

.admin-delete-btn:hover {
    background: #ffcdd2;
}


/* 모달 스타일 */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 24px;
}


/* 폼 스타일 */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #333;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #999;
}

.checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked+span {
    color: #667eea;
    font-weight: 600;
}

.checkbox-label:has(input[type="checkbox"]:checked) {
    border-color: #667eea;
    background: #f0f4ff;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
}

.image-preview {
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-cancel,
.btn-submit,
.btn-delete {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-submit:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-delete {
    background: #c62828;
    color: white;
}

.btn-delete:hover {
    background: #b71c1c;
}


/* 삭제 확인 모달 */

.delete-confirm-text {
    font-size: 1rem;
    color: #333;
    margin-bottom: 8px;
}

.delete-warning {
    font-size: 0.85rem;
    color: #c62828;
    font-weight: 600;
}


/* 반응형 디자인 */

@media (max-width: 480px) {
    .page-title-section {
        padding: 20px 16px;
    }
    .title-container h1 {
        font-size: 1.5rem;
    }
    .filter-section {
        padding: 16px;
    }
    .modal-content {
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }
    .modal-header,
    .modal-body {
        padding: 20px;
    }
}


/* 터치 디바이스 최적화 */

@media (hover: none) and (pointer: coarse) {
    .race-card:active {
        transform: scale(0.98);
    }
    .filter-btn:active {
        transform: scale(0.95);
    }
    .admin-add-btn:active,
    .btn-submit:active {
        transform: scale(0.98);
    }
}


/* ============== 이미지 크롭 모달 ============== */

.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.crop-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 헤더 */

.crop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.crop-close-btn {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    line-height: 1;
    padding: 0;
}

.crop-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}


/* 바디 */

.crop-modal-body {
    padding: 30px;
}


/* 크롭 컨테이너 */

.crop-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    cursor: move;
    border: 2px solid #e0e0e0;
}

.crop-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
}


/* 크롭 박스 */

.crop-box {
    position: absolute;
    border: 2px solid #667eea;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    touch-action: none;
}

.crop-box-border {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px dashed rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

.crop-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: move;
}


/* 줌 컨트롤 */

.crop-controls {
    margin-bottom: 25px;
}

.crop-control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.zoom-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.zoom-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    min-width: 40px;
}

.zoom-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e0e0e0 0%, #667eea 50%, #e0e0e0 100%);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.zoom-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}


/* 미리보기 */

.crop-preview-section {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.crop-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid #e0e0e0;
}

.crop-preview-canvas {
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.crop-preview-hint {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: #666;
}


/* 푸터 */

.crop-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 2px solid #f0f0f0;
    background: #f8f9fa;
    border-radius: 0 0 20px 20px;
}

.crop-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.crop-btn-cancel {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.crop-btn-cancel:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.crop-btn-apply {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.crop-btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}


/* 모바일 반응형 */

@media (max-width: 480px) {
    .crop-modal {
        padding: 10px;
    }
    .crop-modal-content {
        max-height: 95vh;
    }
    .crop-modal-header {
        padding: 20px;
    }
    .crop-modal-header h2 {
        font-size: 1.3rem;
    }
    .crop-modal-body {
        padding: 20px;
    }
    .crop-container {
        height: 300px;
    }
    .zoom-slider-container {
        padding: 12px 15px;
        gap: 10px;
    }
    .crop-preview-canvas {
        width: 180px;
        height: 180px;
    }
    .crop-modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    .crop-btn {
        width: 100%;
    }
}


/* ============== 상세보기 모달 스타일 ============== */


/* 상세보기 모달 콘텐츠 너비 조정 */

#detailModal .modal-content {
    max-width: 700px;
    /* 기본 600px에서 700px로 증가 */
}


/* 상세보기 모달 이미지 */

.detail-image-container {
    width: 100%;
    margin: 0 auto 20px auto;
}

.detail-image-container img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

@media (max-width: 768px) {
    #detailModal .modal-content {
        max-width: 95%;
    }
}

.detail-info-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
}

.detail-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.detail-info-item:last-of-type {
    border-bottom: none;
}

.detail-info-icon {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

.detail-info-label {
    font-weight: 600;
    color: #666;
    min-width: 80px;
}

.detail-info-value {
    color: #333;
    font-weight: 500;
}

.detail-distances {
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.detail-status-container {
    margin: 20px 0;
    text-align: center;
}

.detail-status {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1rem;
}

.detail-status.status-open {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.detail-status.status-upcoming {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.detail-status.status-closed {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    color: white;
}

.detail-register-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 20px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.detail-register-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .detail-image-container img {
        max-height: 250px;
    }
    .detail-info-item {
        flex-wrap: wrap;
        padding: 12px 0;
    }
    .detail-info-label {
        min-width: 60px;
        font-size: 0.9rem;
    }
}


/* 접수 종료 버튼 스타일 */

.race-card-link.disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    cursor: not-allowed;
    opacity: 0.7;
}

.race-card-link.disabled:hover {
    transform: none;
    box-shadow: none;
}