/**
 * Resonance Atlas Styles
 * Interactive Flower-of-Life geometry tool
 */

/* Main Layout */
.ra-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.ra-title {
    font-size: 2rem;
    color: #f0f0f0;
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
}

.ra-sub {
    color: #a0c0ff;
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
}

.ra-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Grid Layout */
.ra-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    min-height: 600px;
}

/* Scene Area */
.ra-scene {
    position: relative;
    background: linear-gradient(135deg, rgba(6, 12, 22, 0.9), rgba(16, 24, 40, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

#raCanvas {
    width: 100%;
    height: 100%;
    display: block;
    min-height: 500px;
}

.ra-hint {
    position: absolute;
    bottom: 12px;
    left: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

/* Side Panel */
.ra-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 800px;
    overflow-y: auto;
}

/* Cards */
.ra-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.ra-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ra-card-head h3 {
    color: #e5e7eb;
    margin: 0;
    font-size: 1.1rem;
}

.ra-card-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.ra-card-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ra-card-body {
    padding: 1rem;
}

/* Data Display */
.ra-kv {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.ra-kv-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ra-kv-key {
    color: #a0c0ff;
    font-weight: 500;
}

.ra-kv-value {
    color: #e5e7eb;
    font-family: 'Courier New', monospace;
}

.ra-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.ra-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

.ra-list li:last-child {
    border-bottom: none;
}

/* Buttons */
.button {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    color: #f0f0f0;
}

.button.primary {
    background: linear-gradient(135deg, #4169e1, #6496ff);
    color: white;
    border-color: rgba(100, 150, 255, 0.4);
}

.button.primary:hover {
    background: linear-gradient(135deg, #5178f2, #75a7ff);
}

/* Special Elements */
.ra-proof-links {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ra-fallback {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.ra-fallback summary {
    color: #a0c0ff;
    cursor: pointer;
    font-weight: 500;
}

.ra-fallback pre {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #9ca3af;
    overflow-x: auto;
}

/* Canvas Containers */
#cp1canvas {
    border-radius: 4px;
    cursor: crosshair;
    /* Ensure pointer events behave consistently on touch devices */
    touch-action: none;
    user-select: none;
}

#raRot {
    width: 100% !important;
    height: 200px !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ra-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .ra-panel {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .ra-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .ra-controls {
        justify-content: center;
    }
    
    .ra-title {
        font-size: 1.5rem;
    }
    
    .button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    #raCanvas {
        min-height: 300px;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.ra-pulse {
    animation: pulse 2s infinite;
}

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(100, 150, 255, 0.3);
    }
    50% { 
        box-shadow: 0 0 20px rgba(100, 150, 255, 0.6);
    }
}

.ra-glow {
    animation: glow 3s infinite;
}

/* Help Panel */
#raHelp {
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#raHelp ul {
    font-size: 0.9rem;
}

#raHelp li {
    margin-bottom: 0.5rem;
    color: #c7d2fe;
}

/* Loading States */
.ra-loading {
    opacity: 0.5;
    pointer-events: none;
}

.ra-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #6496ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Custom Scrollbar */
.ra-panel::-webkit-scrollbar {
    width: 8px;
}

.ra-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.ra-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 150, 255, 0.3);
    border-radius: 4px;
}

.ra-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 150, 255, 0.5);
}
