/**
 * Court Designer Frontend Styles
 * 
 * @package Court_Designer
 * @version 1.1
 */

/* Court Designer Container */
.court-designer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Court Preview Section */
.court-preview {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Color Options Layout */
.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Individual Color Section */
.color-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

/* Color Type Headings */
.color-type h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #666;
}

/* Color Swatches */
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

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

.color-swatch.selected {
    border-color: #2271b1;
    transform: scale(1.1);
}

/* Color Grid Layout */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 10px;
    margin-top: 10 10px;
}

/* Preset Features */
.presets-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.presets-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.preset-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.preset-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.preset-list {
    margin-top: 15px;
}

.preset-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.preset-item:last-child {
    border-bottom: none;
}

.preset-name {
    flex: 1;
    font-weight: 500;
}

.preset-colors {
    display: flex;
    gap: 5px;
    margin: 0 10px;
}

.preset-color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.preset-actions {
    display: flex;
    gap: 5px;
}

/* Download Button */
.download-btn {
    display: block;
    margin: 10px auto 0;
    padding: 8px 16px;
    background-color: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: #135e96;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .color-options {
        grid-template-columns: 1fr;
    }
    
    .preset-controls {
        flex-direction: column;
    }
    
    .preset-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .preset-colors {
        margin: 10px 0;
    }
}

/* Accessibility Improvements */
.color-swatch:focus {
    outline: 2px solid #135e96;
    box-shadow: 0 0 0 1px #135e96;
}

.color-swatch:focus:not(:focus-visible) {
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-swatch:focus-visible {
    outline: 2px solid #135e96;
    box-shadow: 0 0 0 1px #135e96;
}

/* Custom Tooltip for Color Swatches */
.color-swatch {
    position: relative;
}

.color-swatch::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -34px; /* Adjusted for better spacing */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease, visibility 0.1s ease;
    z-index: 1000; /* Higher z-index for visibility */
}

.color-swatch:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s; /* Instant display */
}

.color-swatch::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease, visibility 0.1s ease;
    z-index: 1000;
}

.color-swatch:hover::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s; /* Instant display */
}