/* MathOS V3.0 - Web Edition */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;700;900&family=Inter:wght@300;400;600&display=swap');

:root {
    --royal-blue: #002147;
    --gold-accent: #C5A059;
    --paper-white: #FCFBF9;
    --text-dark: #1A1A1A;
    --text-grey: #555555;
    --font-heading: 'Merriweather', 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--paper-white);
    color: var(--text-dark);
    font-family: var(--font-body);
    line-height: 1.8;
    margin: 0;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 10px 0;
    flex-shrink: 0;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 50px;
    object-fit: contain;
}

.contacts {
    font-size: 0.9rem;
    color: var(--text-grey);
    border-left: 2px solid var(--gold-accent);
    padding-left: 15px;
}

/* API Settings Panel */
.settings-toggle {
    background: var(--royal-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-toggle:hover {
    background: var(--gold-accent);
    color: var(--royal-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

#settings-panel {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-top: 15px;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

input {
    border: 1px solid rgba(0,0,0,0.1);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: var(--font-body);
}

input:focus {
    outline: none;
    border-color: var(--royal-blue);
}

/* Main Grid */
.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    flex-grow: 1;
    overflow: hidden;
    margin-top: 24px;
}

.panel {
    background: white;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.panel-header {
    background: rgba(0, 33, 71, 0.02);
    padding: 15px 24px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--royal-blue);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

/* Messages */
.user-msg, .ai-msg {
    margin-bottom: 24px;
    padding: 20px;
    border-radius: 18px;
    position: relative;
    animation: fadeInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) backwards;
    transition: all 0.3s ease;
}

.user-msg {
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    border-left: 6px solid var(--gold-accent);
}

.ai-msg {
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    border-left: 6px solid var(--royal-blue);
}

.user-msg:hover, .ai-msg:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 33, 71, 0.05);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-label {
    display: block;
    font-weight: 700;
    color: var(--royal-blue);
    font-family: var(--font-heading);
    margin-bottom: 10px;
}

/* Input Area */
.input-section {
    padding: 20px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.toolbar {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-box-wrapper {
    display: flex;
    gap: 15px;
}

textarea {
    flex-grow: 1;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 12px;
    font-family: var(--font-body);
    resize: none;
    height: 80px;
}

.btn-send {
    background: var(--royal-blue);
    color: white;
    border: none;
    padding: 0 30px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-send:hover:not(:disabled) {
    background: var(--gold-accent);
    color: var(--royal-blue);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
    .container {
        height: auto;
    }
    .scroll-area {
        max-height: 50vh;
    }
}
