/**
 * Theme Switcher UI Styles
 *
 * Styles for the theme selection modal and switcher button.
 * Works with all themes and provides accessible interface.
 *
 * @package YAWC
 * @version 1.0.0
 */

/* ============================================
   THEME SWITCHER BUTTON
   ============================================ */
.yawc-theme-switcher-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--theme-gradient-primary);
    color: var(--theme-text-inverse);
    border: none;
    cursor: pointer;
    box-shadow: var(--theme-shadow-lg);
    transition: all var(--theme-transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.yawc-theme-switcher-btn:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: var(--theme-shadow-xl);
}

.yawc-theme-switcher-btn:active {
    transform: scale(0.95);
}

.yawc-theme-switcher-btn svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .yawc-theme-switcher-btn {
        width: 50px;
        height: 50px;
        bottom: 1rem;
        right: 1rem;
    }

    .yawc-theme-switcher-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   THEME MODAL
   ============================================ */
.yawc-theme-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--theme-transition-base),
                visibility var(--theme-transition-base);
}

.yawc-theme-modal.is-open {
    opacity: 1;
    visibility: visible;
}

/* Modal backdrop */
.yawc-theme-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--theme-bg-overlay);
    backdrop-filter: blur(8px);
}

/* Modal content */
.yawc-theme-modal-content {
    position: relative;
    background-color: var(--theme-bg-primary);
    border-radius: var(--theme-radius-xl);
    box-shadow: var(--theme-shadow-2xl);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    border: 2px solid var(--theme-border-primary);
    transform: scale(0.9);
    transition: transform var(--theme-transition-base);
}

.yawc-theme-modal.is-open .yawc-theme-modal-content {
    transform: scale(1);
}

/* Modal header */
.yawc-theme-modal-header {
    padding: var(--theme-spacing-xl);
    border-bottom: 2px solid var(--theme-border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--theme-gradient-primary);
    color: var(--theme-text-inverse);
}

.yawc-theme-modal-header h2 {
    margin: 0;
    font-size: var(--theme-font-size-2xl);
    font-weight: var(--theme-font-weight-bold);
    color: var(--theme-text-inverse);
}

.yawc-theme-modal-close {
    background: transparent;
    border: none;
    color: var(--theme-text-inverse);
    cursor: pointer;
    padding: var(--theme-spacing-sm);
    border-radius: var(--theme-radius-md);
    transition: all var(--theme-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.yawc-theme-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Modal body */
.yawc-theme-modal-body {
    padding: var(--theme-spacing-xl);
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* ============================================
   THEME GRID
   ============================================ */
.yawc-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--theme-spacing-lg);
}

@media (max-width: 768px) {
    .yawc-theme-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   THEME CARDS
   ============================================ */
.yawc-theme-card {
    background-color: var(--theme-bg-secondary);
    border: 2px solid var(--theme-border-primary);
    border-radius: var(--theme-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--theme-transition-base);
    outline: none;
}

.yawc-theme-card:hover,
.yawc-theme-card:focus {
    transform: translateY(-4px);
    box-shadow: var(--theme-shadow-lg);
    border-color: var(--theme-primary);
}

/* Theme preview area */
.yawc-theme-card-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.yawc-theme-card-icon {
    font-size: 3rem;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Preview backgrounds */
.yawc-theme-preview-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.yawc-theme-preview-green {
    background: linear-gradient(135deg, #000000 0%, #001a00 100%);
    position: relative;
}

.yawc-theme-preview-green::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(0, 255, 0, 0.1) 0px, transparent 1px, transparent 2px, rgba(0, 255, 0, 0.1) 3px);
}

.yawc-theme-preview-gold {
    background: linear-gradient(135deg, #fdfbf7 0%, #f0ede3 100%);
}

.yawc-theme-preview-gold::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
}

.yawc-theme-preview-pink {
    background: linear-gradient(135deg, #e8b4b8 0%, #f5cdd1 50%, #a8d8ea 100%);
}

.yawc-theme-preview-neon {
    background: linear-gradient(135deg, #1a0033 0%, #3d0066 100%);
    position: relative;
}

.yawc-theme-preview-neon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 16, 240, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 16, 240, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Theme card content */
.yawc-theme-card-content {
    padding: var(--theme-spacing-lg);
}

.yawc-theme-card-title {
    margin: 0 0 var(--theme-spacing-sm) 0;
    font-size: var(--theme-font-size-lg);
    font-weight: var(--theme-font-weight-bold);
    color: var(--theme-text-primary);
}

.yawc-theme-card-description {
    margin: 0 0 var(--theme-spacing-md) 0;
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-secondary);
    line-height: 1.5;
}

.yawc-theme-card-badge {
    display: inline-block;
    padding: var(--theme-spacing-xs) var(--theme-spacing-md);
    border-radius: var(--theme-radius-full);
    font-size: var(--theme-font-size-xs);
    font-weight: var(--theme-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--theme-bg-tertiary);
    color: var(--theme-text-secondary);
    border: 1px solid var(--theme-border-primary);
    transition: all var(--theme-transition-fast);
}

.yawc-theme-card-badge.is-active {
    background: var(--theme-gradient-primary);
    color: var(--theme-text-inverse);
    border-color: transparent;
}

/* ============================================
   THEME-SPECIFIC ADJUSTMENTS
   ============================================ */

/* Geek theme */
[data-theme="geek"] .yawc-theme-modal-header {
    background: #000000;
    border-color: var(--theme-primary);
    text-shadow: var(--theme-glow);
}

[data-theme="geek"] .yawc-theme-switcher-btn {
    background: transparent;
    border: 2px solid var(--theme-primary);
    box-shadow: var(--theme-shadow-md);
}

[data-theme="geek"] .yawc-theme-card {
    border-color: var(--theme-border-primary);
}

[data-theme="geek"] .yawc-theme-card:hover,
[data-theme="geek"] .yawc-theme-card:focus {
    box-shadow: var(--theme-shadow-lg);
}

/* Classy theme */
[data-theme="classy"] .yawc-theme-modal-header {
    background: var(--theme-gradient-primary);
}

[data-theme="classy"] .yawc-theme-card {
    border: 1px solid var(--theme-border-primary);
}

[data-theme="classy"] .yawc-theme-card:hover,
[data-theme="classy"] .yawc-theme-card:focus {
    border-color: var(--theme-secondary);
}

/* Elegant theme */
[data-theme="elegant"] .yawc-theme-modal-content {
    border-radius: var(--theme-radius-xl);
}

[data-theme="elegant"] .yawc-theme-card {
    border-radius: var(--theme-radius-lg);
}

[data-theme="elegant"] .yawc-theme-switcher-btn {
    box-shadow: var(--theme-shadow-xl);
}

/* 80's theme */
[data-theme="80s"] .yawc-theme-modal-backdrop {
    backdrop-filter: blur(10px);
}

[data-theme="80s"] .yawc-theme-modal-header {
    background: var(--theme-gradient-primary);
    border-color: var(--theme-primary);
    text-shadow: var(--theme-glow);
    box-shadow: 0 5px 20px rgba(255, 16, 240, 0.5);
}

[data-theme="80s"] .yawc-theme-switcher-btn {
    box-shadow: var(--theme-shadow-xl);
    text-shadow: var(--theme-glow);
}

[data-theme="80s"] .yawc-theme-card {
    border: 2px solid var(--theme-border-primary);
    background: rgba(26, 0, 51, 0.5);
}

[data-theme="80s"] .yawc-theme-card:hover,
[data-theme="80s"] .yawc-theme-card:focus {
    border-color: var(--theme-primary);
    box-shadow: var(--theme-shadow-2xl);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible for keyboard navigation */
.yawc-theme-card:focus-visible {
    outline: 3px solid var(--theme-primary);
    outline-offset: 2px;
}

.yawc-theme-modal-close:focus-visible {
    outline: 2px solid var(--theme-text-inverse);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .yawc-theme-modal,
    .yawc-theme-modal-content,
    .yawc-theme-switcher-btn,
    .yawc-theme-card {
        transition: none;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes theme-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.yawc-theme-modal.is-open .yawc-theme-card {
    animation: theme-fade-in 0.3s ease-out backwards;
}

.yawc-theme-modal.is-open .yawc-theme-card:nth-child(1) { animation-delay: 0.05s; }
.yawc-theme-modal.is-open .yawc-theme-card:nth-child(2) { animation-delay: 0.1s; }
.yawc-theme-modal.is-open .yawc-theme-card:nth-child(3) { animation-delay: 0.15s; }
.yawc-theme-modal.is-open .yawc-theme-card:nth-child(4) { animation-delay: 0.2s; }
.yawc-theme-modal.is-open .yawc-theme-card:nth-child(5) { animation-delay: 0.25s; }
