/* ICU Nutrition Engine - Clinical Console */
/* Complete Stylesheet */

:root {
    --primary: #003366;
    --primary-dark: #002244;
    --primary-light: #004488;
    --danger: #CC0000;
    --warning: #FF9900;
    --success: #006633;
    --info: #0066CC;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --font-sans: 'Liberation Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-arabic: 'Noto Naskh Arabic', 'Traditional Arabic', serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-sm: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--primary);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.header-content {
    flex: 1;
}

.app-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.app-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

.btn-install {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-install:hover {
    background: #005522;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 28px;
    color: var(--gray-900);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* Patient Grid */
.patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.patient-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.patient-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.patient-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-200);
}

.patient-code {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
}

.patient-days {
    background: var(--gray-100);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
}

.patient-card-body {
    margin-bottom: 15px;
}

.patient-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.patient-info .label {
    color: var(--gray-600);
}

.patient-card-footer {
    display: flex;
    gap: 10px;
}

.patient-card-footer button {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    color: var(--gray-400);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--gray-600);
    margin-bottom: 30px;
}

/* Card */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    color: var(--gray-900);
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Workspace Grid */
.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-item .label {
    font-size: 12px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.status-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.gate-status h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--gray-700);
}

.gate-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.gate-item {
    padding: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gate-item.gate-negative {
    background: #d4edda;
    color: #155724;
}

.gate-item.gate-positive {
    background: #f8d7da;
    color: #721c24;
}

.gate-label {
    font-weight: 600;
    font-size: 12px;
}

.gate-value {
    font-size: 11px;
    text-transform: uppercase;
}

.empty-status {
    text-align: center;
    padding: 40px 20px;
}

.empty-status p {
    color: var(--gray-600);
    margin-bottom: 20px;
}

/* Action List */
.action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    color: var(--gray-800);
}

.action-button:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.action-button svg {
    color: var(--primary);
}

.action-button.danger:hover {
    border-color: var(--danger);
}

.action-button.danger svg {
    color: var(--danger);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-content {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-date {
    font-size: 13px;
    color: var(--gray-600);
}

.timeline-body strong {
    color: var(--primary);
}

.timeline-meta {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 5px;
}

/* Forms */
.reassessment-form {
    max-width: 800px;
}

.form-section {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

.section-help {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 20px;
}

.gate-assessment {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gate-item {
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.gate-label {
    display: block;
    margin-bottom: 10px;
}

.gate-label strong {
    color: var(--primary);
    display: block;
    margin-bottom: 5px;
}

.help-text {
    display: block;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: normal;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--gray-100);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Settings */
.settings-grid {
    display: grid;
    gap: 20px;
}

/* About */
.about-content {
    max-width: 800px;
}

.about-content h2 {
    color: var(--primary);
    margin-bottom: 10px;
}

.about-content .subtitle {
    font-size: 18px;
    color: var(--gray-600);
    margin-bottom: 30px;
}

.about-content h3 {
    font-size: 20px;
    color: var(--gray-900);
    margin-top: 30px;
    margin-bottom: 15px;
}

.about-content h4 {
    font-size: 16px;
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.disclaimer {
    background: #fff3cd;
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
    margin: 30px 0;
}

.version-info {
    background: var(--gray-50);
    padding: 15px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 30px;
}

/* Footer */
.app-footer {
    background: var(--gray-800);
    color: white;
    padding: 30px 20px;
    text-align: center;
    font-size: 14px;
}

.app-footer p {
    margin: 8px 0;
    opacity: 0.9;
}

.footer-meta {
    font-size: 12px;
    margin-top: 15px;
}

.footer-meta a {
    color: var(--primary-light);
    text-decoration: none;
}

.footer-meta a:hover {
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    min-width: 300px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--info);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 20px 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .patient-grid {
        grid-template-columns: 1fr;
    }
    
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .gate-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
    }
    
    .toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    .app-header,
    .app-footer,
    .page-header,
    .card-header button,
    .action-list,
    .form-actions {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1a1a1a;
        --gray-100: #2a2a2a;
        --gray-200: #3a3a3a;
    }
    
    /* Add dark mode styles if desired */
}