/* 交互式语法教学工具样式 */
.interactive-grammar-tool {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.tool-instructions {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

.tool-instructions h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.tool-instructions ul li {
    margin-bottom: 5px;
    color: #6c757d;
}

.tool-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 15px;
}

.image-container {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

.teaching-image {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    display: block;
}

.interactive-area {
    position: absolute;
    border: 3px solid #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 30px;
    min-height: 30px;
}

.interactive-area.circle {
    border-radius: 50%;
}

.interactive-area:hover {
    border-color: #c0392b;
    background: rgba(231, 76, 60, 0.3);
}

.interactive-area.selected {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.3);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.interactive-area.editable {
    border-style: dashed;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #f39c12;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.resize-handle.nw {
    top: -4px;
    left: -4px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -4px;
    right: -4px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

.resize-handle:hover {
    background: #e67e22;
    transform: scale(1.2);
}

/* 区域面板 */
.areas-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
}

.areas-panel h5 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.area-item {
    background: white;
    transition: all 0.2s ease;
}

.area-item:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 区域编辑器 */
.area-editor {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.area-editor h5 {
    color: #856404;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.area-editor .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.area-editor .form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.area-editor .form-control:focus {
    border-color: #f39c12;
    box-shadow: 0 0 0 0.2rem rgba(243, 156, 18, 0.25);
}

/* 区域提示框 */
.area-tooltip {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    animation: fadeInUp 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.area-tooltip h6 {
    color: #495057;
    margin-bottom: 8px;
}

.area-tooltip p {
    margin-bottom: 5px;
    color: #6c757d;
}

.area-tooltip em {
    color: #5B9BD5;
    font-style: normal;
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tool-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tool-controls .btn-group {
        margin-bottom: 10px;
    }
    
    .area-editor .row {
        margin: 0;
    }
    
    .area-editor .col-md-6 {
        padding: 0;
        margin-bottom: 15px;
    }
    
    .area-tooltip {
        max-width: 250px !important;
        font-size: 0.9rem;
    }
}

/* 按钮样式增强 */
.btn-group .btn {
    border-radius: 4px;
}

.btn-group .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* 文件输入样式 */
#configFile {
    display: none;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
