/* Constitutional Network Theatre - Organisational Network Styling */
/* Genesis v13.7.2 - Follow the Policy Through Living Organisations */

:root {
    --bg-deep: #030810;
    --bg-dark: #0a1525;
    --bg-org: #0f1d30;
    --bg-dept: #152540;
    --text-primary: #e8f0f8;
    --text-secondary: #8ba3c0;
    --text-muted: #5a7090;
    
    --glow-cyan: rgba(6, 182, 212, 0.6);
    --glow-green: rgba(34, 197, 94, 0.6);
    --glow-orange: rgba(245, 158, 11, 0.6);
    --glow-purple: rgba(139, 92, 246, 0.6);
    --glow-blue: rgba(59, 130, 246, 0.6);
    
    --accent-cyan: #06b6d4;
    --accent-green: #22c55e;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    
    --nl-orange: #ff6600;
    --eu-blue: #003399;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(10, 21, 37, 0.95);
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s;
}
.back-link:hover { color: var(--text-primary); }

.header-title { text-align: center; }
.header-title h1 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}
.header-title .subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stage-display { text-align: right; }
.stage-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
}
.stage-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

/* Controls Bar */
.controls-bar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    padding: 0.75rem 1.5rem;
    background: rgba(10, 21, 37, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 90;
}

.follow-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border: none;
    border-radius: 25px;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px var(--glow-cyan);
}
.follow-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--glow-cyan);
}
.follow-btn.active {
    background: var(--accent-orange);
    box-shadow: 0 0 20px var(--glow-orange);
}
.follow-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.follow-icon { font-size: 1.1rem; }

.journey-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.journey-track {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.journey-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
    border-radius: 2px;
    transition: width 0.5s ease;
}

.journey-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 120px;
}

.reset-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}
.reset-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

/* Main Network Container */
.network-container {
    position: fixed;
    top: 110px;
    left: 0;
    right: 0;
    bottom: 60px;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(6, 182, 212, 0.03) 0%, transparent 70%);
}

.connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* The Notification - travels in middle zone between orgs and citizen */
.notification {
    position: absolute;
    bottom: 35%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(249, 115, 22, 0.2));
    border: 2px solid var(--accent-orange);
    border-radius: 10px;
    z-index: 100;
    opacity: 0;
    transition: all 0.8s ease-in-out;
}
.notification.visible { opacity: 1; }
.notification.travelling {
    transition: all 1s ease-in-out;
}

.notification-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-orange), transparent);
    animation: notificationPulse 2s ease-in-out infinite;
    opacity: 0;
}
.notification.visible .notification-glow { opacity: 1; }

@keyframes notificationPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.notification-icon { font-size: 1.5rem; }
.notification-label {
    font-size: 0.7rem;
    color: var(--accent-orange);
    margin-top: 0.25rem;
}

/* Organisations */
.organisation {
    position: absolute;
    background: var(--bg-org);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: all 0.5s;
    z-index: 10;
}
.organisation.active {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 40px var(--glow-cyan);
}
.organisation.highlight {
    z-index: 20;
    transform: scale(1.02);
}

.org-header {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.org-flag { font-size: 1rem; }
.org-name {
    font-size: 0.8rem;
    font-weight: 600;
    flex: 1;
}
.org-type {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.org-body {
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Departments */
.dept {
    background: var(--bg-dept);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 80px;
    transition: all 0.4s;
    border: 1px solid transparent;
}
.dept.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 15px var(--glow-green);
}

.dept-icon { font-size: 1rem; display: block; text-align: center; }
.dept-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    display: block;
    text-align: center;
    margin-top: 0.2rem;
}

.hybrids {
    display: flex;
    justify-content: center;
    gap: 0.2rem;
    margin-top: 0.4rem;
}

.hybrid {
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.3s;
    cursor: default;
}
.hybrid.active {
    opacity: 1;
    animation: hybridPulse 1s ease-in-out infinite;
}

@keyframes hybridPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Organisation Memory */
.org-memory {
    width: 100%;
    padding: 0.4rem;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    transition: all 0.5s;
}
.org-memory.active {
    background: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 15px var(--glow-cyan);
}
.org-memory.federation {
    background: rgba(0, 51, 153, 0.2);
}

.memory-icon { font-size: 0.8rem; }
.memory-label {
    font-size: 0.55rem;
    color: var(--accent-cyan);
}

/* European Partners */
.partner {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-dept);
    border-radius: 6px;
    transition: all 0.4s;
    border: 1px solid transparent;
}
.partner.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--glow-blue);
}

.partner-flag { font-size: 0.9rem; }
.partner-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
}
.partner-saicos {
    font-size: 0.7rem;
    opacity: 0.4;
    transition: all 0.3s;
}
.partner.active .partner-saicos {
    opacity: 1;
    animation: hybridPulse 1s ease-in-out infinite;
}

/* Internal Conversations within Departments */
.internal-conv {
    display: none;
    margin-top: 0.4rem;
    padding: 0.3rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    border-left: 2px solid var(--accent-purple);
    font-size: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    animation: convAppear 0.4s ease;
}
.internal-conv.visible {
    display: block;
}

@keyframes convAppear {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 60px; }
}

.internal-conv .conv-bubble {
    margin-bottom: 0.2rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    animation: bubbleSlide 0.3s ease;
}
.internal-conv .conv-bubble.human-bubble {
    background: rgba(34, 197, 94, 0.15);
}
.internal-conv .conv-bubble.saicos-bubble {
    background: rgba(6, 182, 212, 0.15);
}
.internal-conv .conv-bubble .speaker {
    font-weight: 600;
    font-size: 0.45rem;
}
.internal-conv .conv-bubble.human-bubble .speaker { color: var(--accent-green); }
.internal-conv .conv-bubble.saicos-bubble .speaker { color: var(--accent-cyan); }

@keyframes bubbleSlide {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

/* SAICOS Communication Channel within Organisation */
.saicos-channel {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.3rem 0.5rem;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 6px;
    border: 1px dashed rgba(6, 182, 212, 0.3);
    font-size: 0.5rem;
    color: var(--accent-cyan);
    animation: channelPulse 2s ease-in-out infinite;
}
.saicos-channel.visible {
    display: block;
}
.saicos-channel.federation {
    background: linear-gradient(90deg, rgba(0, 51, 153, 0.15), rgba(6, 182, 212, 0.1));
    border-color: rgba(0, 51, 153, 0.4);
}

@keyframes channelPulse {
    0%, 100% { border-color: rgba(6, 182, 212, 0.3); }
    50% { border-color: rgba(6, 182, 212, 0.7); }
}

.saicos-channel .channel-msg {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.15rem;
}
.saicos-channel .channel-msg:last-child { margin-bottom: 0; }
.saicos-channel .channel-icon { font-size: 0.6rem; }
.saicos-channel .channel-text { flex: 1; }

/* Inter-Organisation SAICOS Communication - always visible */
.inter-saicos-channel {
    position: absolute;
    display: block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    font-size: 0.5rem;
    color: var(--accent-purple);
    z-index: 30;
}
.inter-saicos-channel.active {
    animation: interChannelGlow 1.5s ease-in-out infinite;
}

@keyframes interChannelGlow {
    0%, 100% { box-shadow: 0 0 5px var(--glow-purple); }
    50% { box-shadow: 0 0 15px var(--glow-purple), 0 0 25px var(--glow-cyan); }
}

/* Between Ministry (left) and Rotterdam (center-left) */
#inter-saicos-ministry-rotterdam {
    top: 2%;
    left: 12%;
}
/* Between Rotterdam (center-left) and Province (center-right) */
#inter-saicos-rotterdam-province {
    top: 2%;
    left: 50%;
    transform: translateX(-50%);
}
/* Between Province (center-right) and European (right) */
#inter-saicos-province-european {
    top: 2%;
    right: 12%;
}

.inter-saicos-channel .inter-label {
    font-weight: 600;
    font-size: 0.55rem;
    color: var(--accent-cyan);
    white-space: nowrap;
}
.inter-saicos-channel .inter-status {
    font-size: 0.5rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* In-Organisation Conversation Feed */
.org-conv-feed {
    display: none;
    width: 100%;
    max-height: 120px;
    overflow-y: auto;
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.org-conv-feed.visible {
    display: block;
}

.org-conv-feed .org-conv-msg {
    padding: 0.3rem 0.4rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    font-size: 0.55rem;
    line-height: 1.4;
    animation: orgMsgSlide 0.3s ease;
}

@keyframes orgMsgSlide {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

.org-conv-feed .org-conv-msg.human {
    background: rgba(34, 197, 94, 0.15);
    border-left: 2px solid var(--accent-green);
}
.org-conv-feed .org-conv-msg.genesis {
    background: rgba(6, 182, 212, 0.15);
    border-left: 2px solid var(--accent-cyan);
}
.org-conv-feed .org-conv-msg.org {
    background: rgba(139, 92, 246, 0.15);
    border-left: 2px solid var(--accent-purple);
}
.org-conv-feed .org-conv-msg.system {
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.org-conv-feed .org-conv-sender {
    font-weight: 600;
    font-size: 0.5rem;
    display: block;
    margin-bottom: 0.1rem;
}
.org-conv-feed .org-conv-msg.human .org-conv-sender { color: var(--accent-green); }
.org-conv-feed .org-conv-msg.genesis .org-conv-sender { color: var(--accent-cyan); }
.org-conv-feed .org-conv-msg.org .org-conv-sender { color: var(--accent-purple); }

/* Organisation Positions - Horizontal row with Citizen below center */
.ministry {
    top: 8%;
    left: 1%;
    width: 220px;
}

.rotterdam {
    top: 8%;
    left: 24%;
    width: 260px;
}

.province {
    top: 8%;
    right: 24%;
    width: 220px;
}

.european {
    top: 8%;
    right: 1%;
    width: 220px;
}

/* The Citizen - Centered below the organisation row, above narration bar */
.citizen-node {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.1));
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 16px;
    z-index: 25;
    transition: all 0.5s;
}
.citizen-node.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 30px var(--glow-green);
}
.citizen-node.resolved {
    border-color: var(--accent-green);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.2));
}

.citizen-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-green), transparent);
    opacity: 0;
    transition: opacity 0.5s;
}
.citizen-node.resolved .citizen-glow {
    opacity: 0.5;
    animation: citizenGlow 2s ease-in-out infinite;
}

@keyframes citizenGlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.citizen-icon { font-size: 2rem; }
.citizen-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.citizen-status {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
    max-width: 120px;
}
.citizen-node.resolved .citizen-status {
    color: var(--accent-green);
}

/* Conversation Panel - REMOVED, conversations now inside organisations */

/* Narration Bar */
.narration-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 0.4rem;
    background: rgba(10, 21, 37, 0.98);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    z-index: 100;
}

.narration-content {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: rgba(6, 182, 212, 0.08);
    border-radius: 6px;
}

.narration-stage { font-size: 1rem; }
.narration-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Responsive */
@media (max-width: 1400px) {
    .organisation { transform: scale(0.9); }
    .ministry { width: 200px; left: 0.5%; }
    .rotterdam { width: 240px; left: 22%; }
    .province { width: 200px; right: 22%; }
    .european { width: 200px; right: 0.5%; }
}

@media (max-width: 1100px) {
    .organisation { transform: scale(0.8); }
    .ministry { width: 180px; left: 0.5%; }
    .rotterdam { width: 220px; left: 20%; }
    .province { width: 180px; right: 20%; }
    .european { width: 180px; right: 0.5%; }
    .org-conv-feed { max-height: 80px; }
}

@media (max-width: 900px) {
    .organisation { transform: scale(0.7); }
    .ministry { width: 160px; }
    .rotterdam { width: 200px; left: 18%; }
    .province { width: 160px; right: 18%; }
    .european { width: 160px; }
    .citizen-node { padding: 0.75rem 1rem; bottom: 8%; }
    .citizen-icon { font-size: 1.5rem; }
}
