/* CSS3 Animation Study Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    transition: background 0.3s, color 0.3s;
}

body.dark-mode {
    background: #1a1a2e;
    color: #eee;
}

.main-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.tool-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

body.dark-mode .tool-header {
    background: #16213e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tool-header h1 {
    font-size: 24px;
    color: #2c3e50;
    margin: 0;
}

body.dark-mode .tool-header h1 {
    color: #fff;
}

.tool-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action, .btn-primary, .btn-ai, .btn-theme, .btn-small {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}

.btn-action {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #495057;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-action:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #b8c6db 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a4292 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
}

.btn-ai:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-theme {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-theme:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fullscreen-active {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(56, 239, 125, 0.3) !important;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(17, 153, 142, 0.3);
}

.btn-small:hover {
    background: linear-gradient(135deg, #0f8577 0%, #2fd66a 100%);
    box-shadow: 0 4px 10px rgba(17, 153, 142, 0.4);
}

body.dark-mode .btn-action {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    border: 1px solid rgba(255,255,255,0.1);
}

body.dark-mode .btn-action:hover {
    background: linear-gradient(135deg, #34495e 0%, #415261 100%);
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

@media (max-width: 1200px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

.preview-panel, .control-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

body.dark-mode .preview-panel,
body.dark-mode .control-panel {
    background: #16213e;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
}

.panel-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .panel-header {
    background: #0f3460;
    border-bottom: 1px solid #2c3e50;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

body.dark-mode .panel-header h3 {
    color: #fff;
}

.preview-wrapper {
    padding: 20px;
    min-height: 500px;
}

#animationPreview {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(0,0,0,0.1);
}

body.dark-mode #animationPreview {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border: 2px dashed rgba(255,255,255,0.1);
}

.animation-target {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    font-weight: bold;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.animation-target::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
}

/* Transition hover演示效果 */
.animation-target:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.5);
}

/* Transition演示动画类 */
.animation-target.demo-transition {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 18px 45px rgba(102, 126, 234, 0.45);
}

.controls-wrapper {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.control-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

body.dark-mode .control-group {
    border-bottom: 1px solid #2c3e50;
}

.control-group h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

body.dark-mode .control-group h4 {
    color: #ecf0f1;
}

.control-item {
    margin-bottom: 15px;
}

.control-item label {
    display: block;
    margin-bottom: 8px;
    color: #6c757d;
    font-size: 14px;
}

body.dark-mode .control-item label {
    color: #adb5bd;
}

.control-select, .control-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    color: #495057;
}

body.dark-mode .control-select,
body.dark-mode .control-input {
    background: #0f3460;
    border-color: #2c3e50;
    color: #ecf0f1;
}

.control-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.control-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    transition: all 0.3s;
}

.control-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.control-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

.value-display {
    display: inline-block;
    margin-left: 10px;
    padding: 4px 8px;
    background: #e7f3ff;
    color: #007bff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

body.dark-mode .value-display {
    background: #0f3460;
    color: #4dabf7;
}

.animation-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.type-btn {
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.type-btn:hover {
    border-color: #007bff;
    background: #f8f9fa;
    transform: translateY(-2px);
}

.type-btn.active {
    border-color: #007bff;
    background: #e7f3ff;
    color: #007bff;
}

body.dark-mode .type-btn {
    background: #3a3a58;
    border-color: #6c757d;
    color: #f8f9fa;
    font-weight: 500;
}

body.dark-mode .type-btn:hover {
    background: #4a4a6a;
    border-color: #a5b4fc;
    color: white;
}

body.dark-mode .type-btn.active {
    background: linear-gradient(135deg, #a5b4fc 0%, #c4b5fd 100%);
    border-color: #a5b4fc;
    color: #1a1a2e;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(165, 180, 252, 0.3);
}

.timing-functions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.timing-btn {
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.timing-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.timing-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

body.dark-mode .timing-btn {
    background: #0f3460;
    border-color: #2c3e50;
    color: #ecf0f1;
}

body.dark-mode .timing-btn:hover {
    background: #16213e;
    border-color: #4dabf7;
}

body.dark-mode .timing-btn.active {
    background: #4dabf7;
    color: #1a1a2e;
}

.code-panel {
    margin-top: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

body.dark-mode .code-panel {
    background: #16213e;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
}

.code-header {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .code-header {
    background: #0f3460;
    border-bottom: 1px solid #2c3e50;
}

.code-content {
    padding: 20px;
    background: #2d2d2d;
    color: #f8f8f2;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.code-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.search-box {
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.search-input {
    padding: 6px 35px 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    width: 200px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    width: 250px;
}

body.dark-mode .search-input {
    background: #0f3460;
    border-color: #2c3e50;
    color: #ecf0f1;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 14px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-results.show {
    display: block;
}

body.dark-mode .search-results {
    background: #16213e;
    border-color: #2c3e50;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
}

body.dark-mode .search-result-item {
    border-bottom: 1px solid #2c3e50;
}

body.dark-mode .search-result-item:hover {
    background: #0f3460;
}

.search-result-item strong {
    color: #667eea;
    font-size: 13px;
}

.search-result-item p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #6c757d;
}

body.dark-mode .search-result-item p {
    color: #adb5bd;
}

/* Fullscreen styles */
.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: #f5f7fa;
    overflow: auto;
    padding: 20px;
}

body.dark-mode .fullscreen {
    background: #1a1a2e;
}

.fullscreen .main-container {
    max-width: 100%;
    height: 100%;
}

.fullscreen .workspace {
    height: calc(100vh - 180px);
    overflow: visible;
}

.fullscreen .preview-panel,
.fullscreen .control-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.fullscreen .preview-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding-bottom: 0;
    min-height: 0;
}

.fullscreen #animationPreview {
    flex: 1;
    min-height: 250px;
    max-height: calc(100vh - 350px);
}

.fullscreen .play-controls {
    margin-top: 15px;
    padding: 10px 0;
    flex-shrink: 0;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 100;
    position: relative;
}

.fullscreen .controls-wrapper {
    max-height: calc(100vh - 250px);
}

/* Learning panel styles */
.learning-content {
    display: flex;
    gap: 20px;
    height: 100%;
    min-height: 400px;
}

.learning-sections {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.learning-section {
    margin-bottom: 18px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.learning-section:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

body.dark-mode .learning-section {
    background: #16213e;
    border-left-color: #a5b4fc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .learning-section:hover {
    box-shadow: 0 4px 12px rgba(165, 180, 252, 0.2);
}

.learning-section h3 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.learning-section h3::before {
    content: '📘';
    font-size: 16px;
}

body.dark-mode .learning-section h3 {
    color: #a5b4fc;
}

.learning-nav {
    flex: 0 0 200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px 12px;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 100%;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

body.dark-mode .learning-nav {
    background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.learning-nav h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
    text-shadow: none;
}

body.dark-mode .learning-nav h4 {
    color: #a5b4fc;
    border-bottom-color: #a5b4fc;
    text-shadow: none;
}

.learning-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.learning-nav li {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    color: #495057;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
}

body.dark-mode .learning-nav li {
    background: #16213e;
    color: #e9ecef;
    border-color: #2d2d44;
}

body.dark-mode .learning-nav li:hover {
    background: linear-gradient(135deg, #a5b4fc 0%, #c4b5fd 100%);
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(165, 180, 252, 0.4);
    border-color: #a5b4fc;
}

.learning-nav a {
    display: block;
    padding: 8px 12px;
    color: #667eea;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.2s;
}

.learning-nav li:hover {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #667eea;
    border-color: #667eea;
    transform: translateX(5px);
}

.learning-nav li.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

body.dark-mode .learning-nav a {
    color: #4dabf7;
}

body.dark-mode .learning-nav li:hover {
    background: rgba(165, 180, 252, 0.1);
    color: #a5b4fc;
    border-color: #a5b4fc;
}

body.dark-mode .learning-nav li.active {
    background: linear-gradient(135deg, #a5b4fc 0%, #c4b5fd 100%);
    color: #1a1a2e;
    font-weight: 600;
    border-color: #a5b4fc;
    box-shadow: 0 2px 8px rgba(165, 180, 252, 0.4);
}

.learning-sections {
    flex: 1;
    overflow-y: auto;
    padding: 5px 15px 15px 10px;
    background: #fafbfc;
    border-radius: 8px;
}

body.dark-mode .learning-sections {
    background: #0f1419;
}

.learning-sections::-webkit-scrollbar {
    width: 8px;
}

.learning-sections::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.learning-sections::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.learning-sections::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark-mode .learning-sections::-webkit-scrollbar-track {
    background: #2d2d44;
}

body.dark-mode .learning-sections::-webkit-scrollbar-thumb {
    background: #5a5a7a;
}

.property-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #667eea;
}

body.dark-mode .property-card {
    background: #0f3460;
    border-left-color: #4dabf7;
}

.property-card h4 {
    margin: 0 0 6px 0;
    color: #2c3e50;
    font-size: 14px;
}

body.dark-mode .property-card h4 {
    color: #ecf0f1;
}

.property-card code {
    background: #e9ecef;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #d63384;
}

body.dark-mode .property-card code {
    background: #16213e;
    color: #ff6b9d;
}

.property-values {
    margin-top: 6px;
}

.property-values div {
    padding: 3px 0;
    font-size: 13px;
    color: #495057;
}

body.dark-mode .property-values div {
    color: #adb5bd;
}

.example-box {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-top: 8px;
    border: 1px solid #dee2e6;
}

body.dark-mode .example-box {
    background: #16213e;
    border-color: #2c3e50;
}

.hidden {
    display: none !important;
}

.info-icon {
    cursor: help;
    margin-left: 5px;
    font-size: 16px;
    opacity: 0.7;
    transition: all 0.3s;
    display: inline-block;
    vertical-align: middle;
    position: relative;
}

.info-icon:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Custom tooltip on click */
.info-icon.show-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: tooltipFadeIn 0.2s ease-out;
    max-width: 300px;
    white-space: normal;
    min-width: 200px;
}

.info-icon.show-tooltip::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 4px;
    border: 6px solid transparent;
    border-right-color: #333;
    z-index: 1001;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

body.dark-mode .info-icon {
    opacity: 0.6;
}

body.dark-mode .info-icon:hover {
    opacity: 1;
}

body.dark-mode .info-icon.show-tooltip::after {
    background: #4a5568;
    color: #e9ecef;
}

body.dark-mode .info-icon.show-tooltip::before {
    border-right-color: #4a5568;
}

/* Enhanced tooltip styling */
label[title], 
input[title], 
select[title], 
button[title],
.info-icon[title] {
    position: relative;
}

/* Better tooltip rendering */
[title] {
    /*cursor: help;*/
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.play-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.play-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.play-btn.primary {
    background: #28a745;
    color: white;
}

.play-btn.primary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.play-btn.secondary {
    background: #6c757d;
    color: white;
}

.play-btn.secondary:hover {
    background: #5a6268;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 85%;
    max-width: 900px;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideDown 0.3s;
    display: flex;
    flex-direction: column;
}

/* 模板模态框使用更小的宽度 */
#templateModal .modal-content {
    max-width: 580px;
    width: 75%;
}

body.dark-mode .modal-content {
    background-color: #16213e;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

body.dark-mode .modal-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-bottom: 2px solid #495057;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: white;
    font-weight: 600;
}

body.dark-mode .modal-header h2 {
    color: #fff;
}

.modal-header .close_icon {
    font-size: 32px;
    font-weight: bold;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.3s;
    line-height: 20px;
    background: rgba(255,255,255,0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header .close_icon:hover {
    color: white;
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

body.dark-mode .close_icon:hover {
    color: white;
    background: rgba(255,255,255,0.15);
}

.modal-body {
    padding: 20px;
    max-height: 65vh;
    overflow-y: auto;
    flex: 1;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.template-card {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.template-card:hover {
    border-color: #007bff;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

body.dark-mode .template-card {
    border-color: #2c3e50;
    background: #0f3460;
}

body.dark-mode .template-card:hover {
    border-color: #4dabf7;
}

.template-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.template-name {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

body.dark-mode .template-name {
    color: #ecf0f1;
}

.template-desc {
    font-size: 12px;
    color: #6c757d;
}

body.dark-mode .template-desc {
    color: #adb5bd;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tool-actions {
        justify-content: center;
    }
    
    .animation-type-selector {
        grid-template-columns: 1fr;
    }
    
    .timing-functions {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styles */
.controls-wrapper::-webkit-scrollbar,
.code-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.controls-wrapper::-webkit-scrollbar-track,
.code-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

body.dark-mode .controls-wrapper::-webkit-scrollbar-track,
body.dark-mode .code-content::-webkit-scrollbar-track,
body.dark-mode .modal-body::-webkit-scrollbar-track {
    background: #0f3460;
}

.controls-wrapper::-webkit-scrollbar-thumb,
.code-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.controls-wrapper::-webkit-scrollbar-thumb:hover,
.code-content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
