/* ===== 기본 초기화 및 폰트 설정 ===== */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", sans-serif;
    color: #1a1a1b;
}

/* ===== 메인 컨테이너 ===== */
.container {
    max-width: 700px;
    margin: 40px auto;
    background: #ffffff;
    border: 1px solid #eceef0;
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

h1 {
    margin: 0 0 25px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ===== 탭 버튼 디자인 (타자/투수 전환) ===== */
.tab-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 6px;
    background: #f1f3f5;
    border-radius: 14px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    background: transparent;
    color: #868e96;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ===== 입력창 및 버튼 (이미지 스타일 반영) ===== */
input {
    padding: 12px 16px;
    border: 1px solid #efefef;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    background: #f9f9f9;
    transition: background 0.2s;
}

input:focus {
    background: #ffffff;
    border-color: #ddd;
}

/* 메인 검정 버튼 */
.btn-blue, .btn-black {
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-blue:hover, .btn-black:hover {
    opacity: 0.85;
}

/* 작은 버튼들 (수정/삭제) */
.btn-gray-small { background: #f1f3f5; color: #495057; border-radius: 8px; padding: 6px 12px; border: none; cursor: pointer; font-weight: 600; }
.btn-red-small { background: #fff0f0; color: #ff4d4f; border-radius: 8px; padding: 6px 12px; border: none; cursor: pointer; font-weight: 600; }

.btn-gray-mini { background: #f1f3f5; color: #495057; border-radius: 6px; padding: 5px 10px; font-size: 12px; border: none; cursor: pointer; font-weight: 600; }
.btn-red-mini { background: #fff0f0; color: #ff4d4f; border-radius: 6px; padding: 5px 10px; font-size: 12px; border: none; cursor: pointer; font-weight: 600; }

/* ===== 카드 레이아웃 ===== */
.team {
    border: 1px solid #f1f3f5;
    border-radius: 20px;
    margin-bottom: 25px;
    overflow: hidden;
    background: #fff;
}

.team-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
}

.team-body {
    padding: 24px;
}

.add-player, .add-item {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.add-player input, .add-item input {
    flex: 1;
}

/* ===== 선수 상세 (항상 펼쳐진 모드) ===== */
.player {
    border: 1px solid #f1f3f5;
    border-radius: 16px;
    margin-bottom: 18px;
    background: #fff;
}

.player-header {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-body.visible {
    padding: 0 18px 18px;
}

/* 아이템(메모) 리스트 디자인 */
.item {
    background: #f8f9fa;
    border-radius: 14px;
    padding: 18px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.item-text {
    flex: 1;
    font-size: 14.5px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap; /* 줄바꿈 유지 */
}

.item-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 15px;
}

/* ===== 드래그 핸들 및 상태 ===== */
.handle {
    cursor: grab;
    color: #dee2e6;
    margin-right: 12px;
    font-size: 16px;
    user-select: none;
}

.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.arrow {
    margin-right: 8px;
    color: #adb5bd;
    font-size: 10px;
}

/* ===== 모달 디자인 ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden { display: none; }

.modal-box {
    background: #ffffff;
    padding: 35px;
    border-radius: 28px;
    width: 350px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.modal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ===== 반응형 모바일 ===== */
@media (max-width: 480px) {
    .container { margin: 0; padding: 20px; border-radius: 0; border: none; }
    .add-team { flex-direction: column; }
    .item { padding: 15px; }
}