@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: rgb(106, 36, 125);
    --primary-hover: rgb(38, 50, 107);
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-main: rgb(38, 50, 107);
    --text-muted: #64748b;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #eeecff;
    color: var(--text-main);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    line-height: 1.5;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 640px;
    height: 100%;
    max-height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.6s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-container {
    text-align: center;
    margin-bottom: 0.5rem;
}

.logo-container img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, rgb(38, 50, 107), #475569);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(106, 36, 125, 0.1);
}

button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(38, 50, 107, 0.3);
}

button:active {
    transform: translateY(0);
}

.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.send-btn,
.action-btn {
    aspect-ratio: 1 / 1;
    height: 46px;
    width: 46px !important;
    padding: 0 !important;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    background: #e2e8f0;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 12px;
}

.action-btn:hover {
    background: #cbd5e1;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(38, 50, 107, 0.3);
}

.input-group a {
    text-decoration: none;
    display: flex;
}

.input-group input {
    flex: 1;
    margin-bottom: 0 !important;
    height: 46px;
}

button:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.links {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    padding-top: 1.5rem;
}

.links a {
    text-decoration: none;
    display: flex;
}

.links button {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 14px;
    flex-shrink: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: var(--transition);
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-badge.info {
    background: rgba(106, 36, 125, 0.1);
    color: var(--primary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-indicator.pulse {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.info-card {
    background: #f8fafc;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 0.5rem;
    margin: 0.25rem 0 1rem 0;
    transition: var(--transition);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.info-card:hover {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(106, 36, 125, 0.05);
}

.info-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    display: block;
}

.info-content {
    color: var(--text-main);
    font-size: 0.9375rem;
    line-height: 1.6;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.result-area {
    margin-top: 0;
    padding: 1.25rem;
    background: white;
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    white-space: pre-wrap;
    flex: 1;
    overflow-y: auto;
}

.result-area p {
    margin-bottom: 0;
}

/* File Input Customization */
input[type="file"]::file-selector-button {
    margin-right: 1rem;
    border: none;
    background: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}

/* Estilos para el chat */
.chat_message {
    margin: 10px 0;
    border-radius: 15px;
    padding: 15px;
    /* ensure long text wraps inside the chat bubble */
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.chat_message_text {
    flex: 1;
    white-space: pre-wrap;
    /* respect existing line breaks */
}

.chat_message_clipboard {
    flex-shrink: 0;
    align-self: flex-start;
    display: flex;
    align-items: center;
    padding-top: 4px;
    /* Adjust vertical alignment for common text heights */
}

.chat_message_clipboard a {
    color: inherit;
    opacity: 0.6;
    display: flex;
    transition: opacity 0.2s, transform 0.2s;
}

.chat_message_clipboard a:hover {
    opacity: 1;
    transform: scale(1.1);
}

.chat_message_user {
    background-color: var(--primary);
    color: #fff;
}

.chat_message_model {
    background-color: #fff;
    border: 1px solid var(--primary);
}

.chat_message ol {
    margin-left: 15px;
}

/* ensure code elements inside chat bubbles also wrap and don't overflow */
.chat_message code {
    white-space: pre-wrap;
    /* allow breaking within code */
    word-break: break-word;
    overflow-wrap: break-word;
    display: inline-block;
    /* keep formatting but allow wrapping */
    max-width: 100%;
}