/* Core Styles - Basic layout and shared components */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

/* Header Styles */
.crochet-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.crochet-logo {
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
}

.crochet-logo:hover {
    transform: translateY(-2px);
}

.crochet-back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crochet-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Main Layout */
.crochet-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 2rem;
    min-height: calc(100vh - 80px);
}

/* Panel Styles */
.crochet-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: fit-content;
    transition: all 0.3s ease;
}

.crochet-panel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.crochet-panel h3 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Canvas Styles */
.crochet-canvas {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.crochet-canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.crochet-canvas-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crochet-canvas-title::before {
    content: "📊";
    font-size: 1.5rem;
}

/* Button Styles */
.crochet-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.crochet-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.crochet-btn:active {
    transform: translateY(0);
}

.crochet-btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.crochet-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.crochet-btn.danger {
    background: #dc3545;
}

.crochet-btn.danger:hover {
    background: #c82333;
}

/* Input Styles */
.crochet-input-group {
    margin-bottom: 1.5rem;
}

.crochet-input-group label {
    display: block;
    color: white;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.crochet-input {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.crochet-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.crochet-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* DSL Editor */
.crochet-dsl-editor {
    width: 100%;
    height: 120px;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.crochet-dsl-editor:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.crochet-dsl-editor::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Controls Layout */
.crochet-controls {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Export Buttons */
.crochet-export-section {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.crochet-export-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.8rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.crochet-export-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Notification System */
.crochet-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    max-width: 300px;
}

.crochet-notification.success {
    background: #28a745;
}

.crochet-notification.error {
    background: #dc3545;
}

.crochet-notification.info {
    background: #17a2b8;
}

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

/* Loading States */
.crochet-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .crochet-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .crochet-canvas {
        order: 1;
    }

    #stitchPalettePanel {
        order: 2;
    }

    #controlsPanel {
        order: 3;
    }
}

@media (max-width: 768px) {
    .crochet-container {
        padding: 1rem;
        gap: 1rem;
    }

    .crochet-header {
        padding: 1rem;
    }

    .crochet-logo {
        font-size: 1.5rem;
    }

    .crochet-canvas {
        padding: 1.5rem;
    }

    .crochet-canvas-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .crochet-controls {
        justify-content: center;
    }

    .crochet-panel {
        padding: 1.2rem;
    }
}

@media (max-width: 480px) {
    .crochet-container {
        padding: 0.5rem;
    }

    .crochet-canvas {
        padding: 1rem;
    }

    .crochet-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.crochet-btn:focus-visible,
.crochet-input:focus-visible,
.crochet-dsl-editor:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}