/**
 * NAFH ISBAR Smart Handover System - Styles v2.9.0
 * Mobile-first design optimized for smartphone use.
 */

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.isbar-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    z-index: 99999;
    font-size: 0.9em;
    display: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    max-width: 90vw;
    text-align: center;
}
.isbar-toast-success { background: #166534; }
.isbar-toast-error { background: #dc2626; }

/* ==========================================
   MAIN LAYOUT
   ========================================== */
.isbar-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.isbar-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.isbar-section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #334155;
    margin: 16px 0 10px;
}

.isbar-subtitle {
    font-size: 0.85em;
    color: #64748b;
    margin: 4px 0 12px;
}

/* ==========================================
   NOTIFICATIONS BADGE
   ========================================== */
.isbar-notif-btn {
    position: relative;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.isbar-notif-btn:hover { background: #dbeafe; }

.isbar-notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 18px;
    text-align: center;
}

/* ==========================================
   ACTION BUTTONS
   ========================================== */
.isbar-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.isbar-action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.isbar-btn-primary {
    background: #1e40af;
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s;
}
.isbar-btn-primary:hover { background: #1e3a8a; }
.isbar-btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.isbar-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s;
}
.isbar-btn-secondary:hover { background: #e2e8f0; }

.isbar-btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 6px;
    border: none;
    background: #1e40af;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
}
.isbar-btn-small:hover { background: #1e3a8a; }
.isbar-btn-small:disabled { background: #94a3b8; }

.isbar-btn-voice-small {
    background: #059669;
    padding: 6px 10px;
}
.isbar-btn-voice-small:hover { background: #047857; }

.isbar-back-btn {
    background: none;
    border: none;
    color: #1e40af;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0;
    margin-bottom: 8px;
}
.isbar-back-btn:hover { text-decoration: underline; }

.isbar-submit-btn {
    width: 100%;
    padding: 14px;
    font-size: 1em;
    margin-top: 16px;
}

/* ==========================================
   SEARCH & INPUTS
   ========================================== */
.isbar-search-wrap {
    margin-bottom: 12px;
}

.isbar-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.isbar-input:focus { border-color: #1e40af; }

.isbar-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    outline: none;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    box-sizing: border-box;
}
.isbar-textarea:focus { border-color: #1e40af; }

/* ==========================================
   PATIENT LIST
   ========================================== */
.isbar-patient-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.isbar-patient-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.isbar-patient-card:hover {
    border-color: #1e40af;
    box-shadow: 0 2px 8px rgba(30,64,175,0.1);
}
.isbar-patient-card:active { transform: scale(0.98); }

.isbar-patient-name {
    font-weight: 600;
    font-size: 0.95em;
    color: #1e293b;
    margin-bottom: 3px;
}
.isbar-patient-info {
    font-size: 0.8em;
    color: #64748b;
}
.isbar-patient-diag {
    font-size: 0.8em;
    color: #059669;
    margin-top: 3px;
    font-weight: 500;
}

/* ==========================================
   MODE CHOICE
   ========================================== */
.isbar-mode-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.isbar-mode-btn {
    padding: 18px 16px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #1e40af;
    background: #eff6ff;
    color: #1e40af;
    transition: all 0.2s;
    text-align: center;
}
.isbar-mode-btn:hover { background: #dbeafe; }
.isbar-mode-btn:active { transform: scale(0.98); }

.isbar-mode-update {
    border-color: #059669;
    background: #ecfdf5;
    color: #059669;
}
.isbar-mode-update:hover { background: #d1fae5; }

/* ==========================================
   FORM
   ========================================== */
.isbar-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.isbar-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.isbar-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #475569;
}

/* ==========================================
   VOICE SECTION
   ========================================== */
.isbar-voice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: 12px 0;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.isbar-voice-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #1e40af;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(30,64,175,0.3);
}
.isbar-voice-btn:hover { transform: scale(1.05); }
.isbar-voice-btn:active { transform: scale(0.95); }

.isbar-voice-btn.isbar-recording {
    background: #dc2626;
    animation: isbar-pulse 1.5s infinite;
    box-shadow: 0 4px 20px rgba(220,38,38,0.4);
}

@keyframes isbar-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
    50% { box-shadow: 0 0 0 15px rgba(220,38,38,0); }
}

.isbar-voice-status {
    margin-top: 10px;
    font-size: 0.85em;
    color: #64748b;
    font-weight: 500;
}

/* ==========================================
   TRANSCRIPT AREA
   ========================================== */
.isbar-transcript-area {
    margin: 12px 0;
}

.isbar-process-btn {
    margin-top: 10px;
    width: 100%;
}

/* ==========================================
   ISBAR SECTIONS
   ========================================== */
.isbar-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.isbar-section-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    transition: all 0.2s;
    position: relative;
}
.isbar-section-card.isbar-section-filled {
    border-color: #059669;
    background: #f0fdf4;
}

.isbar-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.isbar-section-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e40af;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85em;
    flex-shrink: 0;
}
.isbar-section-filled .isbar-section-letter { background: #059669; }

.isbar-section-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
}

.isbar-section-check {
    color: #059669;
    font-weight: 700;
    font-size: 1.1em;
    margin-left: auto;
}

.isbar-section-desc {
    font-size: 0.75em;
    color: #94a3b8;
    margin-left: 36px;
}

.isbar-section-content {
    font-size: 0.85em;
    color: #334155;
    margin-top: 6px;
    margin-left: 36px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.isbar-section-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75em;
    cursor: pointer;
}
.isbar-section-edit-btn:hover { background: #e2e8f0; }

/* ==========================================
   FOLLOW-UP AREA
   ========================================== */
.isbar-followup {
    margin: 12px 0;
}

.isbar-complete-badge {
    background: #dcfce7;
    color: #166534;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9em;
    text-align: center;
}

.isbar-incomplete-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 10px;
}

.isbar-followup-card {
    background: #fff;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.isbar-followup-section {
    font-weight: 600;
    font-size: 0.85em;
    color: #92400e;
    margin-bottom: 3px;
}

.isbar-followup-question {
    font-size: 0.85em;
    color: #334155;
    margin-bottom: 8px;
}

.isbar-followup-answer {
    display: flex;
    gap: 6px;
    align-items: center;
}
.isbar-followup-answer .isbar-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.85em;
}

/* ==========================================
   ACTION BAR
   ========================================== */
.isbar-action-bar {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.isbar-action-bar button {
    flex: 1;
    min-width: 130px;
}

/* ==========================================
   MODAL
   ========================================== */
.isbar-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.isbar-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.isbar-modal-content h3 {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: #1e293b;
}

.isbar-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.isbar-modal-btns button { flex: 1; }

/* ==========================================
   DOCTOR LIST (in modal)
   ========================================== */
.isbar-doctor-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.isbar-doctor-card {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.isbar-doctor-card:hover { border-color: #1e40af; background: #eff6ff; }

.isbar-doctor-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
}
.isbar-doctor-eid {
    font-size: 0.78em;
    color: #64748b;
}

/* ==========================================
   HISTORY
   ========================================== */
.isbar-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.isbar-history-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.isbar-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.isbar-history-patient {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
}

.isbar-history-status {
    font-size: 0.7em;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
}
.isbar-status-draft { background: #f3f4f6; color: #6b7280; }
.isbar-status-sent { background: #dbeafe; color: #1e40af; }
.isbar-status-confirmed { background: #dcfce7; color: #166534; }

.isbar-history-meta {
    font-size: 0.78em;
    color: #64748b;
    margin-top: 2px;
}

.isbar-history-btns {
    margin-top: 8px;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */
.isbar-notif-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.isbar-notif-card {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    padding: 12px 14px;
}

.isbar-notif-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #92400e;
}
.isbar-notif-patient {
    font-size: 0.82em;
    color: #334155;
    margin-top: 3px;
}
.isbar-notif-time {
    font-size: 0.75em;
    color: #64748b;
    margin-top: 2px;
}
.isbar-notif-btns {
    margin-top: 8px;
}

/* ==========================================
   REVIEW VIEW
   ========================================== */
.isbar-review-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.isbar-review-row {
    font-size: 0.85em;
    color: #334155;
    margin: 3px 0;
}

.isbar-review-section {
    margin: 8px 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.isbar-review-section-title {
    font-weight: 600;
    font-size: 0.85em;
    color: #1e40af;
    margin-bottom: 4px;
}

.isbar-review-section-content {
    font-size: 0.85em;
    color: #334155;
    line-height: 1.4;
    white-space: pre-wrap;
}

.isbar-review-sig {
    font-size: 0.82em;
    color: #475569;
    margin: 4px 0;
    font-weight: 500;
}

/* ==========================================
   PRINT VIEW
   ========================================== */
.isbar-print-btns {
    display: flex;
    gap: 10px;
    margin: 12px 0;
    flex-wrap: wrap;
}
.isbar-print-btns button { flex: 1; min-width: 130px; }

.isbar-print-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    margin-top: 12px;
}

.isbar-preview-summary {
    font-size: 0.85em;
    color: #475569;
}

/* ==========================================
   INFO BOX
   ========================================== */
.isbar-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    margin-bottom: 12px;
}

/* ==========================================
   LOADING & EMPTY STATES
   ========================================== */
.isbar-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.9em;
}

.isbar-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 0.9em;
}

/* ==========================================
   RESPONSIVE - Tablet
   ========================================== */
@media (min-width: 768px) {
    .isbar-actions {
        max-width: 400px;
    }
    .isbar-form {
        max-width: 500px;
    }
    .isbar-mode-choice {
        flex-direction: row;
    }
    .isbar-mode-btn {
        flex: 1;
    }
    .isbar-sections {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .isbar-section-card:last-child {
        grid-column: span 2;
    }
}

/* ==========================================
   RESPONSIVE - Desktop
   ========================================== */
@media (min-width: 1024px) {
    .isbar-sections {
        grid-template-columns: repeat(3, 1fr);
    }
    .isbar-section-card:nth-child(4),
    .isbar-section-card:nth-child(5) {
        grid-column: span 1;
    }
    .isbar-section-card:last-child {
        grid-column: span 1;
    }
}
