:root {
    --primary-color: #587eb7;       
    --secondary-color: #84a5da;     
    --background-color: #e8eef7;   
    --panel-color: #ffffff;         
    --text-color: #223859;         
    --border-color: #c4d3eb;        
    --selected-color: #8f3fffd2;      
    --hover-color: #aad6a5b3;         
    --footer-color: #dbe5f4;        
    --button-height: 40px;
  }

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    transition: background-color 0.3s, transform 0.1s;
}

button:hover {
    background-color: var(--hover-color);
}

button:active {
    transform: scale(0.98);
}

h1, h2, h3, h4 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 0px;
    border-bottom: 1px solid var(--border-color);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-top: 10px;
}

.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    flex: 1;
}

/* Left Panel - Search Filters */
.left-panel {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background-color: var(--panel-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative; 
    overflow: visible; 
}

.search-panel {
    display: flex;
    flex-direction: column;
    height: 100%; 
    position: relative; 
    overflow-y: visible; 
}

.search-panel h2 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 100;
}

.help-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    color: var(--primary-color);
    font-size: 0.9em;
    transition: color 0.3s, transform 0.2s;
    z-index: 101;
}

.help-icon:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.help-icon i {
    font-size: 1.1em;
}

.help-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10000;
    pointer-events: none;
    width: 320px;
}

.help-icon:hover .help-tooltip {
    opacity: 1;
    visibility: visible;
}

.help-tooltip-content {
    background-color: var(--text-color);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10001;
}

.help-tooltip-content::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: var(--text-color);
}

.help-tooltip-content strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.search-section {
    margin-bottom: 20px;
}

.trait {
    margin-bottom: 15px;
}

.trait h4 {
    margin-bottom: 8px;
}

.trait-buttons {
    display: flex;
    gap: 10px;
}

.trait-btn {
    background-color: #e9e9e9;
    padding: 6px 12px;
    flex: 1;
    position: relative; 
    transition: background-color 0.3s;
}

.trait-btn.selected {
    background-color: var(--selected-color);
    color: white;
}

.search-buttons {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    background-color: var(--panel-color);
    position: sticky; 
    bottom: 0; 
    z-index: 10;
    margin-top: 10px; 
}

#search-btn, #random-btn, #reset-btn {
    background-color: var(--primary-color);
    color: white;
    flex: 1;
    font-size: 0.9rem;
    padding: 10px 8px;
    height: var(--button-height);
}

#random-btn, #reset-btn {
    background-color: #f0f0f0;
    color: var(--text-color);
}

/* Right Panel - Content Display */
.right-panel {
    flex: 2.5;
    min-width: 400px;
    background-color: var(--panel-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative; 
    display: flex;
    flex-direction: column;
    max-height: fit-content; 
}

#dialogue-display {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dialog-counter {
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.dialog-number-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-buttons {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.dialog-counter input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

.dialogue-header {
    display: none;
}

#dialogue-metadata {
    display: none;
}

.image-container {
    display: block;
    margin-bottom: 20px;
    text-align: center;
}

.image-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.story-title-container {
    display: block;
    margin-bottom: 20px;
    text-align: center;
    padding: 30px;
    background-color: var(--background-color);
    border-radius: 8px;
}

.story-title-container h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0;
    margin-bottom: 15px;
}

.story-moral {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
    margin-top: 10px;
    line-height: 1.6;
}

.story-moral strong {
    font-weight: bold;
    color: var(--primary-color);
}

#task-selector {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: var(--text-color);
}

.task-description {
    display: flex;
    align-items: center;
    gap: 8px;
}

#strategies-used {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

#strategy-list {
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#strategy-list li {
    background-color: var(--hover-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    display: block;
    margin-bottom: 5px;
    text-transform: capitalize;
}

#dialogue-content {
    overflow-y: auto;
    padding-bottom: 10px;
    position: relative;
    display: block;
    min-height: 0; 
    
}

.dialogue-message:last-child {
    margin-bottom: var(--button-height); 
}

.dialogue-message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    max-width: 80%;
}

.teacher {
    background-color: #95cff2c5;
    margin-right: 20%;
}

.student {
    background-color: #dedede9f;
    margin-left: 20%;
}

.dialogue-role {
    font-weight: bold;
    margin-bottom: 5px;
}

.dialogue-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background-color: #f9f9f9;
    border-radius: 8px;
    color: #888;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background-color: var(--footer-color);
    border-top: 1px solid var(--border-color);
}


@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel, .right-panel {
        min-width: 100%;
        max-width: 100%;
    }
    
    #dialogue-content {
        height: 450px; 
    }
    
    .dialogue-message {
        max-width: 90%;
    }
    
    .teacher {
        margin-right: 10%;
    }
    
    .student {
        margin-left: 10%;
    }
}

.nav-btn {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: var(--secondary-color);
}

.nav-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.strategy-filters {
    padding-right: 10px;
    padding-bottom: 20px;
    margin-bottom: 0;
    overflow-y: visible; 
}

.strategy-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.strategy-item label {
    margin-left: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}