/* CSS Background Generator Styles */

/* Custom range slider styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* Background type buttons */
.type-btn {
    display: flex;
    items-center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.type-btn:hover {
    border-color: #3b82f6;
    color: #2563eb;
    transform: translateY(-1px);
}

.type-btn.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-color: transparent;
}

.type-btn svg {
    flex-shrink: 0;
}

/* Preset buttons */
.preset-btn {
    padding: 8px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preset-btn:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.preset-btn.active {
    border-color: #3b82f6;
    border-width: 3px;
}

.preset-preview {
    width: 100%;
    height: 30px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.preset-name {
    font-size: 10px;
    font-weight: 500;
    color: #374151;
    line-height: 1.2;
}

/* Color controls */
.color-control {
    display: flex;
    items-center;
    gap: 8px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.color-input {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-family: monospace;
}

.remove-color-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.remove-color-btn:hover {
    background: #dc2626;
}

/* Position buttons */
.position-btn {
    padding: 6px 4px;
    background: white;
    border: 1px solid #d1d5db;
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.position-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.position-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.position-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.position-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Preview container backgrounds */
.preview-bg-white {
    background: white !important;
}

.preview-bg-dark {
    background: #1f2937 !important;
}

.preview-bg-light {
    background: #f3f4f6 !important;
}

/* Preview element */
#previewElement {
    transition: all 0.3s ease;
    will-change: background;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Code output styling */
pre {
    font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    line-height: 1.5;
}

/* Syntax highlighting for CSS */
.css-property {
    color: #93c5fd;
}

.css-value {
    color: #86efac;
}

.css-selector {
    color: #fbbf24;
}

.css-comment {
    color: #6b7280;
    font-style: italic;
}

.css-rule {
    color: #f3f4f6;
}

/* Performance indicators */
.performance-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.performance-indicator.high {
    background: #fef2f2;
    color: #dc2626;
}

.performance-indicator.medium {
    background: #fffbeb;
    color: #d97706;
}

.performance-indicator.low {
    background: #f0fdf4;
    color: #16a34a;
}

/* Background option buttons */
.bg-option {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.bg-option:hover {
    transform: scale(1.1);
}

.bg-option.active {
    border-color: #3b82f6 !important;
    border-width: 3px;
}

/* Copy feedback */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

/* Fullscreen modal */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.fullscreen-modal.active {
    opacity: 1;
    visibility: visible;
}

.fullscreen-content {
    width: 90%;
    height: 90%;
    background: white;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.fullscreen-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.fullscreen-preview {
    flex: 1;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.close-fullscreen {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-fullscreen:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Responsive preview sizes */
.preview-mobile {
    max-width: 375px;
    margin: 0 auto;
}

.preview-tablet {
    max-width: 768px;
    margin: 0 auto;
}

.preview-desktop {
    max-width: 1200px;
    margin: 0 auto;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Enhanced hover effects */
.preset-btn,
.type-btn,
.position-btn,
button {
    position: relative;
    overflow: hidden;
}

.preset-btn::before,
.type-btn::before,
.position-btn::before,
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: 1;
}

.preset-btn:active::before,
.type-btn:active::before,
.position-btn:active::before,
button:active::before {
    width: 200px;
    height: 200px;
}

/* Accessibility improvements */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Error states */
.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

.error-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
}

/* Success states */
.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4;
}

.success-message {
    color: #059669;
    font-size: 12px;
    margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .xl\:col-span-1,
    .xl\:col-span-3 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .preset-btn {
        min-height: 50px;
    }
    
    .preset-name {
        font-size: 9px;
    }
    
    .type-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .color-control {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .position-btn {
        padding: 8px 6px;
    }
    
    pre {
        font-size: 12px;
    }
}

/* Custom scrollbar for code blocks */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Pattern preview animations */
@keyframes patternShift {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

.preview-element.pattern-animated {
    animation: patternShift 4s linear infinite;
}

/* Gradient animation */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.preview-element.gradient-animated {
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

/* Color palette generation indicator */
.palette-generating {
    position: relative;
}

.palette-generating::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.tooltip:hover::before {
    opacity: 1;
}