/* Berkeley Theme Colors */
:root {
    --berkeley-blue: #003262;
    --berkeley-gold: #FDB515;
    --berkeley-gray: #DDD5C7;
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #FFFFFF;
    color: #333333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #003262; /* Berkeley Blue background */
    color: #FFFFFF;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    height: 80px; /* Adjust as needed */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 20px;
    max-width: 1200px; /* or whatever max-width you prefer for your content */
    margin: 0 auto;
}

header .logo {
height: 100%;
display: flex;
align-items: center;
background-color: white; /* Set logo background to white */
padding: 0 20px; /* Add some padding around the logo */
}

header .logo img {
height: 100%;
width: auto; /* Maintain aspect ratio */
object-fit: contain; /* Ensure the entire logo is visible */
}

header nav {
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: 20px;
}

header nav a {
    color: #FFFFFF;
    text-decoration: none;
    margin: 0 15px;
    font-weight: bold;
}

header nav a:hover {
    text-decoration: underline;
}

.logo-link {
    display: block;
    height: 100%;
    text-decoration: none;
}

.logo-link:hover {
    text-decoration: none;
}

/* Main Content Styles */
main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 100px;
    flex: 1 0 auto;
    box-sizing: border-box;
    min-height: calc(100vh - 100px);
}

.main-title {
    text-align: center;
    color: var(--berkeley-blue);
    margin-bottom: 20px;
    font-size: 2rem;
}

h2 {
    color: var(--berkeley-gold);
    margin-bottom: 15px;
    padding-left: 20px;
}

h3 {
    color: var(--berkeley-blue);
    margin-bottom: 10px;
    padding-left: 20px;
}

/* Mode Selection */
.mode-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background-color: #e2e8f0;
    color: #4a5568;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.mode-btn:hover:not(.active) {
    background-color: var(--berkeley-gray);
}

/* Content Layout */
.content-area {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.visualization-section {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.code-section {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Tree Visualization */
.trees-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    border: 1px solid var(--berkeley-gray);
    border-radius: 6px;
    padding: 15px;
    min-height: 250px;
}

.tree {
    text-align: center;
}

.node {
    fill: white;
    stroke: #444;
    stroke-width: 1px;
    cursor: pointer;
    transition: fill 0.3s ease;
}

.node.selected {
    fill: #4caf50;
}

.node.highlighted {
    fill: var(--berkeley-gold);
}

.edge {
    stroke: #444;
    stroke-width: 1px;
}

/* Explanation Box */
.explanation-box {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 100px;
}

.explanation-box p {
    padding-left: 20px;
    line-height: 1.6;
}

.hint-box {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff9c4;
    border: 1px solid var(--berkeley-gold);
    border-radius: 4px;
}

.hidden {
    display: none;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.main-controls, .secondary-controls {
    display: flex;
    gap: 5px;
}

.control-btn {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: none;
    background-color: var(--berkeley-gray);
    color: var(--berkeley-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: #c9c0b1;
}

.play-btn {
    background-color: var(--berkeley-blue);
    color: white;
}

.play-btn.pause {
    background-color: #d32f2f;
}

.play-btn:hover {
    background-color: #002349;
}

.play-btn.pause:hover {
    background-color: #b71c1c;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--berkeley-gray);
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-container.mini {
    height: 5px;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background-color: var(--berkeley-blue);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Feedback Message */
.feedback-message {
    margin-top: 15px;
    padding: 10px;
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
}

/* Code Section */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.code-progress {
    flex: 1;
}

.progress-text {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 2px;
}

.code-templates {
    display: flex;
    gap: 5px;
}

.template-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    background-color: var(--berkeley-gray);
    color: var(--berkeley-blue);
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-btn:hover {
    background-color: #c9c0b1;
}

.code-editor {
    width: 100%;
    height: 250px;
    padding: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid var(--berkeley-gray);
    border-radius: 4px;
    background-color: #f8f9fa;
    resize: vertical;
    margin-bottom: 15px;
}

.code-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background-color: var(--berkeley-gray);
    color: var(--berkeley-blue);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: #c9c0b1;
}

.action-btn.primary {
    background-color: var(--berkeley-gold);
    color: var(--berkeley-blue);
}

.action-btn.primary:hover {
    background-color: #e6a313;
}

.code-explanation {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    font-size: 0.9rem;
}

.code-explanation ul {
    padding-left: 40px;
    margin-top: 5px;
}

.code-explanation li {
    margin-bottom: 5px;
    line-height: 1.6;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #f1f1f1;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Challenge Section */
.challenge-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.challenge-description {
    margin-bottom: 15px;
    font-size: 0.95rem;
    padding-left: 20px;
    line-height: 1.6;
}

.challenge-feedback {
    margin: 15px 0;
    padding: 15px;
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 4px;
}

.solution-section {
    margin-top: 15px;
}

.solution-section h4 {
    color: var(--berkeley-blue);
    margin-bottom: 10px;
}

.solution-code {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 8px;
}

.challenge-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

/* Footer */
footer {
    background-color: var(--berkeley-blue);
    color: #FFFFFF;
    text-align: center;
    padding: 10px 0;
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 992px) {
    .content-area {
        flex-direction: column;
    }
    
    .code-section, .visualization-section {
        width: 100%;
    }
}

@media (max-width: 768px) {
    main {
        padding: 100px 10px 20px;
    }
    
    .mode-selection {
        flex-direction: column;
        align-items: stretch;
    }
    
    .trees-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tree {
        margin-bottom: 20px;
    }
    
    .code-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .code-templates {
        margin-top: 10px;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    h3 {
        font-size: 1.2em;
    }
}

/* Enhanced feedback styling */
.challenge-feedback {
    margin: 15px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid var(--berkeley-blue);
    border-radius: 8px;
    line-height: 1.5;
}

#challenge-feedback-text {
    white-space: pre-line;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.solution-section {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--berkeley-gray);
}

.solution-section h4 {
    color: var(--berkeley-blue);
    margin-bottom: 10px;
}

/* Thinking animation styles */
.thinking-animation {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.thinking-animation.hidden {
    display: none;
}

.thinking-text {
    margin-left: 10px;
    color: var(--berkeley-blue);
    font-weight: 500;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-radius: 50%;
    background-color: var(--berkeley-blue);
    animation: dot-pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.3s;
}

.dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes dot-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* Markdown formatting styles */
.formatted-feedback h3 {
    color: var(--berkeley-blue);
    font-size: 1.2rem;
    margin: 15px 0 10px 0;
    padding-left: 0;
}

.formatted-feedback h4 {
    color: var(--berkeley-gold);
    font-size: 1.1rem;
    margin: 15px 0 5px 0;
    padding-left: 0;
}

.formatted-feedback strong {
    font-weight: bold;
}

.formatted-feedback em {
    font-style: italic;
}

.formatted-feedback p {
    margin: 8px 0;
    line-height: 1.5;
}

.formatted-feedback ul {
    margin-left: 20px;
    margin-top: 8px;
}

.formatted-feedback li {
    margin-bottom: 5px;
    line-height: 1.5;
}

.category-content {
    margin-left: 20px;
}

.formatted-feedback {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #333;
}

.formatted-feedback .evaluation-score {
    color: var(--berkeley-blue);
    font-size: 1.4rem;
    margin: 0.5rem 0 1rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--berkeley-gold);
}

.formatted-feedback .evaluation-section {
    color: var(--berkeley-blue);
    font-size: 1.2rem;
    margin: 1.2rem 0 0.5rem 0;
    font-weight: 600;
}

.formatted-feedback p {
    margin: 0.5rem 0 1rem 0;
    padding-left: 0.5rem;
}

.formatted-feedback ul {
    margin: 0.5rem 0 1rem 0.5rem;
    padding-left: 1.5rem;
}

.formatted-feedback li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Evaluation styling */
.evaluation-content {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

.evaluation-score {
    background-color: #f5f5f5;
    border-left: 5px solid var(--berkeley-blue);
    padding: 15px;
    margin-bottom: 20px;
}

.evaluation-score h3 {
    margin: 0;
    padding: 0;
    color: var(--berkeley-blue);
    font-size: 1.2rem;
    display: inline-block;
}

.evaluation-score .score-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--berkeley-blue);
    margin-left: 10px;
}

.evaluation-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.evaluation-section h3 {
    color: var(--berkeley-gold);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.evaluation-section p {
    margin: 0 0 10px 0;
}

.evaluation-suggestions {
    margin-bottom: 20px;
}

.evaluation-suggestions h3 {
    color: var(--berkeley-gold);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.evaluation-suggestions ul {
    margin: 0 0 0 20px;
    padding: 0;
}

.evaluation-suggestions li {
    margin-bottom: 8px;
}

.formatted-feedback ul {
    margin: 0.5rem 0 1rem 0.5rem;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.formatted-feedback li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: list-item; /* Force list display */
}

/* Ensure content doesn't get cut off */
.challenge-feedback {
    max-height: none;
    overflow: visible;
}


/* fixing the section header and content paragraph gap distance */
/* Add these styles to your CSS or update the existing styles */

/* Fix for section headers spacing */
.formatted-feedback h3.evaluation-section,
.formatted-feedback h4.evaluation-section {
    margin-bottom: 2px; /* Reduce from 10px to 2px */
    margin-top: 20px;   /* Add space between sections instead */
    color: var(--berkeley-blue);
    font-weight: 600;
    padding-left: 0;
}

/* Fix for the score header */
.formatted-feedback h3.evaluation-score {
    margin-bottom: 20px; /* Keep good spacing after the score */
    color: var(--berkeley-blue);
    font-weight: 700;
    border-bottom: 2px solid var(--berkeley-gold);
    padding-bottom: 5px;
}

/* Adjust paragraph spacing */
.formatted-feedback p {
    margin-top: 0;       /* Remove top margin */
    margin-bottom: 12px; /* Keep bottom margin for spacing between sections */
    line-height: 1.5;
    padding-left: 5px;   /* Very slight indent */
}

/* Adjust list spacing */
.formatted-feedback ul {
    margin-top: 0;      /* Remove top margin */
    margin-left: 20px;  /* Keep left margin for indent */
    padding-left: 5px;  /* Slight indent */
}

/* Make sure the evaluation content has proper spacing */
.evaluation-content {
    padding: 5px;
}

/* Make section headers more prominent */
.formatted-feedback .evaluation-section {
    padding-left: 0;
    border-left: 3px solid var(--berkeley-gold);
    padding-left: 8px;
}


/* Problem Statement Styling */
.problem-statement {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.problem-statement h2 {
    color: var(--berkeley-blue);
    border-bottom: 2px solid var(--berkeley-gold);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: left;
    padding-left: 0;
}

.problem-statement h3 {
    color: var(--berkeley-blue);
    margin: 15px 0 10px 0;
    padding-left: 0;
    font-size: 1.1rem;
}

.problem-statement h4 {
    color: var(--berkeley-gold);
    margin: 10px 0 5px 0;
    font-size: 1rem;
}

.problem-description p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.example {
    background-color: #f8f9fa;
    border-left: 3px solid var(--berkeley-gold);
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 0 5px 5px 0;
}

.example-content {
    padding-left: 10px;
}

.example-explanation {
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

.problem-constraints ul {
    padding-left: 25px;
    margin: 5px 0;
}

.problem-constraints li {
    margin-bottom: 5px;
}

.hint-toggle {
    padding: 3px 8px;
    font-size: 0.8rem;
    background-color: var(--berkeley-gray);
    color: var(--berkeley-blue);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.hint-toggle:hover {
    background-color: #c9c0b1;
}

.hints-container {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.hint {
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 2px solid var(--berkeley-gold);
}

code {
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}
