body {
    background: linear-gradient(135deg,
            #0f172a 0%,
            #1e293b 50%,
            #0f172a 100%);
    color: #e2e8f0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

html {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ===== DESKTOP STYLES (Default) ===== */

.header {
    background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1rem 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 50;
    flex-shrink: 0;
}

.navbar-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-back:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateX(-2px);
}

.btn-back svg {
    stroke: currentColor;
    flex-shrink: 0;
}

.navbar-title {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    white-space: nowrap;
}

.content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 1.5rem;
    height: calc(100vh - 80px);
}

.grid-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    height: 95%;
    display: flex;
    flex-direction: column;
}

.grid-item {
    background: linear-gradient(135deg,
            rgba(30, 41, 59, 0.8) 0%,
            rgba(51, 65, 85, 0.8) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding-bottom: 1.5rem;
}

.grid-item:hover {
    box-shadow: 0 25px 50px rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.3);
}

.header-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
    color: #f87171;
    flex-shrink: 0;
}

.header-section h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.75rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.subtitle {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Current Stats Section */
.current-stats {
    margin-bottom: 1.5rem;
    padding: 0;
}

.chart-wrapper {
    flex: 1;
    min-height: 400px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg,
            rgba(71, 85, 105, 0.2) 0%,
            rgba(51, 65, 85, 0.2) 100%);
    border: 1px solid rgba(96, 165, 250, 0.2);
    padding: 1rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stats-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: linear-gradient(135deg,
            rgba(71, 85, 105, 0.4) 0%,
            rgba(51, 65, 85, 0.4) 100%);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item h3 {
    margin: 0;
    font-size: 0.95rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    margin: 0;
    font-size: 1.75rem;
    color: #f1f5f9;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-change {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

.change-info {
    font-size: 0.8rem;
    opacity: 0.7;
    display: block;
    margin-top: 0.2rem;
}

.health-records-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    flex: 1;
    padding-right: 0.5rem;
}

.health-card {
    background: linear-gradient(135deg,
            rgba(71, 85, 105, 0.4) 0%,
            rgba(51, 65, 85, 0.4) 100%);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.health-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.health-card:hover {
    background: linear-gradient(135deg,
            rgba(71, 85, 105, 0.6) 0%,
            rgba(51, 65, 85, 0.6) 100%);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 8px 16px rgba(96, 165, 250, 0.15);
    transform: translateY(-2px);
}

.health-card:hover::before {
    transform: scaleX(1);
}

.health-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.health-metrics {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.25rem;
    color: #f1f5f9;
    font-weight: 700;
}

.health-date {
    padding: 0.5rem 1rem;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.health-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.btn-primary:hover {
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.btn-secondary:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

.btn-secondary:active {
    background: rgba(96, 165, 250, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:active {
    background: rgba(239, 68, 68, 0.1);
}

.btn svg {
    stroke: currentColor;
}

.btn-add-health-record {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    padding: 0;
    margin-top: 0;
    flex-shrink: 0;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.btn-add-health-record:hover {
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

.btn-add-health-record:active {
    transform: scale(0.95);
}

.btn-add-health-record svg {
    width: 24px;
    height: 24px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
    flex: 1;
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
    stroke: #94a3b8;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #cbd5e1;
    font-weight: 700;
}

.empty-state p {
    margin: 0;
    color: #64748b;
}

/* Modal Styles - Desktop */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal {
    background: linear-gradient(135deg,
            rgba(30, 41, 59, 0.98) 0%,
            rgba(51, 65, 85, 0.98) 100%);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(96, 165, 250, 0.1);
    max-width: 950px;
    width: calc(100% - 2rem);
    height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
    flex-shrink: 0;
    background: linear-gradient(135deg,
            rgba(96, 165, 250, 0.05) 0%,
            rgba(167, 139, 250, 0.05) 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #f1f5f9;
    font-weight: 700;
}

.modal-body {
    padding: 2rem;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.3) 0%,
            rgba(30, 41, 59, 0.3) 100%);
}

.btn-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close:hover {
    color: #f1f5f9;
}

.btn-close svg {
    stroke: currentColor;
}

.modal form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #f1f5f9;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin: 0 -1.5rem -1.5rem -1.5rem;
    padding: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
}

/* ===== TABLET & MOBILE STYLES ===== */

@media (max-width: 768px) {

    /* Header Adjustments */
    .header {
        padding: 0.75rem 0;
    }

    .navbar-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0 1rem;
    }

    .navbar-title {
        font-size: 1.1rem;
    }

    /* Layout Adjustments */
    .content {
        padding: 1rem;
        height: calc(100vh - 70px);
    }

    .grid-item {
        padding: 1rem;
    }

    .header-section {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .header-section h1 {
        font-size: 1.4rem;
        margin: 0 0 0.15rem 0;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    /* Card and Stats Adjustments */
    .health-metrics {
        flex-direction: column;
        gap: 1rem;
    }

    .health-actions {
        flex-direction: column;
    }

    /* Button Adjustments */
    .btn {
        flex: 1 1 auto;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* Modal Mobile Styles */
    .modal {
        width: calc(100% - 1rem);
        height: 85vh;
        max-height: 85vh;
        margin: 0 auto;
        border-radius: 8px;
    }

    .modal-header {
        padding: 1rem;
        min-height: 50px;
    }

    .modal-body {
        padding: 0.5rem;
        overflow: hidden;
        display: block;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .chart-container {
        width: 100% !important;
        height: 100% !important;
        min-height: 350px;
        padding: 0.5rem;
    }
}