/* ============================================================
   NICU DASHBOARD — STYLES
   ============================================================ */

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0ea5e9 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.25);
}

.dashboard-title h1 {
    font-size: 1.6rem;
    color: white;
    margin-bottom: 6px;
}

.dashboard-title .subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ============================================================
   ROOM SECTIONS
   ============================================================ */

.room-section {
    margin-bottom: 28px;
}

.room-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 10px 10px 0 0;
    color: white;
}

.room-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.room-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   BED GRID
   ============================================================ */

.bed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 0 0 10px 10px;
    border: 1px solid var(--border-color);
    border-top: none;
}

/* ============================================================
   BED CARDS
   ============================================================ */

.bed-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.bed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Empty bed */
.bed-card.empty {
    border-style: dashed;
    border-color: #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    cursor: pointer;
}

.bed-card.empty:hover {
    border-color: var(--accent-color);
    background: #f0f7ff;
}

.bed-empty-icon {
    font-size: 2.5rem;
    color: #bbb;
    margin-bottom: 8px;
}

.bed-empty-label {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 12px;
}

.bed-empty-bed-num {
    font-size: 0.8rem;
    color: #aaa;
    font-weight: 600;
    margin-bottom: 4px;
}

.btn-admit {
    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-admit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* Occupied bed — gender colors */
.bed-card.male {
    border-color: #64B5F6;
    border-left: 4px solid #2196F3;
}

.bed-card.female {
    border-color: #F48FB1;
    border-left: 4px solid #E91E63;
}

/* Bed card header */
.bed-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 0.85rem;
}

.bed-card.male .bed-card-header {
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    color: #1565C0;
}

.bed-card.female .bed-card-header {
    background: linear-gradient(135deg, #FCE4EC, #F8BBD0);
    color: #AD1457;
}

.bed-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: inherit;
    transition: background 0.2s;
}

.bed-menu-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Bed card body */
.bed-card-body {
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.baby-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.bed-card.male .baby-avatar {
    background: linear-gradient(135deg, #BBDEFB, #90CAF9);
}

.bed-card.female .baby-avatar {
    background: linear-gradient(135deg, #F8BBD0, #F48FB1);
}

.baby-info {
    flex: 1;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.baby-info .info-row {
    display: flex;
    gap: 4px;
}

.baby-info .info-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
}

.baby-info .info-value {
    color: var(--text-secondary);
}

/* Bed card footer — device icons */
.bed-card-footer {
    padding: 6px 12px 10px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
}

.device-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #E8F5E9;
    color: #2E7D32;
    font-size: 0.85rem;
    cursor: default;
    position: relative;
}

.device-icon[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    pointer-events: none;
}

.device-icon.inactive {
    background: #f5f5f5;
    color: #ccc;
}

/* ============================================================
   BED MENU DROPDOWN
   ============================================================ */

.bed-menu {
    position: fixed;
    z-index: 9000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    overflow: hidden;
    animation: menuSlide 0.15s ease-out;
}

@keyframes menuSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bed-menu.hidden {
    display: none;
}

.bed-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.bed-menu-item:last-child {
    border-bottom: none;
}

.bed-menu-item:hover {
    background: #f0f7ff;
    color: var(--accent-color);
}

.menu-icon {
    font-size: 1.1rem;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px 20px;
    border-top: 1px solid var(--border-color);
}

/* Override .btn-outline inside modals (since header makes them white) */
.modal-footer .btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
    backdrop-filter: none;
}

.modal-footer .btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

/* Form groups in modal */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.patient-preview {
    margin-top: 10px;
    padding: 12px;
    border-radius: 8px;
    background: #f0f7ff;
    border: 1px solid #BBDEFB;
    font-size: 0.85rem;
    line-height: 1.6;
}

.patient-preview.hidden {
    display: none;
}

.patient-preview .preview-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

/* Settings modal — room config rows */
.room-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.room-config-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.room-config-row input {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    width: 140px;
}

.room-config-row input[type="number"] {
    width: 70px;
    text-align: center;
}

.room-config-row input:focus {
    border-color: var(--accent-color);
}

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

.btn-remove-room:hover {
    background: #FFEBEE;
}

/* ============================================================
   DISCHARGE BUTTON
   ============================================================ */

.bed-menu-item.discharge {
    color: #e53935;
}

.bed-menu-item.discharge:hover {
    background: #FFEBEE;
    color: #c62828;
}

/* ============================================================
   DISCHARGE / TRANSFER MODAL
   ============================================================ */

.discharge-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.discharge-option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.discharge-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.discharge-option-card.discharge-home {
    border-color: #a7f3d0;
}

.discharge-option-card.discharge-home:hover {
    background: #ecfdf5;
    border-color: #34d399;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}

.discharge-option-card.discharge-transfer {
    border-color: #bfdbfe;
}

.discharge-option-card.discharge-transfer:hover {
    background: #eff6ff;
    border-color: #60a5fa;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.15);
}

.discharge-option-icon {
    font-size: 2rem;
}

.discharge-option-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.discharge-option-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ============================================================
   DRAG-AND-DROP BED MOVE
   ============================================================ */

.bed-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    box-shadow: none;
}

.bed-card.empty.drop-target {
    border-color: #34d399;
    border-style: dashed;
    background: #ecfdf5;
    animation: pulseGlow 1.2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.25);
    }
}

.bed-card.empty.drag-over {
    border-color: #10b981;
    border-style: solid;
    background: #d1fae5;
    transform: scale(1.03);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    animation: none;
}

.bed-card[draggable="true"] {
    cursor: grab;
}

.bed-card[draggable="true"]:active {
    cursor: grabbing;
}

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

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .bed-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
        padding: 10px;
    }

    .bed-card-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}