/* ========================================
   Professional Medical Theme - Clean White
   Colors: #1a365d (Deep Navy)
           #1a365d (Medical Blue)
           #4a5568 (Cool Gray)
           #ffffff (White)
           #f7fafc (Light Gray)
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    background: #ffffff;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    background: #ffffff;
    color: #2d3748;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
}

/* ===== Logo ===== */
.logo-container {
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.logo-container a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.logo {
    display: block;
    max-width: 200px;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

/* ===== Header / User Menu ===== */
.user-menu {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.user-info {
    color: #4a5568;
    font-size: 0.875rem;
    margin-right: auto;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f7fafc;
    color: #1a365d;
    text-decoration: none;
    border-radius: 0.375rem;
    border: 1px solid #cbd5e0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
}

.btn-primary {
    background: #1a365d;
    color: #ffffff;
    border: none;
}

.btn-primary:hover {
    background: #1a365d;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-danger,
.btn-error {
    background: #ed8936;
    color: #ffffff;
    border: none;
}

.btn-danger:hover,
.btn-error:hover {
    background: #dd6b20;
}

.copy-success {
    background: #2f855a !important;
    color: #ffffff !important;
    border-color: #2f855a !important;
}

/* ===== Query Section ===== */
.query-section {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
}

/* ===== Forms ===== */
form {
    background: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: all 0.2s;
}

form input:focus {
    outline: none;
    border-color: #1a365d;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

form button {
    width: 100%;
    padding: 0.75rem;
    background: #1a365d;
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

form button:hover {
    background: #1a365d;
}

/* ===== Textarea ===== */
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.2s;
}

textarea:focus {
    outline: none;
    border-color: #1a365d;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.25rem;
}

input.error,
textarea.error,
input:invalid,
textarea:invalid {
    border-color: #f6e05e !important;
    box-shadow: 0 0 0 3px rgba(246, 224, 94, 0.1) !important;
}

/* ===== Cards / Results ===== */
.card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
}

.card h3 {
    color: #1a365d;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.card h3:first-child {
    margin-top: 0;
}

/* ===== History Items ===== */
.history-item {
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #ffffff;
}

.history-header {
    background: #f7fafc;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-body {
    padding: 1rem;
}

.history-preview {
    display: block;
}

.history-full {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.history-full.show {
    display: block;
}

.user-query {
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid #1a365d;
}

.response-preview {
    color: #4a5568;
    font-size: 0.875rem;
}

.expand-link {
    color: #1a365d;
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: none;
    margin-left: 0.5rem;
}

.expand-link:hover {
    text-decoration: underline;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: #718096;
    transition: all 0.2s;
}

.tab.active {
    color: #1a365d;
    border-bottom: 2px solid #1a365d;
    margin-bottom: -0.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Messages ===== */
.error,
.success,
.warning,
.info {
    background: #f0f4f8;
    color: #1a365d;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border-left: 3px solid #1a365d;
    margin-top: 1rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.error::before,
.success::before,
.warning::before,
.info::before {
    content: none;
}

.disclaimer {
    background: #fef5e7;
    border-left: 4px solid #ecc94b;
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.75rem;
    color: #744210;
    border-radius: 0.375rem;
}

.loader {
    text-align: left;
    padding: 2rem;
    color: #718096;
}

.loader:after {
    content: " ⚙️";
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== Response text ===== */
.response-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

.response-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.response-text-full,
.query-text-full {
    background: #f7fafc;
}

/* ===== Footer ===== */
.footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    width: 100%;
    line-height: 1.8;
}

.footer-link {
    color: #1a365d;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
    display: inline;
    margin: 0 3px;
}

.footer-link:hover {
    color: #1a365d;
    text-decoration: underline;
}

.copyright {
    font-size: 0.7rem;
    color: #a0aec0;
    margin-top: 0.5rem;
    text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    body {
        background: #ffffff !important;
    }

    .container {
        padding: 1rem;
        background: #ffffff !important;
    }

    .logo-container {
        width: 100%;
        text-align: center !important;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.5rem 0 1rem;
        margin-bottom: 1rem;
    }

    .logo-container a {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .logo {
        display: block;
        margin: 0 auto;
        max-width: 160px;
        width: 100%;
        height: auto;
    }

    .user-menu {
        flex-wrap: wrap;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .query-section,
    .card,
    .history-item,
    .user-query,
    .response-text-full,
    .query-text-full,
    .user-menu,
    .history-header,
    .response-preview,
    .full-response {
        background: #ffffff !important;
    }

    .response-actions {
        flex-direction: column;
    }

    .response-actions .btn {
        width: 100%;
        text-align: center;
    }

    .footer {
        width: 100%;
        text-align: center !important;
        padding: 1.5rem 0 0 0;
        margin-top: 2rem;
        line-height: 1.8;
    }

    .footer-link {
        display: inline;
        padding: 0;
        margin: 0 3px;
        font-size: 0.875rem;
    }

    .copyright {
        text-align: center !important;
        display: block;
        margin-top: 0.5rem;
        font-size: 0.7rem;
    }
}

/* ===== Print ===== */
@media print {
    .tabs,
    .user-menu,
    .btn,
    .response-actions,
    .expand-link,
    textarea,
    #analyzeBtn,
    .char-counter,
    .disclaimer {
        display: none !important;
    }

    .full-response {
        display: block !important;
    }

    .container {
        padding: 0 !important;
    }
}
.history-response {
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.history-response h3 {
    margin: 1rem 0 0.5rem 0;
    padding: 0;
    color: #1a365d;
    font-size: 1rem;
    font-weight: 600;
}

.history-response h3:first-child {
    margin-top: 0;
}

.history-response .response-text {
    margin: 0 0 0.75rem 0;
    padding: 0;
    white-space: pre-wrap;
}

.history-response ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
}
