/* Architecture Progressive Disclosure Styles */
/* Enhances UX with collapsible layers and guided tour */

/* ============================================
   LAYER CARDS - Simplified View
   ============================================ */

.layer-card {
    background: var(--surface-card);
    border: 2px solid var(--surface-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.layer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.layer-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.layer-card:hover::before {
    opacity: 1;
}

.layer-card.expanded {
    border-color: var(--accent-blue);
}

.layer-card.expanded::before {
    opacity: 1;
}

/* Layer Header */
.layer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.layer-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.layer-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layer-icon ion-icon {
    font-size: 24px;
    color: white;
}

.layer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.layer-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

.layer-expand-icon {
    font-size: 24px;
    color: var(--accent-blue);
    transition: transform 0.3s ease;
}

.layer-card.expanded .layer-expand-icon {
    transform: rotate(180deg);
}

/* Layer Content - Collapsed State */
.layer-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.layer-card.expanded .layer-content {
    max-height: 1000px;
    opacity: 1;
    margin-top: 1.5rem;
}

/* Nodes in Layer */
.layer-nodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.layer-nodes .node {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.layer-nodes .node.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ============================================
   TOUR CONTROLS
   ============================================ */

.tour-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.tour-button ion-icon {
    font-size: 20px;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: inline-flex;
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: 0.75rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.view-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-mode-btn ion-icon {
    font-size: 18px;
}

.view-mode-btn.active {
    background: var(--accent-blue);
    color: white;
}

.view-mode-btn:hover:not(.active) {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

/* ============================================
   TOUR HIGHLIGHTS & ANIMATIONS
   ============================================ */

.tour-highlight {
    position: relative;
    z-index: 100;
    animation: tourPulse 1.5s infinite;
}

@keyframes tourPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7),
                    0 0 0 4px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.3),
                    0 0 0 12px rgba(16, 185, 129, 0.1);
    }
}

.tour-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-card);
    border: 2px solid var(--accent-green);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tour-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   ONBOARDING OVERLAY
   ============================================ */

.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.onboarding-overlay.visible {
    opacity: 1;
}

.onboarding-card {
    background: var(--surface-card);
    border-radius: 1.5rem;
    padding: 2.5rem;
    max-width: 500px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onboarding-overlay.visible .onboarding-card {
    transform: scale(1);
}

.onboarding-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-icon ion-icon {
    font-size: 48px;
    color: white;
}

.onboarding-card h3 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.onboarding-card > p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.onboarding-tips {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.tip {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: 0.75rem;
}

.tip ion-icon {
    font-size: 24px;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.tip span {
    color: var(--text-primary);
    font-weight: 500;
}

.onboarding-close {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-blue), #2563EB);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.onboarding-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .layer-card {
        padding: 1rem;
    }

    .layer-title {
        font-size: 1.25rem;
    }

    .layer-icon {
        width: 40px;
        height: 40px;
    }

    .layer-icon ion-icon {
        font-size: 20px;
    }

    .layer-nodes {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .tour-button {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .view-mode-toggle {
        width: 100%;
        justify-content: stretch;
    }

    .view-mode-btn {
        flex: 1;
        justify-content: center;
    }

    .onboarding-card {
        padding: 1.5rem;
    }

    .onboarding-card h3 {
        font-size: 1.5rem;
    }

    .onboarding-card > p {
        font-size: 1rem;
    }
}

/* ============================================
   TOUR PROGRESS INDICATOR
   ============================================ */

.tour-progress {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface-card);
    border-radius: 1rem;
    border: 2px solid var(--accent-green);
}

.tour-progress-bar {
    height: 8px;
    background: var(--surface-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #059669);
    transition: width 0.5s ease;
    width: 0%;
}

.tour-progress-text {
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

/* ============================================
   ARCHITECTURE INTRO
   ============================================ */

.architecture-intro {
    text-align: center;
    margin-bottom: 3rem;
}

.architecture-intro .section-title {
    margin-bottom: 1rem;
}

.architecture-intro .section-subtitle {
    max-width: 70ch;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1.125rem;
    line-height: 1.6;
}

/* ============================================
   LAYER BENEFIT TEXT
   ============================================ */

.layer-benefit {
    padding: 1rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 4px solid var(--accent-blue);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.layer-benefit strong {
    color: var(--accent-blue);
}

/* ============================================
   INTEGRATION WITH EXISTING ARCHITECTURE
   ============================================ */

/* Show layer cards by default in progressive mode */
.layer-card {
    display: block;
}

/* Adjust controls section for new buttons */
.controls-wrapper {
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .controls-wrapper {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
    }

    .tour-button,
    .view-mode-toggle {
        width: 100%;
    }
}
