/* 自定义样式 - 转换自Tailwind CSS */

/* 玻璃效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 颜色选择器样式 - 响应式设计，根据容器自动调整大小 */
.color-swatch {
    aspect-ratio: 1/1;
    width: 100%;
    max-width: 80px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
    z-index: 10;
}

.color-swatch.active {
    border: 3px solid #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

/* 区域选择项样式 - 统一设置 */
.area-item {
    transition: all 0.3s ease;
    /* 确保所有区域项高度一致 */
    height: 3rem;
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 0.5rem;
    /* 覆盖space-y-2可能添加的margin-top */
    margin-top: 0 !important;
}

.area-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* 移除active状态可能导致的高度变化 */
.area-item.active {
    background-color: rgba(59, 130, 246, 0.2);
    border-left: 4px solid #3b82f6;
    /* 保持一致的高度 */
    height: 3rem;
    padding: 0.75rem;
    gap: 0.5rem;
    /* 覆盖space-y-2可能添加的margin-top */
    margin-top: 0 !important;
}

/* 响应式区域选择列表 */
#area-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* 确保不受space-y-2影响 */
    margin-top: 0;
}

/* 移动设备上显示两列 */
@media (max-width: 1023px) {
    #area-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .area-item {
        border-radius: 0.375rem;
        border: 1px solid #e5e7eb;
    }
    .area-item.active {
        border-radius: 0.375rem;
        height: 2.6rem;
    }
}

/* 电脑版保持单列 */
@media (min-width: 1024px) {
    #area-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .area-item {
        padding: 0.75rem 1rem;
        border-radius: 0;
        border-left: 4px solid transparent;
    }
    .area-item.active {
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
    }
}

/* 预设方案项样式 */
.preset-item {
    transition: all 0.3s ease;
    cursor: pointer;
}

.preset-item:hover {
    transform: translateY(-5px);
}

/* 按钮样式 */
.btn-primary {
    background-color: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #64748b;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-accent {
    background-color: #f97316;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.btn-accent:hover {
    background-color: #ea580c;
}

/* 面板标题样式 */
.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

/* 提示框样式 */
.tooltip {
    visibility: hidden;
    position: absolute;
    background-color: #1e293b;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    margin-top: -2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    width: 120px;
    left: 50%;
    transform: translateX(-50%);
}

.has-tooltip:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* 球场容器样式 */
.court-container {
    position: relative;
    width: 100%;
    display: inline-block;
    overflow: hidden;
    border-radius: 0.5rem;
}

/* 为浅色添加深色边框以便识别 */
.color-swatch[data-color="#f7ebc3"],
.color-swatch[data-color="#f3e59e"],
.color-swatch[data-color="#efdb9c"],
.color-swatch[data-color="#f3e197"],
.color-swatch[data-color="#f0dd76"],
.color-swatch[data-color="#c5ede4"],
.color-swatch[data-color="#fbc2d1"],
.color-swatch[data-color="#c9cdb6"] {
    border-color: rgba(0, 0, 0, 0.3);
}

/* 悬停效果 */
.color-swatch:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
    z-index: 10;
}

/* 选中效果 - 增强版 */
.color-swatch.selected {
    border-color: #3b82f6;
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.15);
    position: relative;
    z-index: 10;
}

/* 选中标记 - 增强可见性 */
.color-swatch.selected::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 为浅色添加深色选中标记 */
.color-swatch.selected[data-color^="#f"],
.color-swatch.selected[data-color^="#e"],
.color-swatch.selected[data-color^="#d"],
.color-swatch.selected[data-color^="#c"],
.color-swatch.selected[data-color="#ffffff"] { color: #000;}
.color-swatch.selected[data-color^="#f"]::after,
.color-swatch.selected[data-color^="#e"]::after,
.color-swatch.selected[data-color^="#d"]::after,
.color-swatch.selected[data-color^="#c"]::after,
.color-swatch.selected[data-color="#ffffff"]::after {
    color: #3b82f6;
    text-shadow: none;
    font-size: 18px;
}


/* 响应式设计 - 移动设备优化 */
@media (max-width: 1023px) {
    /* 在移动设备上，预览区域应该占据更重要的位置 */
    .flex-col.lg:flex-row {
        flex-direction: column;
    }
    
    /* 调整左右面板在移动端的显示 */
    .lg\:w-1\/4 {
        width: 100%;
    }
    
    /* 中间预览区域调整 */
    .lg\:w-2\/4 {
        width: 100%;
    }
    
    /* 确保球场图片在移动设备上显示合适 */
    .court-image {
        max-width: 100%;
        height: auto;
    }
    
    /* 调整颜色选择器网格，在移动设备上显示更多列 */
    /* 颜色选择器网格优化 - 灵活响应式设计 */
#color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
}

/* 响应式网格布局优化 - 根据屏幕大小自动调整 */
@media (max-width: 639px) {
    #color-palette {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 6px;
    }
    .color-swatch {
        max-width: 45px;
    }
    .area-item{
        height: 2.6rem;
    }
}

@media (min-width: 640px) {
    #color-palette {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 7px;
    }
    .color-swatch {
        max-width: 50px;
    }
}

@media (min-width: 768px) {
    #color-palette {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
        gap: 8px;
    }
    .color-swatch {
        max-width: 55px;
    }
}

@media (min-width: 1024px) {
    #color-palette {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 10px;
    }
    .color-swatch {
        max-width: 65px;
    }
}

@media (min-width: 1280px) {
    #color-palette {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 12px;
    }
    .color-swatch {
        max-width: 70px;
    }
}
    
    /* 调整面板布局，让关键操作更易访问 */
    .bg-white.rounded-lg.shadow-lg.p-4 {
        padding: 0.75rem;
    }
    
    /* 调整区域选择面板，使其在移动设备上更紧凑 */
    .space-y-6 {
        gap: 1rem;
    }
    .gap-6 {
        gap: 1rem;
    }
    
    /* 确保按钮在小屏幕上更大，更容易点击 */
    .btn-primary,
    .btn-secondary,
    .btn-accent {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    /* 为移动设备添加顶部固定的配色控制按钮组 */
    .mobile-controls {
        position: sticky;
        top: 0;
        z-index: 100;
        background-color: white;
        padding: 0.75rem 1rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }
    
    /* 优化面板标题大小 */
    .panel-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* 移动设备上的颜色选择器优化 */
#color-palette {
    max-height: 280px;
}

/* 保留其他颜色样本样式不变，由上面的响应式设计控制 */



/* 颜色名称显示样式 */
#selected-color-name {
    text-align: center;
    padding: 8px 12px;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    margin-top: 8px;
    border-left: 3px solid #3b82f6;
    transition: all 0.3s ease;
}

/* 移动设备优化 */
@media (max-width: 640px) {
    /* 场景预览区域优化 */
    .court-container {
        width: 100%;
        max-height: 400px;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .court-image {
        max-height: 350px;
        width: auto !important;
    }
    
    /* 颜色选择器在移动设备上优化 */
    #color-palette {
        max-height: 300px;
        gap: 6px;
    }
    
    .color-swatch {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
}
}

.court-image {
    position: relative;
    width: 100%;
    height: auto;
    object-fit: contain;
    z-index: 5;
    display: block;
}

.court-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.court-area {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    opacity: 1; /* 完全不透明，始终显示真实颜色 */
}

/* 移除hover效果，避免任何颜色变化 */

.court-area.active {
    opacity: 1; /* 保持完全不透明 */
    /* 移除outline，不使用透明度变化作为选中状态反馈 */
}

/* 调整点样式 */
.adjustment-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    cursor: move;
    z-index: 10;
    display: none;
}

.adjustment-point.visible {
    display: block;
}

/* 调整线样式 */
.adjustment-line {
    position: absolute;
    height: 2px;
    background-color: #ef4444;
    transform-origin: 0 0;
    z-index: 5;
    display: none;
}

.adjustment-line.visible {
    display: block;
}

/* 调整面板样式 */
.adjustment-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 20;
    display: none;
}

.adjustment-panel.visible {
    display: flex;
}

/* 坐标输入框样式 */
.coordinate-input {
    width: 60px;
    padding: 4px;
    margin: 0 5px;
    text-align: center;
}