/* Checkbox Paint Page Styles */

/* Base Layout */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
}

/* Header */
.paint-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-btn {
    width: 44px;
    justify-content: center;
}

.theme-btn .fa-moon {
    display: none;
}

body.light-theme .theme-btn .fa-sun {
    display: none;
}

body.light-theme .theme-btn .fa-moon {
    display: inline-block;
}

/* Main Content */
.paint-main {
    flex: 1;
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Control Panel */
.control-panel {
    width: 280px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    height: fit-content;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 120px;
}

.panel-section {
    margin-bottom: 2rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Size Controls */
.size-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.size-btn {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.size-btn:hover,
.size-btn.active {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-1px);
}

/* Mode Controls */
.mode-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.mode-btn:hover,
.mode-btn.active {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-1px);
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.color-option.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.custom-color {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-color input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

.custom-color label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Action Controls */
.action-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Pattern Controls */
.pattern-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.pattern-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.pattern-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.pattern-btn i {
    font-size: 1.2rem;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.canvas-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.canvas-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.separator {
    opacity: 0.5;
}

/* Canvas Wrapper */
.canvas-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 700px;
    backdrop-filter: blur(20px);
}

/* Paint Canvas */
.paint-canvas {
    display: grid;
    gap: 3px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    user-select: none;
}

.paint-checkbox {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
}

.paint-checkbox:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.paint-checkbox.painted {
    background: var(--current-color, #667eea);
    border-color: var(--current-color, #667eea);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* Canvas Footer */
.canvas-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.canvas-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
}

.canvas-tip i {
    color: var(--accent-primary);
}

/* Footer */
.paint-footer {
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-content p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Light Theme Adjustments */
body.light-theme {
    background: #f8fafc;
    color: #1a202c;
}

body.light-theme .paint-header,
body.light-theme .control-panel,
body.light-theme .canvas-wrapper,
body.light-theme .paint-footer {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .control-btn,
body.light-theme .size-btn,
body.light-theme .mode-btn,
body.light-theme .action-btn,
body.light-theme .pattern-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a202c;
}

body.light-theme .control-btn:hover,
body.light-theme .size-btn:hover,
body.light-theme .mode-btn:hover,
body.light-theme .action-btn:hover,
body.light-theme .pattern-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .paint-checkbox {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .paint-main {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .control-panel {
        width: 100%;
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .panel-section {
        margin-bottom: 0;
    }
}

@media screen and (max-width: 768px) {
    .paint-main {
        padding: 1rem;
        gap: 1rem;
    }
    
    .header-content {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .control-panel {
        grid-template-columns: 1fr;
        padding: 1rem;
        border-radius: 15px;
    }
    
    .canvas-wrapper {
        padding: 1rem;
        border-radius: 15px;
        min-height: 500px;
    }
    
    .canvas-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .paint-checkbox {
        width: 22px;
        height: 22px;
        border-radius: 3px;
    }
    
    .paint-canvas {
        gap: 3px;
        padding: 12px;
    }
    
    /* Improve touch targets for mobile */
    .size-btn,
    .mode-btn,
    .action-btn,
    .pattern-btn {
        min-height: 44px;
        font-size: 0.9rem;
    }
    
    .color-option {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }
    
    .custom-color input[type="color"] {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }
}

@media screen and (max-width: 480px) {
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .control-btn span {
        display: none;
    }
    
    .paint-main {
        padding: 0.5rem;
    }
    
    .control-panel {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .canvas-wrapper {
        padding: 0.75rem;
        min-height: 400px;
    }
    
    .paint-checkbox {
        width: 18px;
        height: 18px;
        border-radius: 2px;
    }
    
    .paint-canvas {
        gap: 2px;
        padding: 8px;
    }
    
    /* Smaller canvas for very small screens */
    .canvas-container {
        overflow-x: auto;
    }
    
    /* Improve button spacing on small screens */
    .size-controls,
    .pattern-controls {
        gap: 0.25rem;
    }
    
    .color-palette {
        gap: 0.25rem;
    }
    
    .color-option {
        width: 36px;
        height: 36px;
    }
    
    .custom-color input[type="color"] {
        width: 36px;
        height: 36px;
    }
}

/* Animation for painted checkboxes */
@keyframes paintPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.paint-checkbox.just-painted {
    animation: paintPop 0.3s ease;
}

/* Drag selection styles */
.paint-canvas.selecting {
    cursor: crosshair;
}

.paint-checkbox.drag-selected {
    background: rgba(102, 126, 234, 0.3) !important;
    border-color: var(--accent-primary) !important;
}

/* Mobile-specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .paint-checkbox:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
    
    .paint-checkbox:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Improve touch feedback */
    .paint-checkbox {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Better button touch targets */
    .size-btn,
    .mode-btn,
    .action-btn,
    .pattern-btn,
    .color-option {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* Prevent text selection during painting */
.paint-canvas {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Improve scrolling on mobile */
@media screen and (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .paint-main {
        overflow-x: hidden;
    }
    
    .canvas-wrapper {
        overflow: hidden;
    }
}