/* 기본 스타일 */
* {
    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;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 헤더 스타일 */
.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);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-content h1 {
    font-size: 2rem;
    text-align: center;
    flex: 1;
    margin: 0;
}

.header-content h1 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.version-info {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.version-label {
    font-size: 0.8rem;
    font-weight: 300;
    margin-right: 0.25rem;
    opacity: 0.8;
}

.version-number {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* 네비게이션 탭 */
.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-tab {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-tab.active {
    background: white;
    color: #667eea;
    font-weight: bold;
}

.nav-tab i {
    font-size: 1rem;
}

/* 메인 컨텐츠 */
.main-content {
    padding: 2rem 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 섹션 헤더 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e8ed;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.ball-inventory-hint {
    color: #6c757d;
    font-size: 0.95rem;
    margin: -1rem 0 1.25rem 0;
}

/* 버튼 스타일 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    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%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

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

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

.btn-warning {
    background: #ffc107;
    color: #212529;
}

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* 검색바 및 필터바 */
.search-bar, .filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar input, .filter-bar input, .filter-bar select {
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

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

/* 테이블 스타일 */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 모바일에서 테이블 스크롤 가능하도록 */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#membersTable {
    table-layout: fixed;
}

/* 모바일에서 테이블 레이아웃 자동 조정 */
@media (max-width: 768px) {
    #membersTable {
        table-layout: auto;
        min-width: 600px;
    }
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e1e8ed;
    vertical-align: middle;
}

/* 회원 테이블 컬럼 폭 조정 */
/* 작업 컬럼 (첫 번째) */
#membersTable th:nth-child(1),
#membersTable td:nth-child(1) {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    padding: 0.5rem 0.4rem;
    text-align: center;
}

/* 예약조 컬럼 (두 번째) */
#membersTable th:nth-child(2),
#membersTable td:nth-child(2) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 0.5rem 0.4rem;
    text-align: center;
}

/* 코트번호 컬럼 (세 번째) */
#membersTable th:nth-child(3),
#membersTable td:nth-child(3) {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    padding: 0.5rem 0.4rem;
    text-align: center;
}

/* 닉네임 컬럼 (네 번째) */
#membersTable th:nth-child(4),
#membersTable td:nth-child(4) {
    width: 100px;
    min-width: 100px;
}

/* 이름 컬럼 (다섯 번째) */
#membersTable th:nth-child(5),
#membersTable td:nth-child(5) {
    width: 120px;
    min-width: 120px;
}

/* 핸드폰번호 컬럼 (여섯 번째) */
#membersTable th:nth-child(6),
#membersTable td:nth-child(6) {
    width: 140px;
    min-width: 140px;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 주차별 하일라이트 */
.data-table tbody tr.week-1 {
    background-color: #e3f2fd;
}

.data-table tbody tr.week-1:hover {
    background-color: #bbdefb;
}

.data-table tbody tr.week-2 {
    background-color: #f3e5f5;
}

.data-table tbody tr.week-2:hover {
    background-color: #e1bee7;
}

.data-table tbody tr.week-3 {
    background-color: #fff3e0;
}

.data-table tbody tr.week-3:hover {
    background-color: #ffe0b2;
}

.data-table tbody tr.week-4 {
    background-color: #e8f5e9;
}

.data-table tbody tr.week-4:hover {
    background-color: #c8e6c9;
}

.data-table tbody tr.week-na {
    background-color: #fafafa;
}

.data-table tbody tr.week-na:hover {
    background-color: #f5f5f5;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 상태 배지 */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* 예약일별 배경색 */
.date-past {
    background-color: #f8f9fa;
    opacity: 0.7;
}

.date-today {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.date-tomorrow {
    background-color: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.date-week {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
}

.date-future {
    background-color: #ffffff;
}

.date-special {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
    font-weight: 500;
}

.date-special:hover {
    background-color: #ffcdd2;
}

/* 헤더 버튼 그룹 */
.header-buttons {
    display: flex;
    gap: 0.5rem;
}

.header-buttons .btn {
    margin: 0;
}

.status-paid {
    background: #d4edda;
    color: #155724;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

/* 폼 스타일 */
form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
    display: block;
}

.readonly-input {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.quantity-input, .notes-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.quantity-input:focus, .notes-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e1e8ed;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* 로딩 오버레이 */
.loading-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.loading-spinner p {
    font-size: 1.2rem;
    font-weight: 500;
}

/* 알림 메시지 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 2rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #212529;
}

.notification.info {
    background: #17a2b8;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        position: relative;
        padding: 0.5rem 0;
    }
    
    .header-top {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .version-info {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .version-number {
        font-size: 0.9rem;
    }
    
    .nav-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }
    
    .nav-tab {
        width: auto;
        min-width: 80px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        text-align: center;
        flex: 1;
        max-width: 120px;
    }
    
    .nav-tab i {
        display: none;
    }
    
    .main-content {
        padding: 1rem 0 2rem 0;
        margin-top: 0;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        margin-bottom: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .search-bar, .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .search-bar input, .filter-bar input, .filter-bar select {
        width: 100%;
        padding: 0.5rem;
    }
    
    .data-table {
        font-size: 0.75rem;
        display: table;
        width: 100%;
        table-layout: auto;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.4rem 0.3rem;
        min-width: 80px;
    }
    
    /* 회원 테이블 컨테이너 스크롤 설정 */
    #membersTable {
        min-width: 600px;
        table-layout: auto;
    }
    
    /* 회원 테이블 첫 번째 컬럼 (작업) - 모바일에서 고정 */
    #membersTable th:first-child,
    #membersTable td:first-child {
        min-width: 120px;
        max-width: 120px;
        width: 120px;
        position: sticky;
        left: 0;
        background: white;
        z-index: 10;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }
    
    #membersTable thead th:first-child {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        z-index: 11;
    }
    
    #membersTable tbody tr.week-1 td:first-child {
        background-color: #e3f2fd !important;
    }
    
    #membersTable tbody tr.week-2 td:first-child {
        background-color: #f3e5f5 !important;
    }
    
    #membersTable tbody tr.week-3 td:first-child {
        background-color: #fff3e0 !important;
    }
    
    #membersTable tbody tr.week-4 td:first-child {
        background-color: #e8f5e9 !important;
    }
    
    #membersTable tbody tr.week-na td:first-child {
        background-color: #fafafa !important;
    }
    
    #membersTable tbody tr:hover td:first-child {
        background-color: #f8f9fa !important;
    }
    
    .data-table th:first-child,
    .data-table td:first-child {
        min-width: 100px;
    }
    
    .data-table th:last-child,
    .data-table td:last-child {
        min-width: 120px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 95vh;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 5px;
    }
    
    .header-content h1 {
        font-size: 1.2rem;
    }
    
    .nav-tab {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        min-width: 70px;
        max-width: 100px;
    }
    
    .data-table {
        font-size: 0.7rem;
        display: table;
        width: 100%;
        table-layout: auto;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.3rem 0.2rem;
        min-width: 70px;
    }
    
    /* 회원 테이블 컨테이너 스크롤 설정 */
    #membersTable {
        min-width: 500px;
        table-layout: auto;
    }
    
    /* 회원 테이블 첫 번째 컬럼 (작업) - 작은 모바일에서 고정 */
    #membersTable th:first-child,
    #membersTable td:first-child {
        min-width: 100px;
        max-width: 100px;
        width: 100px;
        position: sticky;
        left: 0;
        background: white;
        z-index: 10;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }
    
    #membersTable thead th:first-child {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        z-index: 11;
    }
    
    #membersTable tbody tr.week-1 td:first-child {
        background-color: #e3f2fd !important;
    }
    
    #membersTable tbody tr.week-2 td:first-child {
        background-color: #f3e5f5 !important;
    }
    
    #membersTable tbody tr.week-3 td:first-child {
        background-color: #fff3e0 !important;
    }
    
    #membersTable tbody tr.week-4 td:first-child {
        background-color: #e8f5e9 !important;
    }
    
    #membersTable tbody tr.week-na td:first-child {
        background-color: #fafafa !important;
    }
    
    #membersTable tbody tr:hover td:first-child {
        background-color: #f8f9fa !important;
    }
    
    .data-table th:first-child,
    .data-table td:first-child {
        min-width: 90px;
    }
    
    .data-table th:last-child,
    .data-table td:last-child {
        min-width: 100px;
    }
    
    .modal-content {
        width: 98%;
        margin: 1% auto;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    animation: fadeIn 0.3s ease;
}

/* 유틸리티 클래스 */
.text-center {
    text-align: center;
}

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

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* 볼 사용기록 간편 입력 스타일 */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.quantity-controls button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid;
    transition: all 0.2s ease;
}

.quantity-controls .btn-outline-success {
    color: #28a745;
    border-color: #28a745;
    background-color: transparent;
}

.quantity-controls .btn-outline-success:hover:not(:disabled) {
    background-color: #28a745;
    color: white;
}

.quantity-controls .btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
}

.quantity-controls .btn-outline-danger:hover:not(:disabled) {
    background-color: #dc3545;
    color: white;
}

.quantity-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-display {
    font-weight: bold;
    font-size: 16px;
    min-width: 30px;
    text-align: center;
}

/* 볼 사용기록 섹션 스타일 */
.usage-input-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.usage-input-section h3 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.usage-history-section {
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.usage-history-section h3 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

