/* static/css/style.css */
body {
    background-color: #000000; /* Black background */
    color: #00FF00; /* Default text color: Green */
    font-family: 'Courier Prime', Courier, monospace; /* Serif font */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top */
    min-height: 100vh;
    box-sizing: border-box;
    position: relative; /* Needed for z-index stacking of pseudo-element */
    overflow: hidden; /* If background is larger than viewport */
}

body::before { /* DEFAULT FULL-PAGE SUBTLE BACKGROUND - NOW DISABLED */
    content: "";
    display: none !important; /* ADDED: Completely disable this element */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/human_circles.gif'); /* Default: Filtered GIF */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: invert(1) hue-rotate(90deg) brightness(1.5) saturate(2);
    z-index: -2; /* Furthest back layer */
    opacity: 0.5; /* Default visibility */
    transition: opacity 0.5s ease-in-out;
}

/* Class for body to hide its ::before pseudo-element (the default page background) */
body.splash-active-main-bg-hidden::before {
    opacity: 0;
}

/* Class for body to PERMANENTLY hide its ::before after first splash, if desired */
body.main-bg-permanently-hidden::before {
    opacity: 0 !important;
}

/* RESTORED STYLES FOR SIDE IMAGES */
#splash-left-image,
#splash-right-image {
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - 800px - 40px) / 2); /* 800px for terminal, 40px for body L/R padding */
    background-size: auto 100%; /* Fit height, allow horizontal crop/overflow */
    background-repeat: no-repeat;
    z-index: -1; 
    opacity: 1; /* Always visible */
    pointer-events: none; 
}

#splash-left-image {
    left: 0;
    background-image: url('../images/human_circles_left.png');
    background-position: left center; /* Align to the left */
}

#splash-right-image {
    right: 0;
    background-image: url('../images/human_circles_right.png');
    background-position: right center; /* Align to the right */
}

/* Media query for smaller screens */
@media (max-width: 840px) { /* Max terminal width (800px) + body padding (2*20px) */
    #splash-left-image,
    #splash-right-image {
        display: none; /* Hide side images if not enough space */
    }
}

#terminal {
    position: relative; 
    width: 100%;
    max-width: 800px; 
    border: 1px solid #00FF00; 
    padding: 15px;
    box-shadow: 0 0 10px #00FF00;
    background-color: #0A0A0A; /* RESTORED: Original terminal background */
    transition: background-color 0.5s ease-in-out; 
    overflow: hidden; /* Important for containing ::before */
    z-index: 0; /* Above body::before, context for its own ::before */
    height: 100%;
    /* Height will be managed by output's content and viewport */
}

/* Class for #terminal to make its own background transparent */
#terminal.splash-terminal-bg-transparent {
    background-color: transparent;
}

/* Class for #terminal to make its ::before pseudo-element (splash image) visible */
#terminal.splash-image-visible::before {
    opacity: 0.8; /* Or 1 for full visibility, or desired prominence */
}

#output {
    /* Takes up most of the terminal height, scrollable */
    height: calc(100vh - 100px); /* Adjust 100px for padding and input area */
    max-height: 85vh; /* Max viewport height percentage */
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 10px;
    line-height: 1.6;
    position: relative; /* To ensure its content is layered above #terminal::before */
    z-index: 1;       /* To ensure its content is layered above #terminal::before */
}

/* Standard message styles - predominantly green */
#output .guru-message {
    color: #00FF00; /* Green */
    white-space: pre-wrap; /* Preserve line breaks from server */
}

#output .user-message {
    color: #FFFFFF; /* White for user messages */
}

#output .system-message {
    color: #00FF00; /* Green for system messages */
    font-style: italic;
}

/* Error messages also green, but perhaps with a different style if needed later */
#output .error-critical,
#output .error-warning {
    color: #00FF00; /* Green */
    font-weight: bold; /* Make errors bold */
}

#output .typing-indicator span {
    display: inline-block;
    animation: blink 1s infinite;
    color: #00FF00; /* Green */
}

/* Headline style for initial prompts within the output */
#output .headline-style {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 0.8em;
    color: #00FF00; /* Green */
}

/* Style for prompts like "Please choose a category:" */
#output .system-prompt {
    color: #00FF00; /* Green */
    margin-top: 0.2em;
    margin-bottom: 0.5em;
}

/* Clickable options - Green, hover to White */
#output .clickable-option {
    margin-left: 1em;
    cursor: pointer;
    padding: 5px 0;
    color: #00FF00; /* Green */
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

#output .clickable-option:hover {
    text-decoration: underline;
    color: #FFFFFF; /* White on hover */
}

/* Locked option styling - shows as disabled but still visible */
#output .locked-option {
    margin-left: 1em;
    cursor: default; /* No pointer cursor */
    padding: 5px 0;
    color: #555555; /* Dark gray for disabled appearance */
    transition: color 0.2s ease;
}

#output .locked-option:hover {
    color: #777777; /* Slightly lighter gray on hover, but still disabled */
    /* No underline or white color change */
}

#output .locked-option .lock-icon {
    color: #666666; /* Slightly lighter gray for the lock icon */
    font-size: 0.9em;
}

#output .category-option {
    /* color: #00FF00; Inherits from .clickable-option */
    font-weight: bold;
}

#output .framework-option {
    /* color: #00FF00; Inherits */
    margin-bottom: 8px;
}

#output .framework-option .framework-option-description {
    display: block;
    color: #00FF00; /* Green */
}

#output .framework-option .framework-option-name {
    font-size: 0.85em;
    color: #CCCCCC; /* Lighter gray/off-white for less emphasis, but not yellow/orange */
    /* Or use #FFFFFF if strictly only green/white allowed */
    /* color: #FFFFFF; */ 
    display: block;
    margin-left: 1em;
}

#output .back-option {
    /* color: #00FF00; Inherits */
    margin-top: 10px;
    font-style: italic;
}

/* Emerald Tablet Styles */
#output .tablet-line {
    color: #00FF00; /* Green, same as guru-message for consistency */
    font-style: italic;
    margin-top: 10px; /* Space before tablet line */
    margin-bottom: 2px; /* Less space before signature */
    text-align: left; /* Changed from center to left */
}

#output .tablet-signature {
    color: #CCCCCC; /* Lighter gray/off-white, less prominent */
    font-size: 0.8em;
    text-align: left; /* Changed from center to left */
    margin-bottom: 15px; /* Space after signature, before main content */
    padding-left: 1em; /* Indent signature slightly if line is left-aligned */
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Added for fade-in text effect */
@keyframes fadeInText {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in-text {
    opacity: 0; /* Start transparent if animation is delayed or fails */
    animation: fadeInText 0.5s ease-out forwards;
}

#input-area {
    display: flex;
    align-items: center;
    margin-top: 10px; /* Ensure it doesn't overlap last output line */
}

#prompt {
    margin-right: 8px;
    color: #00FF00; /* Green */
}

#user-input {
    background-color: transparent;
    border: 1px solid #00FF00; /* Green outline for better visibility */
    color: #FFFFFF; /* White for user input text */
    font-family: 'Courier Prime', Courier, monospace;
    font-size: 1em;
    outline: none;
    flex-grow: 1;
    padding: 4px 8px; /* Add some padding for better appearance */
    box-sizing: border-box;
}

#user-input:focus {
    border: 2px solid #00FF00; /* Thicker border when focused */
    box-shadow: 0 0 5px #00FF00; /* Subtle glow effect */
}

/* Placeholder styling for desktop */
#user-input::placeholder {
    color: #666666; /* Dark gray placeholder text */
    opacity: 1; /* Ensure full opacity on all browsers */
}

/* Framework Selection Area */
#framework-selection {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #00FF00;
}

#framework-selection p {
    margin-bottom: 5px;
    color: #00FF00;
}

#framework-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#framework-list li {
    margin-bottom: 5px;
    cursor: pointer;
    color: #FFFF00; /* Amber for selectable items */
}

#framework-list li:hover {
    text-decoration: underline;
    color: #FFFFFF; /* White on hover */
}

.hidden {
    display: none !important;
}

/* Category Selection Styles */
#category-selection {
    width: 100%;
    max-width: 800px;
    padding: 15px;
    /* Resembles terminal for consistency, but can be changed */
    border: 1px solid #00FF00;
    background-color: #0A0A0A;
    margin-bottom: 20px; /* Space before terminal if it ever shows simultaneously */
}

#category-headline {
    color: #00FF00;
    text-align: center;
    margin-bottom: 15px;
    min-height: 1.2em; /* Ensure space for animated text */
}

#category-list {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between category name items */
    max-height: calc(90vh - 150px); /* Adjust 150px based on other elements */
    overflow-y: auto;
}

/* Styles for clickable category names */
.category-name-item {
    padding: 10px 15px;
    border: 1px solid #008F00; /* Darker green */
    background-color: #050505;
    color: #00FF00; /* Bright green */
    cursor: pointer;
    text-align: center;
    font-size: 1.1em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.category-name-item:hover {
    background-color: #008F00; /* Darker green background on hover */
    color: #FFFFFF; /* White text on hover */
}

/* Styles for the framework list items when a category is selected */
#framework-selection {
    /* Ensure it fills available space if categories are hidden */
    width: 100%;
    max-width: 800px;
    padding: 15px;
    border: 1px solid #00FF00;
    background-color: #0A0A0A;
}

#framework-headline {
    color: #00FF00;
    text-align: center;
    margin-bottom: 10px;
}

#framework-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: calc(90vh - 200px); /* Adjust 200px based on other elements */
    overflow-y: auto;
}

.framework-link-item {
    margin-bottom: 10px;
    padding: 8px;
    cursor: pointer;
    border: 1px solid transparent; /* For hover effect */
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.framework-link-item:hover {
    border-color: #FFFF00; /* Amber border on hover */
    background-color: #1A1A00; /* Dark amber background on hover */
}

.framework-link-description {
    color: #00FF00; /* Green for description - prominent */
    margin: 0 0 3px 0; /* Small space below description */
    font-size: 1em;
}

.framework-link-name {
    color: #FFA500; /* Orange for name - less prominent */
    font-size: 0.8em; /* Smaller font for name */
    display: block; /* Ensure it takes its own line or appears distinct */
}

#back-to-categories {
    background-color: #008F00;
    color: #000000;
    border: 1px solid #00FF00;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Courier Prime', Courier, monospace;
    margin-bottom: 10px;
}

#back-to-categories:hover {
    background-color: #00FF00;
    color: #000000;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 0;
        margin: 0;
        height: 100vh;
        overflow: hidden;
    }
    
    #terminal {
        margin: 0;
        padding: 10px;
        height: 100vh;
        width: 100vw;
        box-sizing: border-box;
        position: fixed;
        top: 0;
        left: 0;
        overflow: hidden;
    }
    
    #output {
        overflow-y: auto;
        overflow-x: hidden;
        height: calc(100vh - 100px);
        padding-bottom: 60px; /* Extra padding for better visibility with keyboard */
        box-sizing: border-box;
    }
    
    /* Add extra padding after back button for better text visibility */
    .top-left-back {
        margin-bottom: 40px !important; /* More space after back button */
    }
    
    #input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #0A0A0A;
        border-top: 1px solid #00FF00;
        padding: 10px;
        z-index: 1000;
        height: 50px;
        box-sizing: border-box;
        /* Smooth transition for repositioning */
        transition: bottom 0.3s ease;
    }
    
    /* When keyboard is active, position input at top of keyboard */
    #input-area.keyboard-active {
        /* JavaScript will dynamically set the bottom value based on keyboard height */
        bottom: var(--keyboard-height, 300px);
    }
    
    #user-input {
        font-size: 16px; /* Prevent zoom on iOS */
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 8px;
        background-color: #000000;
        color: #00FF00;
        border: 1px solid #00FF00; /* Restore green outline */
        outline: none; /* Remove default focus outline */
    }
    
    #user-input:focus {
        border: 2px solid #00FF00; /* Thicker border when focused */
        box-shadow: 0 0 5px #00FF00; /* Subtle glow effect */
    }
    
    /* Add placeholder styling for mobile */
    #user-input::placeholder {
        color: #666666; /* Dark gray placeholder text */
        opacity: 1; /* Ensure full opacity on all browsers */
    }
    
    #output .clickable-option {
        margin-left: 0.5em;
    }
}

.top-left-back {
    /* position: absolute; */ /* Removed for normal flow */
    /* top: 10px; */      /* Removed */
    /* left: 10px; */     /* Removed */
    font-size: 0.9em;
    margin-bottom: 15px; /* Added margin for spacing below */
    display: block; /* Ensure it takes its own line if needed */
    /* The .clickable-option class should handle hover effects */
}

/* Ensure .clickable-option hover is effective for back links too */
#global-back-link:hover, #global-bottom-back-link:hover {
    text-decoration: underline;
    color: #FFFFFF; 
}

/* Styling for Parent/Child/Sibling navigation links within Cycle Detail */
.cycle-nav-link {
    /* Inherits .clickable-option for base styling and hover */
    margin-left: 1em; /* Indent a bit, similar to other options */
    padding: 3px 0; /* Adjust padding for these specific links */
}

.cycle-link-name {
    /* This class is inside the .cycle-nav-link */
    /* .clickable-option hover effect might not directly apply here, 
       so we ensure it behaves like a link part by inheriting color 
       or setting it explicitly if needed. For now, it will inherit color from parent. */
    text-decoration: underline; /* Make the name part look like a link */
    /* color: #00FF00; */ /* Or a specific link color if desired */
} 