﻿/* ===============================
   VITAL SIGNS PAGE STYLES
   Modern Professional Design
   =============================== */

:root {
    --primary: #3A767A;
    --primary-light: rgba(58, 118, 122, 0.1);
    --primary-dark: #2c5b5e;
    --secondary: #3FAC72;
    --secondary-light: rgba(63, 172, 114, 0.1);
    --danger: #E04852;
    --danger-light: rgba(224, 72, 82, 0.1);
    --warning: #f39c12;
    --warning-light: rgba(243, 156, 18, 0.1);
    --success: #2ecc71;
    --success-light: rgba(46, 204, 113, 0.1);
    --info: #3498db;
    --info-light: rgba(52, 152, 219, 0.1);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text: #0f172a;
    --text-muted: #475569;
    --text-light: #64748b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--surface-2);
    line-height: 1.5;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

    .loading-overlay.hidden {
        opacity: 0;
        pointer-events: none;
    }

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

    .loading-spinner.small {
        width: 30px;
        height: 30px;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary);
}

.empty-state h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.empty-state.hidden {
    display: none;
}

/* ===== DASHBOARD CONTENT ===== */
.dashboard-content.hidden {
    display: none;
}

/* ===== WELCOME HEADER ===== */
.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.welcome-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* ===== METRICS GRID ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

    .metric-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== VITALS GRID ===== */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== CHART CARDS ===== */
.chart-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

    .chart-card:hover {
        box-shadow: var(--shadow-md);
        border-color: var(--primary);
    }

    .chart-card.glass-effect {
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
    }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
}

    .card-header i {
        color: var(--primary);
        font-size: 1.2rem;
    }

    .card-header .badge {
        margin-left: auto;
    }

.chart-wrapper {
    position: relative;
    height: 200px;
    width: 100%;
}

/* ===== GAUGE TEXT ===== */
.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -30%);
    text-align: center;
}

    .gauge-text strong {
        display: block;
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--text);
        line-height: 1.2;
    }

    .gauge-text span {
        font-size: 0.9rem;
        color: var(--text-muted);
    }

/* ===== RISK CONTAINER ===== */
.risk-container {
    padding: 0.5rem 0;
}

.risk-item {
    margin-bottom: 1.25rem;
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

    .risk-header i {
        color: var(--primary);
        width: 20px;
        margin-right: 0.5rem;
    }

.progress-bar {
    height: 8px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* ===== ALERT CONTAINER ===== */
.alert-container {
    padding: 0.5rem 0;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border-left: 4px solid transparent;
    transition: transform 0.2s;
}

    .alert-item:hover {
        transform: translateX(4px);
    }

    .alert-item.alert-warning {
        background: var(--warning-light);
        border-left-color: var(--warning);
    }

    .alert-item.alert-critical {
        background: var(--danger-light);
        border-left-color: var(--danger);
    }

    .alert-item i {
        font-size: 1.1rem;
        color: var(--text-muted);
    }

.empty-alerts {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.5rem;
}

    .section-header h2 {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text);
    }

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-icon:hover {
        background: var(--surface-2);
        border-color: var(--primary);
        color: var(--primary);
    }

    .btn-icon.active {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
    }

.records-count {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== CHARTS GRID ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== RECENT RECORDS ===== */
.recent-list {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border: 1px solid var(--border);
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

    .record-item:hover {
        background: var(--surface-2);
    }

    .record-item:last-child {
        border-bottom: none;
    }

.record-info {
    flex: 1;
}

.record-date {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

    .record-date i {
        color: var(--primary);
        margin-right: 0.5rem;
    }

.record-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.record-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== BADGES ===== */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

    .badge.risk-normal {
        background: var(--success-light);
        color: #1e7b4c;
    }

    .badge.risk-warning {
        background: var(--warning-light);
        color: #b45f06;
    }

    .badge.risk-critical {
        background: var(--danger-light);
        color: #b71c1c;
    }

/* ===== BUTTONS ===== */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-dark);
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

    .btn-outline-primary:hover {
        background: var(--primary-light);
    }

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

    .btn-outline-secondary:hover {
        background: var(--surface-2);
        border-color: var(--border-dark);
    }

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* ===== FORMS ===== */
.vitals-form {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

    .form-section h4 {
        font-size: 1rem;
        color: var(--primary);
        margin-bottom: 1rem;
    }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

    .form-group label {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--text-muted);
    }

        .form-group label .unit {
            color: var(--text-light);
            font-weight: normal;
        }

.form-control {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    .form-control:invalid {
        border-color: var(--danger);
    }

.range-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    animation: fadeIn 0.3s;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    margin: 2rem auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-light), transparent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

    .modal-header h3 {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--primary-dark);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

        .modal-header h3 i {
            color: var(--primary);
        }

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

    .close-btn:hover {
        color: var(--danger);
    }

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ===== DETAIL MODAL ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-section {
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius);
}

    .detail-section.full-width {
        grid-column: span 2;
    }

    .detail-section h4 {
        font-size: 1rem;
        color: var(--primary);
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border);
    }

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border);
}

    .detail-item:last-child {
        border-bottom: none;
    }

    .detail-item span {
        color: var(--text-muted);
    }

    .detail-item strong {
        color: var(--text);
    }

/* ===== ERROR MESSAGE ===== */
.error-message {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--danger);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1100;
    animation: slideInRight 0.3s;
}

    .error-message.hidden {
        display: none;
    }

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

    .error-close:hover {
        opacity: 1;
    }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .welcome-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

        .header-actions .btn {
            flex: 1;
        }

    .vitals-grid,
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem auto;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-section.full-width {
        grid-column: span 1;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 1.5rem;
    }

    .chart-card {
        padding: 1rem;
    }

    .gauge-text strong {
        font-size: 1.5rem;
    }

    .record-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .record-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.bg-primary-light {
    background: var(--primary-light);
}

.rounded {
    border-radius: var(--radius);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.shadow {
    box-shadow: var(--shadow);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}
/* ===== GAUGES GRID - LARGER CONTAINERS ===== */
.vitals-grid.gauges-grid {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

/* ===== GAUGE CARDS ===== */
.gauge-card {
    padding: 2rem 1.5rem !important;
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

    .gauge-card .card-header {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

        .gauge-card .card-header i {
            font-size: 1.5rem;
        }

        .gauge-card .card-header span:not(.badge) {
            font-size: 1.2rem;
            font-weight: 600;
        }

/* ===== GAUGE WRAPPER ===== */
.gauge-wrapper {
    position: relative;
    flex: 1;
    min-height: 220px;
    width: 100%;
    margin: 0.5rem 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== GAUGE CONTAINER ===== */
.gauge-container {
    width: 100% !important;
    height: 100% !important;
    max-height: 220px;
}

/* ===== GAUGE TEXT OVERLAY ===== */
.gauge-card .gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -30%);
    text-align: center;
    width: 100%;
    pointer-events: none;
}

    .gauge-card .gauge-text strong {
        display: block;
        font-size: 2.5rem;
        font-weight: 700;
        color: var(--text);
        line-height: 1.2;
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .gauge-card .gauge-text span {
        font-size: 1.1rem;
        color: var(--text-muted);
        font-weight: 500;
        display: block;
        margin-top: 0.25rem;
    }

/* ===== GAUGE FOOTER ===== */
.gauge-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.gauge-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

    .gauge-label i {
        color: var(--primary);
        font-size: 1rem;
    }

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (min-width: 1200px) {
    .vitals-grid.gauges-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gauge-card {
        min-height: 400px;
    }

    .gauge-wrapper {
        min-height: 250px;
    }

    .gauge-card .gauge-text strong {
        font-size: 3rem;
    }

    .gauge-card .gauge-text span {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .vitals-grid.gauges-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gauge-card {
        min-height: 320px;
        padding: 1.5rem !important;
    }

    .gauge-wrapper {
        min-height: 200px;
    }

    .gauge-card .gauge-text strong {
        font-size: 2.2rem;
    }

    .gauge-card .gauge-text span {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .gauge-card {
        min-height: 300px;
        padding: 1rem !important;
    }

    .gauge-wrapper {
        min-height: 180px;
    }

    .gauge-card .gauge-text strong {
        font-size: 2rem;
    }
}

/* ===== OPTIONAL: ADD HOVER EFFECT ===== */
.gauge-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .gauge-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }

        .gauge-card:hover .gauge-text strong {
            color: var(--primary);
            transition: color 0.3s ease;
        }