/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2em;
}

header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

/* Hero Image Section */
.hero-image-container {
    text-align: center;
    margin-bottom: 10px;
}

.hero-placeholder {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.hero-placeholder h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.hero-placeholder p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 0;
}

/* Appreciation Section */
#appreciation-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#appreciation-section h2 {
    color: white;
    margin-bottom: 15px;
}

.appreciation-text {
    font-size: 1.1em;
    line-height: 1.7;
    margin-bottom: 20px;
    opacity: 0.95;
}

.update-notice {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid #f39c12;
}

.update-notice strong {
    color: #f39c12;
}

/* Introduction Section */
#introduction-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.intro-description {
    color: #7f8c8d;
    font-size: 1.05em;
    line-height: 1.6;
    margin-bottom: 20px;
}

.introduction-input {
    position: relative;
}

#introduction-text {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: #fafafa;
}

#introduction-text:focus {
    outline: none;
    border-color: #3498db;
    background: white;
}

.intro-char-counter {
    text-align: right;
    margin-top: 8px;
}

#intro-char-counter {
    font-size: 12px;
    color: #7f8c8d;
}

/* Main content */
main {
    flex: 1;
}

.section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.hidden {
    display: none;
}

/* Topic selection */
.topic-selector {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

#topic-dropdown {
    flex: 1;
    min-width: 250px;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    transition: border-color 0.3s ease;
}

#topic-dropdown:focus {
    outline: none;
    border-color: #3498db;
}

#start-session-btn {
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#start-session-btn:hover:not(:disabled) {
    background: #2980b9;
}

#start-session-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Session info */
.session-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
    color: #7f8c8d;
}

.session-details span {
    font-weight: 500;
}

#question-counter {
    color: #e74c3c;
}

/* Chat section */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid #ecf0f1;
    border-radius: 6px 6px 0 0;
    background: #fafafa;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    white-space: pre-wrap;
    line-height: 1.4;
}

.message.user .message-content {
    background: #3498db;
    color: white;
    border-bottom-right-radius: 6px;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 5px;
    padding: 0 16px;
}

.message.user .message-time {
    text-align: right;
}

/* Chat input */
.chat-input-container {
    border: 1px solid #ecf0f1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: white;
}

#message-input {
    width: 100%;
    padding: 15px;
    border: none;
    resize: vertical;
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #ecf0f1;
    background: #fafafa;
}

#char-counter {
    font-size: 12px;
    color: #7f8c8d;
}

#send-btn, #save-session-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#send-btn {
    background: #27ae60;
    color: white;
    margin-right: 10px;
}

#send-btn:hover:not(:disabled) {
    background: #229954;
}

#send-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.save-btn {
    background: #e74c3c;
    color: white;
}

.save-btn:hover:not(:disabled) {
    background: #c0392b;
}

.save-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Loading section */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}

/* Error section */
.error-message {
    text-align: center;
    color: #e74c3c;
}

.error-message h3 {
    margin-bottom: 15px;
}

.error-message p {
    margin-bottom: 20px;
    color: #7f8c8d;
}

#retry-btn, #back-to-topics-btn {
    padding: 10px 20px;
    margin: 0 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#retry-btn {
    background: #3498db;
    color: white;
}

#retry-btn:hover {
    background: #2980b9;
}

#back-to-topics-btn {
    background: #7f8c8d;
    color: white;
}

#back-to-topics-btn:hover {
    background: #6c7b7d;
}

/* Success section */
.success-message {
    text-align: center;
    color: #27ae60;
}

.success-message h3 {
    margin-bottom: 15px;
}

.success-message p {
    margin-bottom: 20px;
    color: #7f8c8d;
}

#new-session-btn {
    padding: 12px 24px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#new-session-btn:hover {
    background: #229954;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .topic-selector {
        flex-direction: column;
    }

    #topic-dropdown {
        min-width: auto;
        width: 100%;
    }

    .session-details {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-container {
        height: 400px;
    }

    .chat-controls {
        flex-direction: column;
        gap: 10px;
    }

    .message {
        max-width: 95%;
    }
}