/**
 * Frontend Styles for 3D Shade Configurator
 */

/* Main Wrapper */
.shade-configurator-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Layout */
.shade-configurator-wrapper {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

/* Controls Panel */
.shade-controls-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.shade-control-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.shade-control-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.shade-control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 12px;
}

.shade-control-label .dashicons {
    color: #2271b1;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Select Dropdown */
.shade-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.shade-select:hover {
    border-color: #2271b1;
}

.shade-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

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

.shade-color-option {
    aspect-ratio: 1;
    border: 3px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    padding: 0;
    background: #fff;
}

.shade-color-option:hover {
    transform: scale(1.05);
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.shade-color-option.active {
    border-color: #2271b1;
    border-width: 4px;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}

.shade-color-option::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    opacity: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: opacity 0.3s;
}

.shade-color-option.active::after {
    opacity: 1;
}

.shade-color-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px;
    font-size: 10px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.shade-color-option:hover .shade-color-name {
    opacity: 1;
}

/* Selected Color Display */
.shade-selected-color {
    padding: 10px 15px;
    background: #f6f7f7;
    border-radius: 6px;
    font-size: 14px;
}

.shade-selected-color strong {
    color: #1d2327;
}

.shade-selected-color span {
    color: #2271b1;
    font-weight: 500;
}

/* Action Buttons */
.shade-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.shade-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.shade-btn-primary {
    background: #2271b1;
    color: #fff;
}

.shade-btn-primary:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.shade-btn-secondary {
    background: #f6f7f7;
    color: #1d2327;
    border: 2px solid #ddd;
}

.shade-btn-secondary:hover {
    background: #fff;
    border-color: #2271b1;
    color: #2271b1;
}

.shade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Viewer Container */
.shade-viewer-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

.shade-3d-viewer {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.shade-3d-viewer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.shade-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.shade-loading-overlay.hidden {
    display: none;
}

.shade-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shade-loading-overlay p {
    margin-top: 15px;
    color: #646970;
    font-size: 14px;
}

/* Instructions */
.shade-instructions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f7f7 0%, #e8e9ea 100%);
    z-index: 5;
}

.shade-instructions.hidden {
    display: none;
}

.shade-instructions-content {
    text-align: center;
    padding: 40px;
}

.shade-instructions-content .dashicons {
    font-size: 80px;
    width: 80px;
    height: 80px;
    color: #c3c4c7;
    margin-bottom: 20px;
}

.shade-instructions-content h3 {
    color: #1d2327;
    margin: 0 0 10px;
    font-size: 24px;
}

.shade-instructions-content p {
    color: #646970;
    margin: 0;
    font-size: 16px;
}

/* Viewer Help */
.shade-viewer-help {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 20;
}

.shade-help-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 2px solid #2271b1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.shade-help-toggle:hover {
    background: #2271b1;
    transform: scale(1.1);
}

.shade-help-toggle .dashicons {
    color: #2271b1;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.shade-help-toggle:hover .dashicons {
    color: #fff;
}

.shade-help-content {
    position: absolute;
    bottom: 50px;
    right: 0;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 20px;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    backdrop-filter: blur(10px);
}

.shade-help-toggle:hover + .shade-help-content,
.shade-help-content:hover {
    display: block;
}

.shade-help-content h4 {
    margin: 0 0 10px;
    color: #1d2327;
    font-size: 14px;
}

.shade-help-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.shade-help-content li {
    margin-bottom: 8px;
    font-size: 13px;
    color: #646970;
}

.shade-help-content li:last-child {
    margin-bottom: 0;
}

/* Modal Styles */
.shade-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.shade-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shade-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.shade-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #646970;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.shade-modal-close:hover {
    color: #d63638;
}

.shade-modal-content h2 {
    margin: 0 0 15px;
    color: #1d2327;
    font-size: 24px;
}

.shade-modal-content p {
    color: #646970;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Share Link Container */
.shade-share-link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.shade-share-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #f6f7f7;
}

.shade-share-input:focus {
    outline: none;
    border-color: #2271b1;
    background: #fff;
}

.shade-share-actions {
    text-align: center;
}

/* Error Message */
.shade-configurator-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .shade-configurator-wrapper {
        grid-template-columns: 1fr;
    }
    
    .shade-controls-panel {
        order: 2;
    }
    
    .shade-viewer-container {
        order: 1;
    }
}

@media screen and (max-width: 768px) {
    .shade-configurator-wrapper {
        padding: 15px;
        gap: 20px;
    }
    
    .shade-controls-panel {
        padding: 20px;
    }
    
    .shade-color-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }
    
    .shade-3d-viewer {
        height: 400px !important;
    }
    
    .shade-actions {
        flex-direction: column;
    }
    
    .shade-btn {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .shade-color-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .shade-3d-viewer {
        height: 300px !important;
    }
    
    .shade-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .shade-share-link-container {
        flex-direction: column;
    }
}

/* Loading States */
.shade-btn.loading {
    position: relative;
    color: transparent;
}

.shade-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Tooltips */
.shade-tooltip {
    position: relative;
    display: inline-block;
}

.shade-tooltip .shade-tooltiptext {
    visibility: hidden;
    background-color: rgba(0,0,0,0.9);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    white-space: nowrap;
}

.shade-tooltip:hover .shade-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Success Message */
.shade-success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shade-success-message .dashicons {
    color: #155724;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Progress Indicator */
.shade-progress {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0;
}

.shade-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #135e96);
    transition: width 0.3s;
}

/* Viewer Stats */
.shade-viewer-stats {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255,255,255,0.9);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    color: #646970;
    z-index: 15;
    backdrop-filter: blur(10px);
}

.shade-viewer-stats div {
    margin-bottom: 5px;
}

.shade-viewer-stats div:last-child {
    margin-bottom: 0;
}

/* Accessibility */
.shade-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
.shade-color-option:focus,
.shade-select:focus,
.shade-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .shade-controls-panel,
    .shade-viewer-help,
    .shade-actions {
        display: none;
    }
    
    .shade-configurator-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .shade-controls-panel {
        background: #1d2327;
        border-color: #3c434a;
    }
    
    .shade-control-label {
        color: #f0f0f1;
    }
    
    .shade-select {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .shade-selected-color {
        background: #2c3338;
        color: #f0f0f1;
    }
    
    .shade-btn-secondary {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s;
}

.slide-in {
    animation: slideIn 0.5s;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
