/* 
 * ZWFC足球俱乐部 - 球队阵容页面样式
 */

/* ==================== 页面布局 ==================== */

/* ==================== Tabs ==================== */
.lineup-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.lineup-tab {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lineup-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.lineup-tab.active {
    background: var(--border-color);
    border-color: var(--accent);
    color: var(--accent);
}

.lineup-tab .tab-rename,
.lineup-tab .tab-delete {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0 3px;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.lineup-tab .tab-rename {
    color: var(--accent);
}

.lineup-tab .tab-delete {
    color: var(--danger);
}

.lineup-tab:hover .tab-rename,
.lineup-tab:hover .tab-delete {
    display: inline;
}

.lineup-tab .tab-rename:hover,
.lineup-tab .tab-delete:hover {
    opacity: 1;
}

.btn-new-lineup {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

.btn-new-lineup:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* ==================== 足球场 CSS绘制 ==================== */
.lineup-layout {
    display: flex;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    min-height: 700px;
}

.lineup-field-area {
    flex: 0 0 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 球场区域头部：评分左侧，阵型右侧 */
.field-area-header {
    width: 100%;
    max-width: 460px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.field-area-header .field-area-rating {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.field-area-header .field-area-rating .stars {
    color: var(--gold);
    font-size: 1rem;
}

.field-area-header .field-area-rating .rating-number {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 0.95rem;
}

.field-area-header .formation-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.field-area-header .formation-selector label {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.field-area-header .formation-selector select {
    padding: 0.3rem 0.6rem;
    font-size: 0.88rem;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
}

.field-area-header .formation-selector select:focus {
    outline: none;
    border-color: var(--accent);
}

.lineup-players-area {
    flex: 1;
    min-width: 300px;
}

.field-container {
    position: relative;
    width: 460px;
    height: 680px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(0, 0, 0, 0.2);
}

/* 球场草皮背景 - 使用渐变模拟自然草坪 */
.field-pitch {
    width: 100%;
    height: 100%;
    background: 
        /* 草纹纹理 */
        repeating-linear-gradient(
            0deg,
            rgba(46, 125, 50, 0.15) 0px,
            rgba(27, 94, 32, 0.15) 2px,
            rgba(46, 125, 50, 0.15) 4px
        ),
        /* 深浅条纹 */
        repeating-linear-gradient(
            90deg,
            #2e7d32 0px,
            #388e3c 40px,
            #2e7d32 80px,
            #43a047 40px
        );
    position: relative;
}

/* 球场边线 */
.field-pitch::before {
    content: '';
    position: absolute;
    top: 3%;
    left: 4%;
    right: 4%;
    bottom: 3%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
}

/* 中线 */
.field-pitch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 4%;
    right: 4%;
    height: 2px;
    background: rgba(255, 255, 255, 0.6);
}

/* 中圈 */
.field-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24%;
    height: auto;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
}

/* 中圈中心点 */
.field-center-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

/* 上半场禁区弧容器 */
.field-penalty-arc-top-wrapper {
    position: absolute;
    top: 21%;
    left: 50%;
    transform: translateX(-50%);
    width: 24%;
    height: auto;
    aspect-ratio: 3 / 1;
    overflow: hidden;
}

/* 上半场禁区弧 */
.field-penalty-arc-top {
    width: 100%;
    height: auto;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    transform: translateY(-67%);
}

/* 上半场禁区 */
.field-penalty-top {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 18%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top: none;
}

/* 上半场禁区内的小禁区（球门区） */
.field-goalarea-top {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 28%;
    height: 10%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top: none;
}

/* 上半场罚球点 */
.field-penalty-spot-top {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

/* 下半场禁区弧容器 */
.field-penalty-arc-bottom-wrapper {
    position: absolute;
    bottom: 21%;
    left: 50%;
    transform: translateX(-50%);
    width: 24%;
    height: auto;
    aspect-ratio: 3 / 1;
    overflow: hidden;
}

/* 下半场禁区弧 */
.field-penalty-arc-bottom {
    width: 100%;
    height: auto;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
}

/* 下半场禁区 */
.field-penalty-bottom {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 18%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-bottom: none;
}

/* 下半场小禁区 */
.field-goalarea-bottom {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 28%;
    height: 10%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-bottom: none;
}

/* 下半场罚球点 */
.field-penalty-spot-bottom {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translate(-50%, 50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

/* ==================== 球员站位点 ==================== */
.field-slots-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.field-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    cursor: grab;
    z-index: 10;
}

.field-slot.drag-over {
    z-index: 20;
}

.field-slot-inner {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 2px dashed rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.field-slot.has-player .field-slot-inner {
    border: 2px solid rgba(0, 212, 255, 0.4);
    background: transparent;
    padding: 0;
}

/* 头像全显 */
.field-slot.has-player .slot-bg-avatar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: circle(50%);
    opacity: 1;
    z-index: 0;
}

/* 无头像时显示默认卡片 */
.field-slot.has-player.no-avatar .slot-bg-avatar {
    display: block !important;
    object-fit: cover;
    opacity: 0.4;
    filter: grayscale(1);
}

/* 号码在占位符外部下方 */
.slot-number-circle {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0, 0, 0, 0.6);
    padding: 1px 8px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    line-height: 1.5;
    z-index: 5;
}

/* 移除按钮（在名字后面，hover时显示） */
.slot-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.field-slot:hover .slot-remove-btn {
    opacity: 1;
}

.slot-remove-btn:hover {
    background: #dc3545;
    transform: scale(1.2);
}

.field-slot.drag-over .field-slot-inner {
    border-color: var(--accent);
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    transform: scale(1.15);
}

.field-slot .slot-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* 已分配球员：圆圈内只有号码 */
/* 号码样式已移至上方的通用定义中 */

/* 圆圈上方信息：横向排列（位置 + 头像 + 名字） */
.slot-info-above {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.slot-current-label {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 700;
    background: rgba(0, 212, 255, 0.15);
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.5;
}

/* 上方头像已移除，只作背景 */

.field-slot .slot-player-name {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-slot.dragging {
    opacity: 0.5;
}

.field-slot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* ==================== 球员列表 ==================== */
.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.players-header h3 {
    color: var(--accent);
    font-size: 1.1rem;
}

.formation-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.formation-selector label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.formation-selector select {
    padding: 0.4rem 0.8rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.formation-selector select:focus {
    outline: none;
    border-color: var(--accent);
}

.player-list-container {
    max-height: 640px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.player-list-container::-webkit-scrollbar {
    width: 6px;
}

.player-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.player-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.player-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.player-filters select {
    padding: 0.35rem 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    flex: 1;
}

.player-filters select:focus {
    outline: none;
    border-color: var(--accent);
}

.player-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.3rem;
    cursor: grab;
    transition: all 0.1s ease;
    user-select: none;
}

.player-card:hover {
    border-color: var(--accent);
    background: rgba(0, 212, 255, 0.05);
    transform: translateX(3px);
}

.player-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.player-card-number-big {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.12);
    min-width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
}

.player-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-card-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-card-position {
    font-size: 0.65rem;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

.player-card-team {
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.player-card-rating {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 700;
    white-space: nowrap;
    min-width: 24px;
    text-align: right;
}

/* ==================== 底部操作栏 ==================== */
.lineup-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5rem;
}

.lineup-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lineup-rating .stars {
    color: var(--gold);
    font-size: 1.2rem;
}

.lineup-rating .rating-number {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 1rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-save {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
}

.btn-save-as {
    padding: 0.6rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-save-as:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

/* ==================== 弹窗 ==================== */
/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

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

.empty-state p {
    font-size: 1rem;
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    .lineup-layout {
        flex-direction: column;
        align-items: center;
    }

    .lineup-field-area {
        flex: none;
        width: 100%;
        max-width: 420px;
    }

    .field-container {
        width: 100%;
        height: auto;
        aspect-ratio: 380 / 560;
    }

    .lineup-players-area {
        width: 100%;
    }

    .lineup-actions {
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 480px) {
    .lineup-tabs {
        flex-wrap: wrap;
    }

    .btn-new-lineup {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .player-card {
        padding: 0.5rem 0.6rem;
    }

    /* 底部操作栏 */
    .lineup-actions {
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.8rem;
    }

    .lineup-actions .action-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .lineup-actions .action-buttons .btn-save,
    .lineup-actions .action-buttons .btn-save-as {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .lineup-actions .action-buttons .btn-save i,
    .lineup-actions .action-buttons .btn-save-as i {
        font-size: 0.8rem;
    }

    /* 球场头部（评分+阵型） */
    .field-area-header {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .field-area-header .field-area-rating {
        font-size: 0.95rem;
    }

    .field-area-header .field-area-rating .stars {
        font-size: 1rem;
    }

    .field-area-header .field-area-rating .rating-number {
        font-size: 1rem;
    }

    .field-area-header .formation-selector label {
        font-size: 0.95rem;
    }

    .field-area-header .formation-selector select {
        font-size: 0.95rem;
        padding: 0.3rem 0.5rem;
    }

    /* 球场占位符（位置+头像+名字） */
    .field-slot .slot-current-label {
        font-size: 0.8rem;
    }

    .field-slot .slot-player-name {
        font-size: 0.9rem;
    }

    .field-slot .field-slot-inner {
        width: 52px;
        height: 52px;
    }

    /* 移动端：触控提示，不覆盖滚动 */
    .field-slot,
    .player-card {
        cursor: pointer;
    }
}
