/* ==========================================
   DOCTOR.CSS - Final Fixes (No Grid, Clean Header)
   ========================================== */


.active-profile-card {
    border-left: 4px solid var(--color-primary);
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.profile-details p {
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--color-text-secondary);
}

.profile-details span {
    color: white;
    font-weight: 600;
}

.input-card {
    background: var(--color-bg-card);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    flex-grow: 1;
}

/* --- CHAT --- */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
}

.chat-header {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: rgba(15, 23, 42, 0.3);
    min-height: 0;
    /* Essential for scrolling within flex container */

    /* Custom Scrollbar (Now global) */
}

@media (min-width: 1025px) {
    .doctor-context .layout-grid {
        position: relative;
    }

    .doctor-context .layout-main {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        left: calc(380px + 1.5rem);
        /* Sidebar width + gap */
        width: auto;
        /* Force strictly match sidebar height */
    }

    .chat-card {
        height: 100%;
    }
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.98rem;
    animation: fadeInUp 0.4s ease;
    word-wrap: break-word;
}

.user-message {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.system-message {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    outline: none;
}

.btn-send {
    background: var(--color-primary);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-send:hover {
    transform: scale(1.1);
}

/* --- VÝSLEDKY ANALÝZY --- */
.results-card {
    width: 100%;
    margin-top: 2rem;
    margin-bottom: 3rem;
    border-top: 6px solid var(--color-primary);
    animation: slideUpFade 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    padding: 0;
    overflow: hidden;
    /* Zde je důležité, aby karta měla pozadí, pokud header nemá */
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    /* Zaoblení rohů celé karty */
}

/* Header generovaný JS - OPRAVENO POZADÍ */
.results-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    /* Změněno z rgba(0,0,0,0.2) na transparent */
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.plant-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.plant-emoji {
    font-size: 2rem;
}

.plant-name-display {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-primary-light);
}

.btn-close-inline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.btn-close-inline:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error);
    transform: rotate(90deg);
}

.analysis-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.analysis-summary-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.summary-text-box {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
}

.data-row-inline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 1rem;
}

.data-row-inline span {
    color: var(--color-text-secondary);
    min-width: fit-content;
}

.data-row-inline strong {
    color: white;
}

/* OPRAVENO: Karty pod sebou (Flex Column místo Grid) */
.analysis-details-grid {
    display: flex;
    /* Změna z grid na flex */
    flex-direction: column;
    /* Prvky pod sebou */
    gap: 1.5rem;
}

.result-section-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
}

.section-icon {
    font-size: 1.3rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary-light);
}

.status-alerts {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border-left: 3px solid var(--color-accent);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-left: 3px solid var(--color-error);
}

.product-box {
    margin-top: auto;
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.product-link {
    background: var(--color-primary);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}

.product-link:hover {
    background: var(--color-primary-dark);
}

.doctor-tip-footer {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), transparent);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px dashed var(--color-primary);
}

.doctor-tip-footer p {
    margin: 0;
}

.tip-star {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.divider {
    height: 1px;
    background: var(--color-border);
    margin: 15px 0;
}

@media (max-width: 1024px) {
    .layout-grid {
        flex-direction: column;
    }

    .chat-card {
        height: 500px;
    }
}

/* Chat Typing Animation */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

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

/* Empty Storage Overlay */
.empty-storage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg-dark);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    border: 2px dashed var(--color-primary);
}

.empty-storage-btn {
    background: var(--color-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    margin-top: 15px;
    transition: transform 0.2s;
    cursor: pointer;
    display: inline-block;
}

.empty-storage-btn:hover {
    transform: scale(1.05);
}

/* Ensure relative positioning for panels that might hold overlays */
.left-panel,
.layout-sidebar {
    position: relative;
}