/* ThinkPHP 滑块验证码样式 - 修正版 */
.think-captcha {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tc-container {
    width: 340px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.tc-container.tc-theme-dark {
    background: #1e1e1e;
    color: #ffffff;
}

.tc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #4a6fa5 0%, #2c3e50 100%);
    color: white;
}

.tc-container.tc-theme-dark .tc-header {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
}

.tc-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.tc-icon-shield,
.tc-icon-refresh,
.tc-icon-arrow,
.tc-icon-info {
    display: inline-block;
    font-style: normal;
}

.tc-icon-shield:before {
    content: "🛡️";
}

.tc-icon-refresh:before {
    content: "↻";
}

.tc-icon-arrow:before {
    content: "↔";
}

.tc-icon-info:before {
    content: "ℹ";
}

.tc-refresh {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    font-size: 18px;
}

.tc-refresh:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.tc-body {
    padding: 20px;
}

/* 图片区域 */
.tc-image-area {
    position: relative;
    width: 300px;
    height: 180px;
    margin: 0 auto 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.tc-container.tc-theme-dark .tc-image-area {
    background: #2d2d2d;
    border-color: #404040;
}

.tc-base-image {
    width: 100%;
    height: 100%;
    position: relative;
}

.tc-base-image img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    transition: opacity 0.3s;
}

.tc-base-image.tc-loaded img {
    opacity: 1;
}

/* 拼图块样式 */
.tc-puzzle-piece {
    position: absolute;
    width: 50px;
    height: 50px;
    background-size: 50px 50px;
    background-repeat: no-repeat;
    cursor: move;
    z-index: 10;
    will-change: left;
    pointer-events: none;
    filter: drop-shadow(0 0 1.5px rgba(74,111,165,0.9)) drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}

.tc-puzzle-inner {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #4a6fa5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

/* 默认形状 - 带缺口的方块 */
.tc-puzzle-inner.default-shape {
    border-radius: 8px;
    clip-path: polygon(
        0% 15%, 15% 15%, 15% 0%, 85% 0%, 
        85% 15%, 100% 15%, 100% 85%, 
        85% 85%, 85% 100%, 15% 100%, 
        15% 85%, 0% 85%
    );
}

/* 圆形 */
.tc-puzzle-piece.circle-shape .tc-puzzle-inner {
    border-radius: 50%;
    clip-path: none;
}

/* 方形 */
.tc-puzzle-piece.square-shape .tc-puzzle-inner {
    border-radius: 0;
    clip-path: none;
}

/* 菱形 */
.tc-puzzle-piece.diamond-shape .tc-puzzle-inner {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* 目标缺口样式 */
.tc-puzzle-target {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    z-index: 5;
    box-sizing: border-box;
}

.tc-target-border {
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(74, 111, 165, 0.8);
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.1);
}

/* 目标缺口形状 */
.tc-puzzle-target.default-shape .tc-target-border {
    border-radius: 8px;
    clip-path: polygon(
        0% 15%, 15% 15%, 15% 0%, 85% 0%, 
        85% 15%, 100% 15%, 100% 85%, 
        85% 85%, 85% 100%, 15% 100%, 
        15% 85%, 0% 85%
    );
}

.tc-puzzle-target.circle-shape .tc-target-border {
    border-radius: 50%;
    clip-path: none;
}

.tc-puzzle-target.square-shape .tc-target-border {
    border-radius: 0;
    clip-path: none;
}

.tc-puzzle-target.diamond-shape .tc-target-border {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* 拼图对齐时的样式 */
.tc-puzzle-piece.aligned {
    border-color: #4CAF50;
    box-shadow: 0 2px 12px rgba(76, 175, 80, 0.3);
}

.tc-puzzle-target.aligned .tc-target-border {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

/* 滑块区域 */
.tc-slider-area {
    position: relative;
    height: 44px;
    margin: 20px 0;
}

.tc-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: #f1f3f5;
    border-radius: 22px;
    overflow: hidden;
}

.tc-container.tc-theme-dark .tc-slider-track {
    background: #2d2d2d;
}

.tc-slider-bg {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #4a6fa5, #6a8bc5);
    transition: width 0.1s;
    border-radius: 22px;
}

.tc-slider-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4a6fa5, #2c3e50);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(74, 111, 165, 0.5);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s;
    user-select: none;
    animation: tc-pulse 2s infinite;
}
@keyframes tc-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(74,111,165,0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(74,111,165,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,111,165,0); }
}

.tc-container.tc-theme-dark .tc-slider-thumb {
    background: #ffffff;
}

.tc-slider-thumb.tc-active {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(74, 111, 165, 0.6);
    transform: scale(1.08);
    animation: none;
    transition: box-shadow 0.1s, transform 0.1s; /* 拖动中只保留必要过渡 */
}
/* 拖动中关闭拼图位移过渡，避免跟手延迟 */
.tc-puzzle-piece.tc-dragging {
    transition: none !important;
}

.tc-slider-icon {
    color: #ffffff;
    font-size: 18px;
}

.tc-slider-text {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    color: #666;
    font-size: 14px;
    pointer-events: none;
}

.tc-container.tc-theme-dark .tc-slider-text {
    color: #aaa;
}

.tc-slider-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 30;
    display: none;
}

/* 底部区域 */
.tc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 12px;
}

.tc-tips {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.tc-container.tc-theme-dark .tc-tips {
    color: #aaa;
}

.tc-risk {
    padding: 4px 10px;
    border-radius: 12px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 500;
}

.tc-risk[data-risk="high"] {
    background: #ffebee;
    color: #c62828;
}

.tc-container.tc-theme-dark .tc-risk {
    background: #2d2d2d;
}

/* 消息区域 — 不占高度，仅作状态标记 */
.tc-message {
    display: none !important;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.tc-message.tc-loading {
    display: block;
    background: #f8f9fa;
    color: #666;
}

.tc-message.tc-success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
}

.tc-message.tc-error {
    display: block;
    background: #ffebee;
    color: #c62828;
    animation: tc-shake 0.5s;
}

@keyframes tc-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 成功状态 */
.tc-success .tc-slider-bg {
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.tc-success .tc-slider-thumb {
    background: #4CAF50;
}

.tc-success .tc-slider-icon {
    color: white;
}

/* 错误状态 */
.tc-error {
    text-align: center;
    padding: 40px 20px;
}

.tc-error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: #ffebee;
    color: #c62828;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.tc-error-message {
    margin-bottom: 20px;
    color: #666;
}

.tc-retry-btn {
    padding: 10px 24px;
    background: #4a6fa5;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.tc-retry-btn:hover {
    background: #3a5a85;
}

/* 加载状态 */
.tc-loading-state {
    text-align: center;
    padding: 60px 20px;
}

.tc-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a6fa5;
    border-radius: 50%;
    animation: tc-spin 1s linear infinite;
}

.tc-loading-text {
    color: #666;
    font-size: 14px;
}

@keyframes tc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图片信息样式 */
.tc-image-info {
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .tc-container {
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
    }
    
    .tc-image-area {
        width: 100%;
    }
    
    .tc-slider-area {
        height: 40px;
    }
    
    .tc-slider-thumb {
        width: 40px;
        height: 40px;
    }
    
    .tc-slider-text {
        font-size: 13px;
    }
}

/* IE兼容性 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .tc-container {
        min-width: 340px;
    }
    
    .tc-slider-thumb {
        transition: none;
    }
    
    /* IE不支持clip-path，使用替代方案 */
    .tc-puzzle-inner.default-shape,
    .tc-puzzle-target.default-shape .tc-target-border {
        border-radius: 8px;
        position: relative;
        overflow: hidden;
    }
    
    .tc-puzzle-inner.default-shape:before,
    .tc-puzzle-target.default-shape .tc-target-border:before {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        background: inherit;
        clip-path: none; /* IE不支持clip-path */
    }
}
