/* Chart Renderer - Simple and clean approach with large grid support */

.crochet-chart-wrapper {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.crochet-chart-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.crochet-size-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.crochet-size-controls label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 5px;
}

.crochet-size-controls input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.crochet-action-controls {
    display: flex;
    gap: 10px;
}

.crochet-chart-info {
    background: #e9ecef;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.crochet-drag-hint {
    color: #6f42c1;
    font-weight: 500;
}

.crochet-chart-container {
    display: inline-block;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: auto;
    background: white;
    user-select: none;
    max-width: calc(100vw - 80px);
    max-height: 70vh;
}

/* Chart Header Row */
.crochet-chart-header {
    display: flex;
    background: #e9ecef;
    border-bottom: 2px solid #333;
}

.crochet-corner-cell {
    width: 40px;
    height: 30px;
    background: #dee2e6;
    border-right: 1px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crochet-col-header {
    width: 30px;
    height: 30px;
    border-right: 1px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    flex-shrink: 0;
}

.crochet-col-header:last-child {
    border-right: none;
}

.crochet-chart-row {
    display: flex;
    border-bottom: 1px solid #666 !important;
    flex-wrap: nowrap;
    min-width: fit-content;
}

.crochet-chart-row:last-child {
    border-bottom: none !important;
}

.crochet-row-header {
    width: 40px;
    height: 30px;
    border-right: 1px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    flex-shrink: 0;
}

.crochet-pattern-cell {
    width: 30px;
    height: 30px;
    border-right: 1px solid #666 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    transition: all 0.15s ease;
    flex-shrink: 0;
}


.crochet-pattern-cell:last-child {
    border-right: none;
}

.crochet-chart-row:first-child .crochet-pattern-cell {
    border-top: 1px solid #666 !important;
}

.crochet-pattern-cell:hover {
    background: #e6f3ff !important;
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.crochet-pattern-cell:active {
    transform: scale(0.95);
}

/* Stitch Types */
.crochet-pattern-cell.single-crochet {
    background: #d4edda;
    color: #155724;
}

.crochet-pattern-cell.double-crochet {
    background: #fff3cd;
    color: #856404;
}

.crochet-pattern-cell.chain {
    background: #cce5ff;
    color: #004085;
}

.crochet-pattern-cell.slip-stitch {
    background: #f5f5f5;
    color: #6c757d;
}

.crochet-pattern-cell.half-double {
    background: #f8d7da;
    color: #721c24;
}

.crochet-pattern-cell.treble {
    background: #e2e3f4;
    color: #383d41;
}

.crochet-pattern-cell.decrease {
    background: #f5c6cb;
    color: #721c24;
}

.crochet-pattern-cell.increase {
    background: #d1ecf1;
    color: #0c5460;
}

.crochet-pattern-cell.front-post {
    background: #c3e6cb;
    color: #155724;
}

.crochet-pattern-cell.back-post {
    background: #ffeaa7;
    color: #856404;
}

.crochet-pattern-cell.picot {
    background: #e2e3f4;
    color: #383d41;
}

/* Button Styles */
.crochet-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.crochet-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.crochet-btn.secondary {
    background: linear-gradient(45deg, #6c757d, #495057);
}

/* Responsive */
@media (max-width: 1024px) {
    .crochet-chart-container {
        max-width: calc(100vw - 60px);
        max-height: 60vh;
    }
    
    .crochet-chart-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .crochet-size-controls {
        justify-content: center;
        padding: 12px;
    }
    
    .crochet-size-controls input {
        width: 70px;
        padding: 6px 10px;
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .crochet-chart-wrapper {
        padding: 16px;
        margin: 16px 0;
    }
    
    .crochet-chart-container {
        max-width: calc(100vw - 40px);
        max-height: 55vh;
    }
    
    .crochet-chart-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .crochet-size-controls {
        justify-content: center;
        padding: 12px;
        flex-wrap: wrap;
    }
    
    .crochet-size-controls input {
        width: 70px;
        padding: 8px 10px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .crochet-action-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .crochet-btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .crochet-pattern-cell,
    .crochet-col-header {
        width: 28px;
        height: 28px;
        font-size: 15px;
        min-height: 28px;
    }
    
    .crochet-corner-cell,
    .crochet-row-header {
        width: 38px;
        height: 28px;
        font-size: 13px;
    }
    
    .crochet-chart-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 16px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .crochet-chart-wrapper {
        padding: 12px;
        margin: 12px 0;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        background-image: url('https://images.unsplash.com/photo-1607344645866-009c7d0b6b7c?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=60');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        background-blend-mode: overlay;
        background-color: rgba(255, 255, 255, 0.9);
    }
    
    .crochet-chart-container {
        max-width: calc(100vw - 24px);
        max-height: 50vh;
    }
    
    .crochet-pattern-cell,
    .crochet-col-header {
        width: 24px;
        height: 24px;
        font-size: 13px;
        min-height: 24px;
    }
    
    .crochet-corner-cell,
    .crochet-row-header {
        width: 32px;
        height: 24px;
        font-size: 12px;
    }
    
    .crochet-size-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }
    
    .crochet-size-controls input {
        width: 60px;
        padding: 10px 8px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .crochet-size-controls label {
        font-size: 15px;
    }
    
    .crochet-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .crochet-chart-info {
        padding: 10px 12px;
        font-size: 14px;
    }
}