/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00f3ff;
    --primary-dark: #00d9ff;
    --secondary-color: #ff006e;
    --accent-color: #d946ef;
    --bg-color: #0a0a0f;
    --surface-color: #1a1a2e;
    --text-primary: #e0e0ff;
    --text-secondary: #8892b0;
    --border-color: #2a2a4e;
    --neon-cyan: #00f3ff;
    --neon-magenta: #ff006e;
    --neon-purple: #d946ef;
    --shadow-sm: 0 0 5px rgba(0, 243, 255, 0.3);
    --shadow-md: 0 0 10px rgba(0, 243, 255, 0.4), 0 0 20px rgba(0, 243, 255, 0.2);
    --shadow-lg: 0 0 15px rgba(0, 243, 255, 0.5), 0 0 30px rgba(0, 243, 255, 0.3);
    --shadow-magenta: 0 0 15px rgba(255, 0, 110, 0.5), 0 0 30px rgba(255, 0, 110, 0.3);
    --border-radius: 4px;
    --border-radius-lg: 8px;
}

body {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a0a1f 50%, #0a0a0f 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 243, 255, 0.03) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 243, 255, 0.03) 3px
    );
    pointer-events: none;
    z-index: 1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(0, 243, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(255, 0, 110, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: rgba(26, 26, 46, 0.9);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--neon-cyan);
    box-shadow: var(--shadow-lg),
                inset 0 0 20px rgba(0, 243, 255, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8),
                 0 0 20px rgba(0, 243, 255, 0.5),
                 0 0 30px rgba(0, 243, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--neon-magenta);
    font-weight: 400;
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.6);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.input-section {
    background: rgba(26, 26, 46, 0.7);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--neon-cyan);
    box-shadow: var(--shadow-md),
                inset 0 0 20px rgba(0, 243, 255, 0.05);
    backdrop-filter: blur(10px);
}

.input-section h2 {
    font-size: 1.75rem;
    margin-bottom: 25px;
    color: var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan);
    padding-bottom: 12px;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.input-group {
    margin-bottom: 20px;
    padding: 22px;
    background: rgba(10, 10, 15, 0.6);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.input-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.05) 0%, rgba(255, 0, 110, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.input-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    border-color: var(--neon-cyan);
}

.input-group:hover::before {
    opacity: 1;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group h3 {
    font-size: 1.25rem;
    margin-bottom: 18px;
    color: var(--neon-magenta);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--neon-magenta);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 0, 110, 0.8);
}

.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.input-row:last-child {
    margin-bottom: 0;
}

.input-row label {
    flex: 0 0 200px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.input-row input[type="number"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
    background: rgba(10, 10, 15, 0.8);
    color: var(--neon-cyan);
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.1);
}

.input-row input[type="number"]:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5),
                inset 0 0 15px rgba(0, 243, 255, 0.2);
    color: #ffffff;
}

.input-row input[type="number"]:read-only {
    background: rgba(42, 42, 78, 0.5);
    cursor: not-allowed;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.input-row input[type="number"]:hover:not(:read-only) {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.input-row select {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
    background: rgba(10, 10, 15, 0.8);
    color: var(--neon-cyan);
    cursor: pointer;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.1);
}

.input-row select:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5),
                inset 0 0 15px rgba(0, 243, 255, 0.2);
}

.input-row select:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.readonly-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    text-shadow: 0 0 5px rgba(136, 146, 176, 0.3);
}

.help-text {
    font-size: 0.80rem;
    color: var(--neon-purple);
    font-style: italic;
    font-weight: 500;
    text-shadow: 0 0 5px rgba(217, 70, 239, 0.5);
}

/* Output Section */
.output-section {
    background: rgba(26, 26, 46, 0.7);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--neon-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.3),
                inset 0 0 20px rgba(255, 0, 110, 0.05);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    position: sticky;
    top: 20px;
    backdrop-filter: blur(10px);
}

.output-section::-webkit-scrollbar {
    width: 8px;
}

.output-section::-webkit-scrollbar-track {
    background: rgba(10, 10, 15, 0.8);
    border-radius: 4px;
}

.output-section::-webkit-scrollbar-thumb {
    background: var(--neon-magenta);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 0, 110, 0.5);
}

.output-section::-webkit-scrollbar-thumb:hover {
    background: var(--neon-purple);
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.6);
}

.output-section h2 {
    font-size: 1.75rem;
    margin-bottom: 20px;
    color: var(--neon-magenta);
    border-bottom: 2px solid var(--neon-magenta);
    padding-bottom: 12px;
    position: sticky;
    top: 0;
    background: rgba(26, 26, 46, 0.95);
    z-index: 10;
    margin-top: -10px;
    padding-top: 10px;
    text-shadow: 0 0 10px rgba(255, 0, 110, 0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
    backdrop-filter: blur(10px);
}

.warnings {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: rgba(217, 70, 239, 0.15);
    border-left: 3px solid var(--neon-purple);
    border-radius: var(--border-radius-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    display: none;
    line-height: 1.7;
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.3),
                inset 0 0 20px rgba(217, 70, 239, 0.1);
    position: sticky;
    top: 60px;
    z-index: 9;
    backdrop-filter: blur(10px);
}

.warnings:not(:empty) {
    display: block;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.warnings strong {
    display: block;
    margin-bottom: 10px;
    font-size: 1.05rem;
    color: var(--neon-purple);
    font-weight: 600;
    text-shadow: 0 0 8px rgba(217, 70, 239, 0.6);
}

.warnings ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.warnings li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.warnings li:last-child {
    margin-bottom: 0;
}

.output-group {
    margin-bottom: 15px;
    padding: 0;
    background: rgba(10, 10, 15, 0.6);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.output-group:last-child {
    margin-bottom: 0;
}

.output-group:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

/* Expanded state styling */
.output-group.expanded {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

/* Collapsible header styles */
.output-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    cursor: pointer;
    user-select: none;
    background: rgba(26, 26, 46, 0.5);
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.output-group.expanded .output-group-header {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1) 0%, rgba(255, 0, 110, 0.05) 100%);
    border-bottom: 1px solid var(--neon-cyan);
}

.output-group-header:hover {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15) 0%, rgba(255, 0, 110, 0.1) 100%);
}

.output-group-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.output-group.expanded .output-group-header h3 {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
}

.collapse-toggle {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: 6px;
    font-weight: bold;
}

.collapse-toggle:hover {
    background: rgba(0, 243, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.collapse-toggle.expanded {
    transform: rotate(-180deg);
    background: var(--neon-cyan);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.6);
}

.collapse-toggle.expanded:hover {
    background: var(--primary-dark);
    transform: rotate(-180deg) scale(1.05);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.8);
}

/* Collapsible content styles */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 24px;
    background: rgba(10, 10, 15, 0.8);
}

.output-group.expanded .collapsible-content {
    max-height: 2500px;
    padding: 20px 24px 24px 24px;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Removed special header color coding - color coding now only applies to individual result items */

.output-grid {
    display: grid;
    gap: 12px;
}

.output-item {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    background: rgba(26, 26, 46, 0.6);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
    position: relative;
}

.output-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--neon-cyan);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
}

.output-item:hover {
    background: rgba(26, 26, 46, 0.8);
    border-color: var(--neon-cyan);
    transform: translateX(4px);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.output-item:hover::before {
    opacity: 1;
}

/* Dynamic color coding based on safety factors */
.output-item.status-excellent {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-cyan);
    border-left: 3px solid var(--neon-cyan);
}

.output-item.status-excellent::before {
    background: var(--neon-cyan);
    opacity: 1;
    width: 4px;
}

.output-item.status-excellent:hover {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.output-item.status-good {
    background: rgba(0, 217, 255, 0.08);
    border-color: var(--primary-dark);
    border-left: 3px solid var(--primary-dark);
}

.output-item.status-good::before {
    background: var(--primary-dark);
    opacity: 1;
    width: 4px;
}

.output-item.status-good:hover {
    background: rgba(0, 217, 255, 0.12);
    border-color: var(--primary-dark);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.output-item.status-warning {
    background: rgba(217, 70, 239, 0.1);
    border-color: var(--neon-purple);
    border-left: 3px solid var(--neon-purple);
}

.output-item.status-warning::before {
    background: var(--neon-purple);
    opacity: 1;
    width: 4px;
}

.output-item.status-warning:hover {
    background: rgba(217, 70, 239, 0.15);
    border-color: var(--neon-purple);
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.4);
}

.output-item.status-danger {
    background: rgba(255, 0, 110, 0.1);
    border-color: var(--neon-magenta);
    border-left: 3px solid var(--neon-magenta);
}

.output-item.status-danger::before {
    background: var(--neon-magenta);
    opacity: 1;
    width: 4px;
}

.output-item.status-danger:hover {
    background: rgba(255, 0, 110, 0.15);
    border-color: var(--neon-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.4);
}

.output-item.status-critical {
    background: rgba(255, 0, 110, 0.2);
    border-color: var(--neon-magenta);
    border-left: 3px solid var(--neon-magenta);
    animation: pulse-danger 2s ease-in-out infinite;
}

.output-item.status-critical::before {
    background: var(--neon-magenta);
    opacity: 1;
    width: 4px;
}

.output-item.status-critical:hover {
    background: rgba(255, 0, 110, 0.25);
    border-color: var(--neon-magenta);
    box-shadow: 0 0 25px rgba(255, 0, 110, 0.6);
}

@keyframes pulse-danger {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 110, 0.4);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 0, 110, 0.6);
    }
}

.output-item > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.output-label-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.output-item label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.output-item > div:first-child > span {
    font-weight: 600;
    color: var(--neon-cyan);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    margin-left: auto;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.equation-toggle {
    background: none;
    border: 1px solid var(--neon-purple);
    color: var(--neon-purple);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.equation-toggle:hover {
    background: rgba(217, 70, 239, 0.2);
    box-shadow: 0 0 8px rgba(217, 70, 239, 0.5);
}

.equation-toggle.expanded {
    transform: rotate(-180deg);
    background: rgba(217, 70, 239, 0.2);
}

.equation-display {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(10, 10, 15, 0.8);
    border-left: 2px solid var(--neon-purple);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--neon-purple);
    overflow-x: auto;
    box-shadow: inset 0 0 10px rgba(217, 70, 239, 0.1);
}

.equation-display.visible {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .output-section {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .output-section {
        padding: 20px;
    }

    .input-section h2,
    .output-section h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .input-group {
        padding: 18px;
        margin-bottom: 15px;
    }

    .input-group h3 {
        font-size: 1.15rem;
    }

    .input-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .input-row label {
        flex: none;
        margin-bottom: 2px;
    }

    .input-row input[type="number"],
    .input-row select {
        width: 100%;
    }

    .output-group-header {
        padding: 15px 18px;
    }

    .output-group-header h3 {
        font-size: 1rem;
    }

    .collapse-toggle {
        min-width: 32px;
        height: 32px;
        padding: 6px 10px;
    }

    .output-section {
        position: static;
        max-height: none;
    }
}

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group,
.output-group {
    animation: fadeIn 0.5s ease-out;
}

/* Cyberpunk Glow Animation */
@keyframes neonGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 243, 255, 0.8),
                     0 0 20px rgba(0, 243, 255, 0.5),
                     0 0 30px rgba(0, 243, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 15px rgba(0, 243, 255, 1),
                     0 0 30px rgba(0, 243, 255, 0.7),
                     0 0 45px rgba(0, 243, 255, 0.5);
    }
}

header h1 {
    animation: neonGlow 3s ease-in-out infinite;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    body::before,
    body::after {
        display: none;
    }
    
    .input-section,
    .output-section {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }
}
