/* =================================================================
   Crown Jewel Analysis - Sopra Steria Brand Colors
   ================================================================= */

/* Sopra Steria Color Palette */
:root {
    /* Primary Violet Colors */
    --violet-dark: #2A1449;
    --violet-100: #47207D;
    --violet-80: #6C4D97;
    --violet-60: #9179B1;
    --violet-40: #B5A6CB;
    --violet-20: #DAD2E5;
    --violet-15: #E3DEEC;
    --violet-10: #EDE9F2;
    --violet-light: #F2EFF6;
    
    /* Purple Colors */
    --purple-100: #8D1B82;
    --purple-80: #A24A9B;
    --purple-60: #B977B4;
    --purple-40: #D1A5CD;
    --purple-20: #E8D2E6;
    --purple-15: #EEDDEC;
    --purple-10: #F3E8F2;
    
    /* Red Colors */
    --red-100: #CF022B;
    --red-80: #D93555;
    --red-60: #E26780;
    --red-40: #EC9AAA;
    --red-20: #F5CCD5;
    --red-15: #F8D9DF;
    --red-10: #FAE6EA;
    
    /* Orange Colors */
    --orange-100: #E7D000;
    --orange-80: #F29733;
    --orange-60: #F5B166;
    --orange-40: #F9CB99;
    --orange-20: #FCE5CC;
    --orange-15: #FDECD9;
    --orange-10: #FDF2E5;
    
    /* Green Colors */
    --green-100: #95C11F;
    --green-80: #AACD4C;
    --green-60: #B7DA79;
    --green-40: #D5E6A5;
    --green-20: #EAF3D2;
    --green-15: #EFF6DD;
    --green-10: #F4F9E9;
    
    /* Blue Colors */
    --blue-100: #32ABD0;
    --blue-80: #5BBCD9;
    --blue-60: #84CDE3;
    --blue-40: #ADDDEC;
    --blue-20: #D6EEF6;
    --blue-15: #E0F2F8;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--violet-100) 0%, var(--violet-60) 25%, var(--purple-80) 75%, var(--violet-dark) 100%);
    min-height: 100vh;
    overflow-x: auto;
}

/* Import Google Fonts for compact display */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;600;700&display=swap');

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
}

.company-logo {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.company-logo:hover {
    filter: drop-shadow(0 4px 8px rgba(246, 114, 0, 0.3));
    transform: scale(1.05);
}

.title-container {
    text-align: left;
    flex: 1;
    min-width: 300px;
}

.header h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
    font-weight: 500;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(71, 32, 125, 0.3), 
                0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn.active {
    background: linear-gradient(135deg, var(--blue-100), var(--blue-80));
    color: white;
    box-shadow: 0 4px 15px rgba(50, 171, 208, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: var(--blue-60);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn.active:hover {
    background: linear-gradient(135deg, var(--blue-80), var(--blue-60));
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(50, 171, 208, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Obfuscation Toggle */
.obfuscation-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 25px;
    border: 1px solid var(--violet-40);
    backdrop-filter: blur(10px);
}

.toggle-label {
    color: white;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--violet-60);
    border-radius: 24px;
    transition: all 0.3s ease;
    border: 2px solid var(--violet-40);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--blue-100);
    border-color: var(--blue-80);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 10px rgba(50, 171, 208, 0.3);
}

/* Main content grid */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    flex: 1;
}

/* Visualization area */
.visualization-area {
    background: rgba(242, 239, 246, 0.15);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--violet-40);
    position: relative;
    min-height: 600px;
    box-shadow: inset 0 2px 20px rgba(42, 20, 73, 0.1);
}

/* Layers */
.layer {
    margin-bottom: 100px;
    display: flex;
    align-items: center;
    position: relative;
    min-height: 100px;
}

.layer:last-child {
    margin-bottom: 0;
}

.layer-title {
    width: 200px;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    cursor: text;
    padding: 12px 18px;
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    min-height: 50px;
}

.layer-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 25px;
    background: linear-gradient(135deg, 
        rgba(246, 114, 0, 0.1), 
        rgba(222, 24, 35, 0.05), 
        rgba(71, 32, 125, 0.1)
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.layer-title:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(5px);
    box-shadow: 0 4px 20px rgba(246, 114, 0, 0.1);
}

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

.layer-title[contenteditable="true"] {
    background: rgba(255,255,255,0.15);
    border-color: rgba(246, 114, 0, 0.4);
    box-shadow: 0 0 20px rgba(246, 114, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    outline: none;
}

.layer-title[contenteditable="true"]:focus {
    background: rgba(255,255,255,0.18);
    border-color: rgba(246, 114, 0, 0.6);
    box-shadow: 0 0 25px rgba(246, 114, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Setup mode indicator for editable titles */
.setup-mode .layer-title::after {
    content: "✏️";
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.7;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
}

.setup-mode .layer-title:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.nodes-container {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    flex: 1;
    justify-content: center;
    padding-left: 20px;
    align-items: center;
    z-index: 2;
    position: relative;
}

/* Nodes */
.node {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--green-100), var(--green-80));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'Roboto Condensed', 'Arial Narrow', 'Liberation Sans Narrow', sans-serif;
    font-weight: 600;
    text-align: center;
    font-size: 9px;
    line-height: 1.1;
    padding: 6px;
    word-wrap: break-word;
    hyphens: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 20, 73, 0.2);
    border: 3px solid var(--violet-20);
    position: relative;
}

.node:hover {
    transform: scale(1.05);
}

.node.degraded {
    background: linear-gradient(145deg, var(--orange-80), var(--orange-100));
    animation: pulse-orange 2s infinite;
}

.node.failed {
    background: linear-gradient(145deg, var(--red-80), var(--red-100));
    animation: pulse-red 2s infinite;
}

.node.selected {
    border-color: var(--blue-100);
    box-shadow: 0 0 20px rgba(50, 171, 208, 0.6);
}

/* Add Node Styles */
.node.add-node {
    background: linear-gradient(145deg, var(--violet-20), var(--violet-40));
    border: 2px dashed var(--violet-80);
    color: var(--violet-100);
    font-size: 2rem;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

.node.add-node:hover {
    background: linear-gradient(145deg, var(--violet-15), var(--violet-20));
    transform: scale(1.1);
    border-color: var(--violet-100);
}

/* ID Badge for real name mode */
.id-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--violet-100);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    pointer-events: none;
}

/* Responsive node sizing for longer text */
.node.show-name {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 4px;
    font-size: 7px;
    line-height: 1.0;
    font-weight: 700;
}

/* Ensure text stays within node boundaries */
.node span:not(.id-badge) {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Animations */
@keyframes pulse-orange {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(42, 20, 73, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(242, 151, 51, 0.6); }
}

@keyframes pulse-red {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(42, 20, 73, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(207, 2, 43, 0.6); }
}

/* Connection lines */
.connection-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: var(--violet-40);
    stroke-width: 2;
    fill: none;
    transition: all 0.3s ease;
}

.connection-line.degraded {
    stroke: var(--orange-80);
    stroke-width: 3;
}

.connection-line.failed {
    stroke: var(--red-80);
    stroke-width: 3;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: rgba(242, 239, 246, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--violet-40);
    color: white;
    box-shadow: 0 4px 20px rgba(42, 20, 73, 0.1);
}

.panel h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--blue-100);
    text-shadow: 0 1px 3px rgba(42, 20, 73, 0.3);
}

/* Status indicators */
.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.nominal { background: var(--green-100); }
.status-indicator.degraded { background: var(--orange-80); }
.status-indicator.failed { background: var(--red-100); }

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

/* How to Use section */
.how-to-use {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.how-to-content h4 {
    color: var(--orange-80);
    margin: 15px 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.how-to-content h4:first-child {
    margin-top: 0;
}

.how-to-content ul {
    margin: 0 0 15px 0;
    padding-left: 20px;
    list-style: none;
}

.how-to-content li {
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.4;
    position: relative;
}

.how-to-content li:before {
    content: "▸";
    color: var(--orange-100);
    position: absolute;
    left: -15px;
}

.how-to-content strong {
    color: var(--orange-100);
    font-weight: 600;
}

.impact-analysis {
    display: none;
}

.impact-analysis.active {
    display: block;
}

/* Message toast - positioned at bottom */
.message-overlay {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 1000;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Message variants for different types */
.message-overlay.success {
    border-color: rgba(149, 193, 31, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 
                0 0 20px rgba(149, 193, 31, 0.1);
}

.message-overlay.error {
    border-color: rgba(222, 24, 35, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(222, 24, 35, 0.1);
}

.message-overlay.warning {
    border-color: rgba(246, 114, 0, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(246, 114, 0, 0.1);
}

/* Animation states */
.message-overlay.show {
    display: block;
    animation: slideUpFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.message-overlay.hide {
    animation: slideDownFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUpFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideDownFadeOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(100%);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .layer-title {
        width: 120px;
        font-size: 1rem;
        padding: 10px 14px;
        min-height: 40px;
    }
    
    .setup-mode .layer-title::after {
        right: -25px;
        font-size: 0.9rem;
    }
    
    .nodes-container {
        padding-left: 10px;
    }
    
    .controls {
        justify-content: center;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 12px;
        backdrop-filter: blur(10px);
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .title-container {
        text-align: center;
        min-width: auto;
    }
    
    .company-logo {
        height: 35px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .layer {
        margin-bottom: 80px;
        min-height: 80px;
    }
}