/* Modern Medical Professional Stylesheet */
/* Shared across Baby Registration + Counselling Record */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-bg: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* ============================================================
   NAVIGATION BAR
   ============================================================ */

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
    padding: 0 30px;
    height: 56px;
    gap: 20px;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    overflow-x: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    height: 100%;
    white-space: nowrap;
}

.nav-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    border-bottom-color: #818cf8;
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */

.page-layout {
    display: flex;
    min-height: calc(100vh - 56px - 40px);
}

.sidebar {
    width: 200px;
    min-width: 200px;
    background: #1e293b;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-left-color: #818cf8;
}

.sidebar-link .sb-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.page-content {
    flex: 1;
    overflow-x: auto;
}

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

    .sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px 0;
    }

    .sidebar-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    .sidebar-link.active {
        border-bottom-color: #818cf8;
        border-left-color: transparent;
    }
}

/* ============================================================
   HEADER
   ============================================================ */

header {
    background: var(--gradient-primary);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.05rem;
    opacity: 0.95;
    font-weight: 300;
}

.header-counselling {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    color: white;
    padding: 24px 40px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 20px;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-badge.online {
    background: #ffffff;
    color: #2e7d32;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.status-badge.offline {
    background: #ffffff;
    color: #c62828;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
}

.form-version {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ============================================================
   VOICE RECORDING SECTION
   ============================================================ */

.voice-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 30px 40px;
    border-bottom: 2px solid var(--border-color);
}

.voice-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.1rem;
}

.btn-record {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Status indicator */
.status-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--danger-color);
    font-weight: 600;
    animation: pulse 2s infinite;
}

.status-indicator.recording {
    display: flex;
}

.status-indicator::before {
    content: '⏺';
    font-size: 1.2rem;
}

.status-indicator-inline {
    color: var(--danger-color);
    font-weight: 600;
    font-size: 0.85rem;
    animation: pulse 2s infinite;
    min-height: 20px;
}

.status-indicator-inline.recording {
    display: inline;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Transcript Box */
.transcript-box {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.transcript-box h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.transcript-content {
    min-height: 80px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

.transcript-mini {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.6;
}

/* Live transcription preview */
.live-text {
    color: var(--text-primary);
}

.final-text {
    color: var(--text-primary);
}

.interim-text {
    color: #999;
    font-style: italic;
}

.live-cursor {
    color: #2196F3;
    font-weight: bold;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.live-preview-text {
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

.refining-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2196F3;
    font-size: 0.85rem;
    font-style: italic;
}

.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #2196F3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ============================================================
   FORMS
   ============================================================ */

form {
    padding: 40px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.form-panel h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 0.92rem;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Auto-filled field highlighting */
.auto-filled.filled {
    background: linear-gradient(to right, #dbeafe 0%, #eff6ff 100%);
    border-color: var(--primary-color);
    animation: fillHighlight 0.5s ease;
}

@keyframes fillHighlight {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.calculated {
    background: #f3f4f6;
    cursor: not-allowed;
}

.input-with-action {
    display: flex;
    gap: 8px;
}

.input-with-action input {
    flex: 1;
}

.field-hint {
    display: block;
    font-size: 0.8rem;
    margin-top: 4px;
    color: var(--text-secondary);
}

.field-hint.success {
    color: var(--success-color);
    font-weight: 600;
}

.field-hint.error {
    color: var(--danger-color);
    font-weight: 600;
}

.field-hint.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.field-hint.loading {
    color: var(--primary-color);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.form-actions-counselling {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding: 20px 40px 30px;
    border-top: 2px solid var(--border-color);
    margin: 0 40px;
}

/* ============================================================
   COUNSELLING-SPECIFIC SECTIONS
   ============================================================ */

.section-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #14b8a6;
}

.patient-id-section {
    padding: 30px 40px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-bottom: 2px solid var(--border-color);
}

.patient-id-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.session-section {
    padding: 25px 40px;
    border-bottom: 2px solid var(--border-color);
}

.session-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
}

/* Counselling Content Panels */
.counselling-content {
    padding: 30px 40px;
}

.counselling-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.counselling-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s;
}

.counselling-panel:hover {
    border-color: #a7f3d0;
}

.panel-header {
    margin-bottom: 16px;
}

.panel-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.voice-record-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.counselling-textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
}

/* Video Notice */
.video-notice {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    padding: 12px 20px;
    margin: 0 40px 20px;
    font-size: 0.9rem;
    color: #92400e;
    text-align: center;
    font-weight: 500;
}

/* Attender Table */
.attender-section {
    padding: 25px 40px;
}

.attender-table {
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.attender-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.attender-header {
    background: #0f766e;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.attender-header>div {
    padding: 12px 16px;
}

.attender-row:not(.attender-header) {
    border-top: 1px solid var(--border-color);
}

.attender-row:not(.attender-header) .form-group {
    margin: 0;
    padding: 8px 12px;
}

.attender-row:not(.attender-header) input,
.attender-row:not(.attender-header) select {
    border: 1px solid var(--border-color);
}

/* ============================================================
   VISIT HISTORY
   ============================================================ */

.visit-history-section {
    padding: 25px 40px 30px;
    background: var(--bg-primary);
    border-top: 2px solid var(--border-color);
}

.visit-history-container {
    max-height: 400px;
    overflow-y: auto;
}

.visit-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Visit History Table */
.visit-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.visit-history-table thead th {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    white-space: nowrap;
    border: none;
}

.visit-history-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.visit-history-table tbody tr:hover {
    background: #f0fdfa;
}

.visit-history-table tbody tr:last-child {
    border-bottom: none;
}

.visit-history-table tbody td {
    padding: 10px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.visit-history-table tbody td strong {
    font-weight: 600;
}

.visit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visit-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.visit-card:hover {
    border-color: #14b8a6;
    box-shadow: 0 4px 16px rgba(20, 184, 166, 0.12);
    transform: translateY(-2px);
}

.visit-card-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.visit-baby-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    min-width: 120px;
}

.visit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.visit-badge-date {
    background: #dbeafe;
    color: #1e40af;
}

.visit-badge-time {
    background: #e0e7ff;
    color: #3730a3;
}

.visit-badge-gender {
    background: #fce7f3;
    color: #9d174d;
}

.visit-badge-ip {
    background: #d1fae5;
    color: #065f46;
}

.visit-badge-uhid {
    background: #f3e8ff;
    color: #6b21a8;
}

.visit-badge-doctor {
    background: #fef3c7;
    color: #92400e;
}

.visit-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}

.btn-action-view {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1d4ed8;
}

.btn-action-view:hover {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.15);
    transform: translateY(-1px);
}

.btn-action-print {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #047857;
}

.btn-action-print:hover {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.15);
    transform: translateY(-1px);
}

.btn-action-delete {
    background: transparent;
    color: #9ca3af;
    padding: 7px 10px;
    margin-left: auto;
}

.btn-action-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

.hint-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

.hint-text.error {
    color: var(--danger-color);
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin: 20px 40px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.hidden {
    display: none !important;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
    background: #1e293b;
    color: white;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    border-radius: var(--radius);
}

footer p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.status {
    opacity: 0.8;
}

#backendStatus {
    font-weight: 700;
}

#backendStatus.online {
    color: #10b981;
}

#backendStatus.offline {
    color: #ef4444;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 1024px) {

    .form-grid,
    .counselling-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .patient-id-grid {
        grid-template-columns: 1fr 1fr;
    }

    .session-grid {
        grid-template-columns: 1fr 1fr;
    }

    .visit-card-info {
        gap: 8px;
    }

    .visit-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .nav-bar {
        flex-direction: column;
        height: auto;
        padding: 12px 20px;
        gap: 8px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .patient-id-grid,
    .session-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    header,
    .header-counselling {
        padding: 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .voice-section,
    form,
    .patient-id-section,
    .session-section,
    .counselling-content,
    .attender-section,
    .visit-history-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .proforma-row {
        flex-direction: column;
    }

    .prompt-card {
        flex: none;
    }

    .form-actions,
    .form-actions-counselling {
        flex-direction: column;
        margin: 0 20px;
        padding: 20px 0;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .header-top {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .attender-row {
        grid-template-columns: 1fr;
    }
}

/* Hide number spinners */
#headCircumference::-webkit-outer-spin-button,
#headCircumference::-webkit-inner-spin-button,
#birthLength::-webkit-outer-spin-button,
#birthLength::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#headCircumference,
#birthLength {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* ============================================================
   VOICE FORM SECTIONS (shared across voice dictation forms)
   ============================================================ */

.voice-sections {
    margin-top: 20px;
}

.voice-sections .section-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.voice-section-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.voice-section-card.recording-active {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.voice-section-card.transcribing {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.voice-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.voice-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-hint-sm {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.btn-voice {
    background: linear-gradient(135deg, #4CAF50, #43A047);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-voice:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-voice-stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-voice-stop:hover {
    transform: scale(1.05);
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #ef4444;
    font-weight: 500;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.voice-section-card textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.voice-section-card textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================================
   PROFORMA TWO-COLUMN LAYOUT
   ============================================================ */

.proforma-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.prompt-card {
    flex: 0 0 45%;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 16px 20px;
}

.prompt-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #991b1b;
    margin-bottom: 10px;
}

.prompt-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prompt-card ul li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #374151;
}

.prompt-card ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #dc2626;
    font-weight: 700;
}

.prompt-card ul li strong {
    color: #111827;
}

.dictation-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dictation-area textarea {
    flex: 1;
    min-height: 120px;
}

.form-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 0;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
}

.status-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 10px;
    text-align: center;
    transition: opacity 0.3s;
}

.status-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-message.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Medication row styles for discharge forms */
.med-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px 100px 100px auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.med-row input,
.med-row select {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

.med-row input:focus {
    border-color: var(--primary-color);
}

.btn-remove-med {
    background: none;
    border: none;
    color: #e53935;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
}

@media (max-width: 768px) {
    .voice-section-header {
        flex-direction: column;
        gap: 4px;
    }

    .med-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   RECORDS LIST — Collapsible tables for saved entries
   ============================================================ */

.records-list-section {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
    overflow: hidden;
}

.records-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    color: #fff;
    user-select: none;
}

.records-list-header .section-title {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.records-list-body {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.records-list-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.records-table thead th {
    background: #f1f3f5;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 1;
}

.records-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.records-table tbody tr:hover {
    background: #f8f9ff;
}

.records-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.records-table tbody tr:nth-child(even):hover {
    background: #f0f1ff;
}

.records-table td {
    padding: 8px 12px;
    color: #333;
}

.loading-row {
    text-align: center;
    padding: 20px !important;
    color: #999;
    font-style: italic;
}

.btn-edit {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-edit:hover {
    background: #5a6fd6;
}

.btn-print {
    background: #20c997;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 4px;
    transition: background 0.2s;
}

.btn-print:hover {
    background: #12b886;
}

.btn-delete {
    background: transparent;
    color: #999;
    border: 1.5px solid #ddd;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 4px;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.no-records-row td {
    text-align: center;
    padding: 20px !important;
    color: #999;
}

/* Edit mode indicator */
.edit-mode-banner {
    background: linear-gradient(135deg, #ffd43b, #fab005);
    color: #333;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.edit-mode-banner .btn-cancel-edit {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ============================================================
   PRINT STYLES — Clean printable layout
   ============================================================ */

@media print {

    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    /* Hide non-printable elements */
    .nav-bar,
    footer,
    .form-actions,
    .form-actions-bar,
    .voice-controls,
    .recording-indicator,
    .btn-voice,
    .btn-voice-stop,
    .records-list-section,
    .edit-mode-banner,
    .status-message,
    .btn,
    button,
    .header-badge,
    .input-with-action button,
    .records-list-header,
    #successMessage,
    #errorMessage,
    .field-hint,
    .section-hint,
    .section-hint-sm,
    .prompt-card,
    .subtitle,
    .voice-sections>.section-title {
        display: none !important;
    }

    /* Dictation area full width */
    .proforma-row {
        display: block;
    }

    .dictation-area {
        width: 100%;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 8pt;
        line-height: 1.3;
        margin: 0;
        padding: 0;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    /* Compact header */
    header,
    .header-counselling {
        padding: 2px 0;
        border-bottom: 1.5px solid #000;
        margin-bottom: 4px;
    }

    header h1,
    .header-counselling h1 {
        font-size: 11pt;
        color: #000;
        margin: 0;
    }

    /* Compact patient ID section */
    .patient-id-section {
        padding: 4px 8px !important;
        margin-bottom: 4px !important;
    }

    .patient-id-grid,
    .form-row {
        gap: 1px 8px;
    }

    .form-group {
        margin-bottom: 0;
    }

    .form-group label {
        font-size: 7pt;
        font-weight: bold;
        margin-bottom: 0;
    }

    input,
    select {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0;
        font-size: 8pt;
        height: auto;
        min-height: auto;
    }

    /* Single-column voice sections */
    .voice-sections {
        padding: 0 !important;
    }

    .voice-section-card {
        border: none;
        border-bottom: 0.5px solid #ccc;
        margin-bottom: 2px;
        padding: 2px 4px;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .voice-section-header {
        margin: 0;
        padding: 0;
        border: none;
    }

    .voice-section-header h3 {
        font-size: 8pt;
        font-weight: bold;
        margin: 0;
        padding: 0;
        color: #000;
    }

    textarea {
        border: none !important;
        box-shadow: none !important;
        resize: none;
        font-size: 8pt;
        line-height: 1.3;
        padding: 1px 0;
        margin: 0;
        min-height: auto !important;
        height: auto !important;
        overflow: visible;
        white-space: pre-wrap;
        color: #000 !important;
        background: transparent !important;
    }

    label {
        font-weight: bold;
        font-size: 7pt;
    }
}