/* Animation Builder Styles */

/* Section Layout */
.animation-section {
    margin-bottom: 40px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Animation Toolbar */
.animation-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Animation Library Grid */
.animation-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.animation-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.animation-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.animation-item.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

.animation-item h5 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.animation-item p {
    margin: 0 0 15px 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.animation-item-actions {
    display: flex;
    gap: 10px;
}

/* Keyframe Workspace */
.keyframe-workspace {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    min-height: 500px;
}

/* Timeline Container */
.timeline-container {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
}

.timeline-controls {
    display: flex;
    gap: 5px;
}

.timeline-controls .btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.timeline-controls .btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.timeline-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #495057;
}

.timeline-settings {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-settings .form-control {
    width: 80px;
}

/* Timeline Canvas */
.timeline-canvas {
    position: relative;
    height: 400px;
    background: white;
    overflow: auto;
}

.timeline-ruler {
    height: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.ruler-marks {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 10px;
    background-image: repeating-linear-gradient(
        to right,
        #dee2e6 0,
        #dee2e6 1px,
        transparent 1px,
        transparent 10px
    );
}

.ruler-numbers {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    font-size: 0.7rem;
    color: #6c757d;
}

.timeline-tracks {
    padding: 20px;
}

.timeline-track {
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px;
    position: relative;
    min-height: 40px;
}

.track-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.track-content {
    position: relative;
    height: 30px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.keyframe-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 2;
}

.keyframe-marker:hover {
    background: #5a6fd8;
    transform: translate(-50%, -50%) scale(1.2);
}

.keyframe-marker.selected {
    background: #e74c3c;
    border-color: #c0392b;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e74c3c;
    z-index: 10;
    pointer-events: none;
}

.timeline-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
}

/* Keyframe Properties Panel */
.keyframe-properties {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    max-height: 500px;
}

.keyframe-properties h4 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Property Tabs */
.properties-tabs {
    margin-bottom: 20px;
}

.tab-nav {
    display: flex;
    background: #e9ecef;
    border-radius: 6px;
    padding: 2px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: white;
    color: #2c3e50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.property-tab {
    display: none;
}

.property-tab.active {
    display: block;
}

/* Property Groups */
.property-group {
    margin-bottom: 20px;
}

.property-group .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.property-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.range-input {
    flex: 2;
}

.number-input {
    width: 60px;
    font-size: 0.8rem;
}

.unit {
    font-size: 0.7rem;
    color: #6c757d;
    min-width: 20px;
}

.color-input {
    width: 40px;
    height: 35px;
    padding: 0;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    cursor: pointer;
}

.text-input {
    flex: 1;
    font-size: 0.8rem;
}

.unit-select {
    width: 60px;
    font-size: 0.8rem;
}

/* Shadow Controls */
.shadow-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
}

.shadow-controls input[type="range"] {
    grid-column: span 1;
}

.shadow-controls input[type="color"] {
    grid-column: span 2;
    width: 100%;
}

/* Spacing Controls */
.spacing-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.spacing-input {
    font-size: 0.8rem;
}

/* Custom Properties */
.custom-property-input {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.custom-property-input input {
    flex: 1;
}

.custom-properties-list {
    max-height: 200px;
    overflow-y: auto;
}

.custom-property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.custom-property-item button {
    margin-left: 10px;
}

/* Keyframe Actions */
.keyframe-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Trigger Builder */
.trigger-builder {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.trigger-list {
    margin-bottom: 20px;
}

.trigger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.trigger-info {
    flex: 1;
}

.trigger-type {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.trigger-config {
    font-size: 0.8rem;
    color: #6c757d;
}

.trigger-actions {
    display: flex;
    gap: 5px;
}

.add-trigger {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-trigger select {
    flex: 1;
}

/* Preview Section */
.preview-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-settings {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-settings .form-control {
    width: 120px;
}

.preview-stage {
    height: 300px;
    background: white;
    border: 2px dashed #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-element {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

/* Performance Dashboard */
.performance-dashboard {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.performance-score {
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #27ae60 0%, #27ae60 var(--score-percent, 100%), #e9ecef var(--score-percent, 100%), #e9ecef 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
}

.score-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    z-index: 1;
}

.score-label {
    font-size: 0.8rem;
    color: #6c757d;
    z-index: 1;
}

.performance-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.performance-issues,
.performance-recommendations {
    background: white;
    border-radius: 6px;
    padding: 15px;
}

.performance-issues h5,
.performance-recommendations h5 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.issues-list,
.recommendations-list {
    font-size: 0.8rem;
}

.issue-item,
.recommendation-item {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 5px;
    border-left: 3px solid #e74c3c;
}

.recommendation-item {
    border-left-color: #27ae60;
}

/* Iteration Controls */
.iteration-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.iteration-controls input[type="number"] {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #495057;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .keyframe-workspace {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .keyframe-properties {
        max-height: none;
    }
    
    .performance-dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .animation-toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: center;
        width: 100%;
    }
    
    .timeline-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .preview-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .tab-nav {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        min-width: 80px;
    }
    
    .property-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .range-input {
        order: 1;
    }
    
    .number-input {
        order: 2;
        width: 100%;
    }
}

/* Animation Classes for Preview */
.animate-fade-in {
    animation: fadeIn 1s ease-in-out;
}

.animate-slide-in-left {
    animation: slideInLeft 1s ease-out;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-spin {
    animation: spin 2s linear infinite;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
    40%, 43% { transform: translateY(-30px); }
    70% { transform: translateY(-15px); }
    90% { transform: translateY(-4px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Accessibility Enhancements */
.timeline-track:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.keyframe-marker:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .timeline-track,
    .trigger-item,
    .animation-item {
        border-width: 2px;
    }
    
    .keyframe-marker {
        border-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .preview-element,
    .animation-item,
    .keyframe-marker {
        transition: none;
    }
    
    .animate-fade-in,
    .animate-slide-in-left,
    .animate-bounce,
    .animate-pulse,
    .animate-spin {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .animation-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .timeline-canvas,
    .preview-stage {
        background: white;
        border: 1px solid #000;
    }
    
    .btn {
        display: none;
    }
}