/* mobile.css */
@media (max-width: 768px) {
    
    /* ===== 1. 기본 레이아웃 ===== */
    .container {
        flex-direction: column;
        height: auto;
        padding: 15px;
        border-bottom: 2px solid var(--border);
    }
    
    body {
        overflow: auto; /* 모바일에서 스크롤 허용 */
    }
    
    
    /* ===== 2. 사이드바 (멤버 섹션) ===== */
    /* .sidebar {
        width: 100%;
        height: auto;
        max-height: 250px;
        padding: 15px;
    } */
    .sidebar {
        width: 100%;
        height: auto;
        padding: 15px;
    }

    .sidebar-header {
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .sidebar-header h2 {
        font-size: 1.1rem;
    }
    
    /* mobile용 tab 관련 스타일 */
    .mobile-tabs {
        display: flex !important;
        gap: 8px;
        margin-bottom: 15px;
        border-bottom: 2px solid var(--border);
        padding: 0 15px 10px 15px;
        background: var(--bg-main);
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .tab-btn {
        flex: 1;
        padding: 12px 16px;
        background: transparent;
        border: none;
        font-size: 16px;
        font-weight: 600;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s;
        border-bottom: 3px solid transparent;
    }    
    .tab-btn.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }

    /* 멤버 섹션 내용물만 숨김 */
    body.show-teams .sidebar-header,
    body.show-teams .member-list-wrapper,
    body.show-teams .sidebar-footer {
        display: none;
    }
    body.show-teams .mobile-tabs {
        display: flex !important;
    }
    body.show-teams .sidebar {
        display: block;
        padding: 0;
        height: auto;
        min-height: auto;
    }
    
    #memberList {
        max-height: 200px;
    }
    
    .member-item {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 48px; /* 터치하기 쉽게 */
    }
    
    .sidebar-footer {
        gap: 8px;
    }
    
    .usage-guide {
        font-size: 0.75rem;
        padding: 10px;
        line-height: 1.4;
    }
    
    
    /* ===== 3. 메인 콘텐츠 (팀 섹션) ===== */
    /* .main {
        padding: 15px;
        overflow-y: auto;
    } */
    /* 팀 섹션 */
    .main {
        display: none;
    }
    body.show-teams .main {
        display: flex;
        padding: 15px;
        overflow-y: auto;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 15px 0;
    }
    
    .main-header h1 {
        font-size: 1.3rem;
    }
    
    .main-footer {
        padding: 15px 0;
    }
    
    
    /* ===== 4. 팀 그리드 ===== */
    .team-grid {
        grid-template-columns: 1fr; /* 1열로 변경 */
        grid-auto-rows: auto;
        max-height: none; /* 스크롤 제한 해제 */
        gap: 15px;
        padding-right: 0;
    }
    
    .team-box {
        min-height: 120px;
        padding: 18px;
    }
    
    .team-box .team-name {
        font-size: 1.1rem;
    }
    
    .team-status {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .assigned-member {
        padding: 6px 14px;
        font-size: 0.9rem;
        margin: 6px 4px;
    }
    
    
    /* ===== 5. 버튼 (터치하기 쉽게) ===== */
    .btn-primary,
    .btn-danger,
    .btn-close {
        min-height: 48px;
        padding: 12px 18px;
        font-size: 16px;
    }
    
    .btn-mini-save,
    .btn-mini-danger {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    
    /* ===== 6. 모달 ===== */
    .modal-content {
        width: 90%;
        max-width: 400px;
        padding: 24px;
        margin: 20px auto;
    }
    
    .modal-content.small,
    .modal-content.large {
        width: 90%;
        max-width: 400px;
    }
    
    .modal-content h3 {
        font-size: 1.2rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }
    
    
    /* ===== 7. 입력창 ===== */
    .input-text {
        padding: 12px 14px;
        font-size: 16px; /* iOS 자동 줌 방지 */
    }
    
    .manage-list {
        max-height: 300px;
    }
    
    .manage-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }
    
    .manage-item .input-text {
        width: 100%;
    }
    
    .manage-item button {
        width: 100%;
    }
    
    
    /* ===== 8. 토스트 ===== */
    .toast-container {
        bottom: 20px;
        width: 90%;
        max-width: 350px;
    }
    
    .toast {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    
    /* ===== 9. 헤더 액션 버튼들 ===== */
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    
    .header-actions button {
        flex: 1 1 calc(50% - 4px); /* 2열 배치 */
        min-width: 140px;
    }
}


/* ===== 10. 아주 작은 화면 (360px 이하) ===== */
@media (max-width: 360px) {
    .sidebar {
        padding: 10px;
    }
    
    .main {
        padding: 10px;
    }
    
    .team-box {
        padding: 15px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .header-actions button {
        flex: 1 1 100%; /* 1열 배치 */
    }
}

