:root {
    --primary: #8A2BE2;
    --secondary: #4169E1;
    --dark: #222;
    --light: #f5f5f5;
    --accent: #FF6347;
    --bg-gradient: linear-gradient(135deg, #131313, #252525);
    --success: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: #1a1a1a;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.app-container {
    display: flex;
    flex-wrap: wrap;
    padding: 1rem;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

.tools-panel {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-section {
    border-bottom: 1px solid #333;
    padding-bottom: 1rem;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h3 {
    margin-bottom: 0.75rem;
    color: var(--secondary);
    font-size: 1.1rem;
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-option {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.color-option.selected {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
    transform: scale(1.1);
}

.custom-color {
    width: 100%;
    padding: 0.5rem 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.tool-btn {
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--primary);
}

.tool-btn.active {
    background: var(--primary);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.tool-btn i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    display: block;
}

.slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider {
    width: 100%;
    accent-color: var(--primary);
}

.slider-label {
    display: flex;
    justify-content: space-between;
}

.action-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn.primary {
    background: var(--primary);
    color: white;
}

.action-btn.secondary {
    background: var(--secondary);
    color: white;
}

.action-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.canvas-container {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    flex: 1;
    max-width: 800px;
    position: relative;
}

#pixel-canvas {
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

.canvas-settings {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.9rem;
}

.setting-group input,
.setting-group select {
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
}

.layers-panel {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #333;
    border-radius: 4px;
    cursor: pointer;
    gap: 0.5rem;
}

.layer-item.active {
    background: var(--primary);
}

.layer-visibility {
    cursor: pointer;
    opacity: 0.5;
}

.layer-visibility.visible {
    opacity: 1;
}

.layer-name {
    flex: 1;
}

.layer-preview {
    width: 24px;
    height: 24px;
    background: #444;
    border-radius: 2px;
}

.layer-controls {
    display: flex;
    gap: 0.5rem;
}

.layer-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.layer-btn:hover {
    opacity: 1;
}

.effects-panel {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.effect-btn {
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.effect-btn:hover {
    background: var(--accent);
}

/* New styles for mirror toggle buttons */
#mirror-x-toggle.active,
#mirror-y-toggle.active {
    background: var(--success);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.preview-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

#animation-preview {
    max-width: 200px;
    max-height: 200px;
    border: 2px solid #333;
}

.frame-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.frame-btn {
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.frame-btn:hover {
    background: var(--secondary);
}

.frame-indicator {
    font-size: 0.9rem;
}

/* New animation actions styles */
.animation-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.animation-actions .action-btn {
    flex: 1;
    font-size: 0.9rem;
}

.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}

.notification {
    background: #333;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid #4CAF50;
}

.notification.info {
    border-left: 4px solid #2196F3;
}

.notification.warning {
    border-left: 4px solid #FF9800;
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tools-panel, .layers-panel {
        width: 100%;
        max-width: 600px;
    }
}

/* Icon font */
@font-face {
    font-family: 'icomoon';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

.icon {
    font-family: 'icomoon';
    font-style: normal;
}

/* Specific styles for the lasso tool selection path */
.lasso-path {
    stroke: #FF0000;
    stroke-width: 1px;
    fill: rgba(255, 0, 0, 0.1);
    pointer-events: none;
}

.selection-area {
    outline: 2px dashed #FF0000;
    pointer-events: none;
}

/* Help text for lasso tool */
.lasso-help {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.lasso-help.visible {
    opacity: 1;
}
#animation-preview {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}