/* Material Design Color Picker for denis256.dev */

/* Floating Action Button (FAB) */
.color-picker-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--text-white);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-picker-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.color-picker-fab:active {
    transform: scale(1.05);
}

.color-picker-fab svg {
    width: 24px;
    height: 24px;
}

/* Color Picker Panel */
.color-picker-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-top: 2px solid var(--border-primary);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    padding: 24px;
    z-index: 1000;
    transition: bottom 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.color-picker-panel.active {
    bottom: 0;
}

/* Panel Header */
.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.color-picker-header h3 {
    margin: 0;
    padding: 0;
    font-family: Museo500, sans-serif;
    font-size: 20px;
    color: var(--text-primary);
}

.color-picker-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0;
}

.color-picker-close:hover {
    color: var(--accent-primary);
}

/* Color Swatches Container */
.color-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    max-width: 500px;
}

/* Individual Color Swatch */
.color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch:active {
    transform: scale(1.05);
}

.color-swatch:focus {
    outline: 2px solid var(--text-white);
    outline-offset: 2px;
}

.color-swatch.selected {
    border-color: var(--text-white);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* Reset Button */
.color-reset-btn {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: Museo300, sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.color-reset-btn:hover {
    background: var(--accent-primary);
    color: var(--text-white);
    border-color: var(--accent-primary);
}

/* Backdrop Overlay */
.color-picker-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-picker-backdrop.active {
    display: block;
    opacity: 1;
}

/* Mobile Responsive Styles */
@media only screen and (max-width: 768px) {
    .color-picker-fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .color-picker-fab svg {
        width: 20px;
        height: 20px;
    }

    .color-picker-panel {
        padding: 20px 16px;
    }

    .color-swatches {
        gap: 12px;
        max-width: 100%;
    }

    .color-swatch {
        width: 44px;
        height: 44px;
    }

    body {
        padding-bottom: 80px; /* Space for FAB */
    }
}

@media only screen and (max-width: 480px) {
    .color-picker-panel {
        padding: 16px;
    }

    .color-swatches {
        grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
        gap: 10px;
    }

    .color-picker-header h3 {
        font-size: 18px;
    }

    .color-reset-btn {
        width: 100%;
    }
}

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .color-picker-fab,
    .color-picker-panel,
    .color-swatch,
    .color-picker-backdrop {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .color-picker-fab {
        border: 2px solid currentColor;
    }

    .color-swatch {
        border: 2px solid currentColor;
    }

    .color-swatch.selected {
        border-width: 4px;
    }
}
