/* Canvas Styles - Color Splash Game */
/* Drawing canvas and related UI components */

.canvas-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 20px;
    margin: 0 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
    min-height: 400px;
}

#painting-canvas {
    border: 4px solid #fff;
    border-radius: 12px;
    cursor: crosshair;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    background: white;
    transition: all 0.3s ease;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#painting-canvas:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

/* Canvas overlay for turn indicators */
.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.turn-indicator {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    animation: bounce-in 0.5s ease;
    display: none;
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Canvas tools display */
.canvas-tools {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.selected-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
}

.selected-color::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #4ecdc4;
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.selected-tool {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Drawing effects and animations */
.drawing-effect {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    animation: drawing-sparkle 0.6s ease-out forwards;
}

@keyframes drawing-sparkle {
    0% { 
        transform: scale(0); 
        opacity: 1; 
    }
    100% { 
        transform: scale(3); 
        opacity: 0; 
    }
}

/* Brush preview */
.brush-preview {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: all 0.1s ease;
}

/* Tool-specific cursor styles */
.canvas-container[data-tool="brush"] #painting-canvas {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="2" fill="black"/></svg>') 12 12, crosshair;
}

.canvas-container[data-tool="spray"] #painting-canvas {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" fill="none" stroke="black" stroke-width="2"/></svg>') 12 12, crosshair;
}

.canvas-container[data-tool="roller"] #painting-canvas {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect x="6" y="10" width="12" height="4" fill="black"/></svg>') 12 12, crosshair;
}

/* Canvas loading state */
.canvas-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.1em;
}

.canvas-loading::before {
    content: '🎨';
    font-size: 3em;
    margin-bottom: 15px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Canvas save/export styles */
.save-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.save-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.save-content {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    padding: 25px 35px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.save-icon {
    font-size: 2em;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Canvas fullscreen mode */
.canvas-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-fullscreen #painting-canvas {
    max-width: 90vw;
    max-height: 90vh;
}

.fullscreen-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.fullscreen-controls .btn {
    padding: 10px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
}

.fullscreen-controls .btn:hover {
    background: white;
    transform: translateY(-2px);
}

/* Canvas grid overlay (optional) */
.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.1;
    background-image: 
        linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    #painting-canvas {
        cursor: none; /* Hide cursor on touch devices */
    }
    
    .canvas-tools {
        padding: 15px 25px;
        margin-top: 20px;
    }
    
    .selected-color {
        width: 50px;
        height: 50px;
    }
    
    .selected-tool {
        font-size: 1.3em;
    }
}

/* High contrast mode */
.high-contrast .canvas-container {
    background: #000;
    border: 3px solid #fff;
}

.high-contrast #painting-canvas {
    border-color: #fff;
    filter: contrast(150%);
}

.high-contrast .canvas-tools {
    background: #000;
    border: 2px solid #fff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #painting-canvas,
    .selected-color::after,
    .turn-indicator,
    .drawing-effect {
        animation: none;
        transition: none;
    }
}

/* Print styles */
@media print {
    .canvas-container {
        background: white;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .canvas-tools,
    .canvas-overlay {
        display: none;
    }
}
