/* Global Styles */
:root {
    --primary-color: #3b89e2;
    /* iSchool Dark Blue */
    --accent-color: #FF6B00;
    /* iSchool Orange */
    --bg-color: #5599ff;
    --white: #ffffff;
    --text-color: #333;
    --light-gray: #e2e8f0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Main Container */
.container {
    background-color: var(--white);
    width: 100%;
    max-width: 800px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--accent-color);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 60px;
    /* Adjust based on logo aspect ratio */
    width: auto;
}

h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

textarea {
    resize: vertical;
}

/* Row Layout for Dropdowns */
.row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.col {
    flex: 1;
    margin-bottom: 0;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    flex: 1;
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    opacity: 0.9;
}

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

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-copy {
    background-color: var(--accent-color);
    color: white;
    flex: 0 0 auto;
    min-width: 120px;

}

/* Chat Interface */
.chat-interface {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--light-gray);
    height: 400px;
    overflow: hidden;
    /* Hide overflow on main container, scroll inner messages instead */
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    /* Take up remaining space */
    overflow-y: auto;
    /* Scrollable */
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
}

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

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

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: contain;
    background-color: white;
    padding: 2px;
    border: 1px solid var(--light-gray);
}

.bubble {
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bot-message .bubble {
    background-color: var(--white);
    color: var(--text-color);
    border-top-left-radius: 2px;
    border: 1px solid var(--light-gray);
}

.user-message .bubble {
    background-color: var(--primary-color);
    color: white;
    border-top-right-radius: 2px;
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid var(--light-gray);
    padding-top: 15px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid var(--light-gray);
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 137, 226, 0.2);
}

.btn-icon {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #2a6fb8;
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Copy Area */
.copy-area {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
}

.status-text {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
    color: #718096;
    font-size: 0.9rem;
}

footer strong {
    color: var(--primary-color);
}

/* Response Design */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .row {
        flex-direction: column;
        gap: 0;
        margin-bottom: 0;
    }

    .col {
        margin-bottom: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* Dynamic Feedback Rows */
.feedback-row {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    position: relative;
    border: 1px solid #e9ecef;
}

.feedback-row .col {
    padding: 0 5px;
}

.btn-remove {
    position: static;
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    width: 46px;
    /* Matches input height roughly */
    height: 46px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    align-self: flex-end;
    /* Aligns with the input fields at the bottom */
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-remove:hover {
    background-color: #fed7d7;
    border-color: #fc8181;
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px dashed var(--primary-color);
    padding: 10px;
    width: 100%;
    border-radius: 12px;
}

/* --- Animations & UX Enhancements --- */

/* 1. Entrance Animations */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.02);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

body {
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.container {
    animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 2. Enhanced Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* 3. Feedback Row Slide In */
.feedback-row {
    animation: slideUpFade 0.4s ease-out forwards;
}

/* 4. Chat Bubble Pop In */
.message .bubble {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom left;
}

.user-message .bubble {
    transform-origin: bottom right;
}

/* 5. Typing Animation */
.typing-dots::after {
    content: '...';
    animation: typing 1.5s infinite steps(4, end);
    display: inline-block;
    width: 1em;
    text-align: left;
}

@keyframes typing {

    0%,
    100% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }
}

/* 6. Focus Effects */
select:focus,
input:focus,
textarea:focus {
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 7. Button Pulse on Hover */
.btn-primary:hover {
    box-shadow: 0 5px 15px rgba(59, 137, 226, 0.4);
    transform: translateY(-2px);
}

.secondary-btn:hover {
    letter-spacing: 0.5px;
}

/* Motivation Widget */
.motivation-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--light-gray);
    z-index: 1000;
    max-width: 300px;
    animation: slideInRight 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.motivation-widget:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.bulb-icon {
    font-size: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.motivation-text {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.4;
    transition: opacity 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@media (max-width: 800px) {
    .motivation-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        justify-content: center;
    }
}

.hidden {
    display: none !important;
}