/* css/style.css */
:root {
    --primary-color: #007bff; /* Azul vibrante */
    --primary-hover-color: #0056b3;
    --secondary-color: #6c757d; /* Cinza neutro */
    --background-color: #f8f9fa; /* Fundo claro */
    --surface-color: #ffffff; /* Superfície de cards, modais */
    --text-color: #212529; /* Texto principal */
    --text-muted-color: #6c757d; /* Texto sutil */
    --border-color: #dee2e6; /* Bordas suaves */
    --success-color: #28a745;
    --font-family: 'Poppins', sans-serif;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: var(--surface-color);
    color: var(--primary-color);
    padding: 15px 30px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


header .logo-container h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: 700;
}

header .logo-container p {
    margin: 5px 0 0;
    font-size: 1em;
    color: var(--text-muted-color);
    font-weight: 300;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.icon-position i {
  position: absolute;
  top: 10px;
  left: 10px;
   font-size: 1.5em;
   padding: 10px;
    color: var(--secondary-color);
    transition: color 0.2s;
}

.icon-position2 i {
  position: absolute;
  top: 10px;
  right: 10px;
   font-size: 1.5em;
    padding: 10px;
    color: var(--secondary-color);
    transition: color 0.2s;
}

.icon-position2 i:hover {
    color: var(--primary-color);
}

.icon-position i:hover {
    color: var(--primary-color);
}

.header-icons i {
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    color: var(--secondary-color);
    transition: color 0.2s;
}
.header-icons i:hover {
    color: var(--primary-color);
}


main {
    flex-grow: 1;
    padding: 20px;
    max-width: 900px;
    margin: 30px auto;
    width: 90%;
}

.content-section {
    background-color: var(--surface-color);
    padding: 25px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    display: none; /* Hidden by default, JS will manage visibility */
}

.content-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.content-section.collapsing {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.3s ease-in-out, padding 0.5s ease-in-out, margin 0.5s ease-in-out;
}


h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 600;
}

.question-selector-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.question-selector-container select {
    flex-grow: 1;
    padding: 15px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1.1em;
    background-color: var(--surface-color);
    color: var(--text-color);
    appearance: none; /* For custom arrow if desired */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 1.2em;
    min-width: 250px; /* Ensure it doesn't get too small */
}
.question-selector-container select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.question-selector-container span {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    display: block;
    width: fit-content;
    margin: 20px auto 0; /* Center button */
}
.cta-button:hover:not(:disabled) {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}
.cta-button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted-color);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
textarea#generated-prompt {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1em;
    box-sizing: border-box; /* Important for 100% width */
    background-color: var(--surface-color); /* For dark theme */
    color: var(--text-color); /* For dark theme */
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus,
textarea#generated-prompt:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
textarea#generated-prompt {
    resize: vertical;
    min-height: 120px;
}

/* Chat Container */
#chat-container {
    position: fixed;
    right: -450px; /* Start off-screen */
    top: 0;
    width: 400px;
    height: 100%;
    background-color: var(--surface-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transition: right 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth slide */
    z-index: 1000;
}
#chat-container.visible {
    right: 0;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h3 {
    margin: 0;
    font-size: 1.2em;
}
#close-chat-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.message {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
}
.message.user {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
}
.message.assistant {
    background-color: #e9ecef; /* Lighter grey for assistant */
    color: var(--text-color);
    align-self: flex-start;
}
.loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: var(--text-muted-color);
    font-style: italic;
    padding: 20px;
    height: 100%; /* Make it take full height if it's the only message */
}
.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite;
    margin-bottom: 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--border-color);
}
#chat-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-right: 10px;
}
#send-chat-message-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2em;
}
#send-chat-message-btn:hover {
    background-color: var(--primary-hover-color);
}


/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1001; /* Higher than chat */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Dim background */
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--surface-color);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 80%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    animation: slideInModal 0.3s ease-out;
}
@keyframes slideInModal {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal-btn {
    color: var(--text-muted-color);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal-btn:hover,
.close-modal-btn:focus {
    color: var(--text-color);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
}
.modal-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.api-settings-group {
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 15px;
        flex-direction: column;
    }
    header .logo-container {
        order: 1;
        margin-bottom: 10px;
    }
    .header-icons {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding: 0 10px; /* Add some padding to space out icons */
    }
     header .logo-container h1 {
        font-size: 2em;
    }
     header .logo-container p {
        font-size: 0.9em;
    }

    main {
        padding: 10px;
        width: 95%;
        margin-top: 20px;
    }
    .question-selector-container {
        flex-direction: column;
        align-items: stretch;
    }
    .question-selector-container select,
    .question-selector-container span {
        width: 100%;
        text-align: left;
        font-size: 0.9em;
    }
    .question-selector-container span {
        margin-top: 10px;
    }

    #chat-container {
        width: 100%;
        height: 75vh; /* Not full height to allow seeing page behind */
        bottom: 0;
        top: auto;
        right: 0; /* Default to visible or handled by JS */
        transform: translateY(100%); /* Start off-screen from bottom */
        transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: 0 -5px 15px rgba(0,0,0,0.15);
    }
    #chat-container.visible {
        transform: translateY(0);
        right: 0; /* Ensure it's correctly positioned */
    }
    
    /* Modal on mobile */
    .modal-content {
        width: 90%;
        margin: 15% auto;
        padding: 20px;
    }
}