/* ══════════════════════════════════════════════════════════════════
   ZDRAVOTNÍ TÝM — Radim Branding v1.0
   Barvy: teal #5BA8A0, coral #F07D7E, bg #f8fafa
   Role ikony: ❤️ kardiolog, 🧴 dermatolog, 🦵 cévní, 🤝 pečovatel
   ══════════════════════════════════════════════════════════════════ */

/* ─── CONTAINER ─── */
.medical-module {
    padding: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.medical-module h2 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 16px;
}

/* ─── TABS ─── */
.medical-tabs {
    display: flex;
    gap: 4px;
    background: #f0f4f4;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.medical-tabs::-webkit-scrollbar {
    display: none;
}

.medical-tab {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.medical-tab:hover {
    color: #2d3748;
    background: rgba(255,255,255,0.5);
}

.medical-tab.active {
    background: white;
    color: #5BA8A0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ─── TÝM SEZNAM ─── */
.medical-team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.medical-member {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    transition: all 0.2s;
}

.medical-member:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.medical-member-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdfa;
    border-radius: 12px;
    flex-shrink: 0;
}

.medical-member-info {
    flex: 1;
}

.medical-member-name {
    font-weight: 700;
    font-size: 1rem;
    color: #2d3748;
}

.medical-member-role {
    font-size: 0.8rem;
    color: #5BA8A0;
    font-weight: 600;
}

.medical-member-spec {
    font-size: 0.8rem;
    color: #a0aec0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medical-member-actions {
    display: flex;
    gap: 6px;
}

.medical-member-actions button {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.medical-member-actions button:hover {
    border-color: #5BA8A0;
    color: #5BA8A0;
}

/* ─── PŘIDAT ČLENA ─── */
.medical-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: #f8fafa;
    border-radius: 12px;
    margin-top: 14px;
}

.medical-add-form input,
.medical-add-form select {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    flex: 1;
    min-width: 140px;
    transition: border-color 0.2s;
}

.medical-add-form input:focus,
.medical-add-form select:focus {
    outline: none;
    border-color: #5BA8A0;
}

.medical-add-form button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #5BA8A0, #4A9690);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.medical-add-form button:hover {
    box-shadow: 0 4px 12px rgba(91, 168, 160, 0.3);
}

/* ─── CHAT ─── */
.medical-chat {
    display: flex;
    flex-direction: column;
    height: 400px;
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.medical-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.medical-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.medical-chat-msg.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.medical-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f0fdfa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.medical-chat-bubble {
    background: #f7fafc;
    border-radius: 12px;
    padding: 10px 14px;
    position: relative;
}

.medical-chat-msg.own .medical-chat-bubble {
    background: #f0fdfa;
    border: 1px solid #b2dfdb;
}

.medical-chat-author {
    font-size: 0.7rem;
    font-weight: 700;
    color: #5BA8A0;
    margin-bottom: 2px;
}

.medical-chat-text {
    font-size: 0.9rem;
    color: #2d3748;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}

.medical-chat-time {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 4px;
}

.medical-chat-input {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafa;
}

.medical-chat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
}

.medical-chat-input input:focus {
    outline: none;
    border-color: #5BA8A0;
}

.medical-chat-input button {
    padding: 10px 16px;
    background: #5BA8A0;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

/* ─── DASHBOARD ─── */
.medical-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.medical-dash-card {
    background: white;
    border-radius: 14px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.medical-dash-card .dash-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.medical-dash-card .dash-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

.medical-dash-card .dash-label {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 2px;
}

/* ─── ALERTY ─── */
.medical-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.medical-alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border-left: 4px solid;
}

.medical-alert.info {
    background: #ebf8ff;
    border-left-color: #63b3ed;
}

.medical-alert.warning {
    background: #fffff0;
    border-left-color: #ecc94b;
}

.medical-alert.critical {
    background: #fff5f5;
    border-left-color: #fc8181;
}

.medical-alert-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.medical-alert-content {
    flex: 1;
}

.medical-alert-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2d3748;
}

.medical-alert-text {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 2px;
}

.medical-alert-time {
    font-size: 0.7rem;
    color: #a0aec0;
    margin-top: 4px;
}

.medical-alert-actions {
    display: flex;
    gap: 6px;
    align-self: center;
}

.medical-alert-actions button {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.medical-alert-actions button:active {
    transform: scale(0.96);
}

.medical-alert-actions button.accept {
    border-color: #48bb78;
    color: #22543d;
}

.medical-alert-actions button.escalate {
    border-color: #fc8181;
    color: #742a2a;
}

/* ─── KLINICKÉ POZNÁMKY ─── */
.medical-notes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.medical-note {
    padding: 14px 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #5BA8A0;
}

.medical-note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.medical-note-author {
    font-weight: 700;
    font-size: 0.85rem;
    color: #5BA8A0;
}

.medical-note-date {
    font-size: 0.7rem;
    color: #a0aec0;
}

.medical-note-type {
    font-size: 0.7rem;
    color: white;
    background: #5BA8A0;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 6px;
}

.medical-note-content {
    font-size: 0.9rem;
    color: #2d3748;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ─── CONSENT ─── */
.medical-consent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.consent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
}

.consent-item.granted {
    border-color: #c6f6d5;
    background: #f0fff4;
}

.consent-item.revoked {
    border-color: #fed7d7;
    background: #fff5f5;
}

/* ─── CONSENT TOGGLE ─── */
.consent-item[onclick] {
    cursor: pointer;
    transition: all 0.2s;
}

.consent-item[onclick]:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.consent-item.granted:hover {
    border-color: #fc8181;
}

.consent-item.revoked:hover {
    border-color: #48bb78;
}

/* ─── CARE PLAN ─── */
.medical-note ul {
    margin: 0;
    padding-left: 20px;
}

.medical-note ul li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ─── EMPTY STATE ─── */
.medical-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.medical-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* ─── LOADING ─── */
.medical-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
}

.medical-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(91,168,160,0.2);
    border-top: 3px solid #5BA8A0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ─── PHOTO UPLOAD ─── */
.medical-photo-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 2px dashed #5BA8A0;
    border-radius: 10px;
    cursor: pointer;
    justify-content: center;
    color: #5BA8A0;
    font-weight: 600;
    transition: all 0.2s;
}

.medical-photo-label:hover {
    background: #f0fdfa;
    border-color: #4A9690;
}

/* ─── TREND BAR CHART ─── */
.medical-trend-bar {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    padding: 8px 0;
}

.medical-trend-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.medical-trend-bar-fill {
    width: 100%;
    max-width: 24px;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

/* ─── MOBILE ─── */
@media (max-width: 1024px) {
    .medical-module { padding: 8px; }
    .medical-module h2 { font-size: 1.25rem; margin-bottom: 8px; }

    /* Tabs: horizontal scroll, larger touch targets */
    .medical-tabs { gap: 3px; padding: 3px; margin-bottom: 14px; }
    .medical-tab { padding: 8px 12px; font-size: 0.75rem; min-height: 36px; }

    /* Team member cards */
    .medical-member { padding: 10px 12px; gap: 10px; }
    .medical-member-icon { width: 40px; height: 40px; font-size: 1.5rem; }
    .medical-member-name { font-size: 0.9rem; }
    .medical-member-actions { flex-direction: column; gap: 4px; }
    .medical-member-actions button { padding: 8px 10px; font-size: 0.8rem; min-height: 36px; }

    /* Add form */
    .medical-add-form { flex-direction: column; padding: 10px; }
    .medical-add-form input,
    .medical-add-form select { min-width: 0; width: 100%; box-sizing: border-box; }
    .medical-add-form button { width: 100%; }

    /* Chat — ensure input visible below header+tabs+role (≈280px) */
    .medical-chat { height: calc(100vh - 320px); min-height: 220px; max-height: 350px; }
    .medical-chat-messages { padding: 10px; }
    .medical-chat-msg { max-width: 90%; }
    .medical-chat-input { padding: 8px 10px; }
    .medical-chat-input input { padding: 10px 12px; font-size: 0.85rem; }
    .medical-chat-input button { padding: 10px 14px; }

    /* Dashboard cards: 2 per row */
    .medical-dashboard { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .medical-dash-card { padding: 14px 10px; }
    .medical-dash-card .dash-value { font-size: 1.2rem; }
    .medical-dash-card .dash-icon { font-size: 1.6rem; }

    /* Alerts */
    .medical-alert { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
    .medical-alert-actions { width: 100%; justify-content: flex-start; margin-top: 4px; }
    .medical-alert-actions button { padding: 8px 12px; font-size: 0.75rem; min-height: 36px; }

    /* Notes */
    .medical-note { padding: 10px 12px; }
    .medical-note-header { flex-direction: column; gap: 2px; }

    /* Consent grid: 1 column, larger touch */
    .medical-consent-grid { grid-template-columns: 1fr; }
    .consent-item { padding: 12px 14px; min-height: 44px; font-size: 0.85rem; }

    /* Photo upload */
    .medical-photo-label { padding: 14px; }

    /* Care plan textareas */
    .medical-module textarea {
        width: 100% !important;
        box-sizing: border-box !important;
        font-size: 0.9rem !important;
    }

    /* Trend chart smaller */
    .medical-trend-bar { height: 80px; }
}

/* ─── SMALL MOBILE (≤375px) ─── */
@media (max-width: 375px) {
    .medical-tab { padding: 6px 8px; font-size: 0.7rem; }
    .medical-dashboard { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .medical-dash-card { padding: 10px 6px; }
    .medical-dash-card .dash-value { font-size: 1rem; }
    .medical-alert-actions { flex-wrap: wrap; }
}
