/* ===== Global Styles & Variables ===== */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #10b981;
    --bg-color: #f3f4f6;
    --card-bg-color: #ffffff;
    --text-color: #374151;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --bottom-nav-height: 65px;
}

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

html, body {
    height: 100vh;
    overflow: hidden; 
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.hidden {
    display: none !important;
}

/* ===== MOBILE-FIRST LAYOUT (WITH BOTTOM NAV) ===== */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-color);
}

.sidebar {
    order: 2;
    width: 100%;
    background-color: var(--card-bg-color);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar .logo,
.sidebar .user-profile {
    display: none;
}

.sidebar .nav-links {
    display: flex;
    justify-content: space-around;
    list-style: none;
    width: 100%;
}

.sidebar .nav-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 500;
}
.sidebar .nav-links a i {
    font-size: 20px;
}
.sidebar .nav-links li.active a {
    color: var(--primary-color);
}

.main-content {
    order: 1;
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: var(--bottom-nav-height);
}

.main-content header { margin-bottom: 1.5rem; }
.main-content header h1 { font-size: 24px; }
.main-content header p { color: var(--text-light); }


.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.card {
    background-color: var(--card-bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#combined-vitals-card {
    margin-bottom: 1rem;
}

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

.card-header h3 {
    margin-bottom: 0;
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.add-btn:hover {
    transform: scale(1.1);
}

#meds-list {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
}
#meds-list .no-meds {
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
}
#meds-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
#meds-list li:last-child { border-bottom: none; }
.med-info { display: flex; align-items: center; gap: 12px; }
.med-info .icon { font-size: 18px; color: var(--primary-color); }
.med-info .details p { font-weight: 500; font-size: 14px; }
.med-info .details small { color: var(--text-light); }
.actions button { padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; transition: opacity 0.3s ease; }
.actions .btn-taken { background-color: #dcfce7; color: #166534; }
.actions .btn-skip { background-color: transparent; color: var(--text-light); }
li.taken { opacity: 0.5; text-decoration: line-through; }
li.taken .actions button { cursor: not-allowed; }

.chart-container {
    position: relative;
    flex-grow: 1;
    min-height: 250px;
}

#calendar-card .calendar { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 4px; }
.day-name { font-weight: 600; color: var(--text-light); font-size: 12px; }
.date { padding: 6px; font-size: 14px; border-radius: 50%; cursor: pointer; transition: background-color 0.3s; }
.date:hover { background-color: #eef2ff; }
.other-month { color: #d1d5db; }
.today { background-color: var(--primary-color); color: white; font-weight: 600; }

#quick-actions-card { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.action-btn { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--card-bg-color); font-weight: 500; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 12px; transition: all 0.2s ease; }
.action-btn:hover { background-color: var(--bg-color); border-color: var(--primary-color); color: var(--primary-color); }

/* ----- Modern Streak Card Styles ----- */
#streak-card {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#streak-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.2);
}

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

.streak-header h3 {
    margin-bottom: 0;
    font-weight: 500;
}

.streak-header i {
    font-size: 24px;
    animation: flame-flicker 2.5s ease-in-out infinite;
}

.streak-body {
    text-align: center;
    margin: 1rem 0;
}

.streak-body .streak-count {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
}

.streak-body .streak-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.streak-stats {
    text-align: center;
    padding: 0.75rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item small {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.stat-item span {
    font-size: 18px;
    font-weight: 600;
}

.weekly-tracker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
}

.day-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.day-dot.active {
    background-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    transform: scale(1.1);
}

@keyframes flame-flicker {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal {
    background: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 400px;
    transform: scale(1);
    transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal {
    transform: scale(0.9);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
    font-size: 20px;
    color: var(--text-color);
}
.close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}
.submit-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.submit-btn:hover {
    background-color: #4338ca;
}


/* ----- Add Medicine Form Page Styles ----- */
.form-container {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.form-section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.form-section:last-of-type {
    border-bottom: none;
}
.form-group input[type="text"],
.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background-color: var(--bg-color);
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}
.day-selector {
    padding-left: 1rem;
}
.day-selector.hidden {
    display: none;
}
.days-checkboxes {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.days-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}
#time-list .med-time {
    margin-bottom: 0.5rem;
}
.add-time-btn {
    background: transparent;
    color: var(--primary-color);
    border: none;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0;
    font-size: 14px;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}
.form-actions .cancel-btn {
    padding: 12px 24px;
    background-color: var(--bg-color);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
}
.form-actions .cancel-btn:hover {
    background-color: #e5e7eb;
}
.form-actions .submit-btn {
    padding: 12px 24px;
}

/* ===== Combined Vitals Card Styles ===== */
.vitals-content {
    display: flex;
    flex-direction: column; /* Mobile-first: stack vertically */
    gap: 1.5rem;
}

.vital-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.vital-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.vital-item-header h4 {
    font-weight: 600;
    color: var(--text-color);
}

.edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 15px;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s ease-in-out;
}
.edit-btn:hover {
    color: var(--primary-color);
}

.icon-bg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-bg i {
    font-size: 20px;
}

#bp-icon-bg { background-color: #e0e7ff; }
#bp-icon-bg i { color: #4338ca; }
#bs-icon-bg { background-color: #fee2e2; }
#bs-icon-bg i { color: #dc2626; }

.vital-item-body .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.value-input {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    border: none;
    border-bottom: 2px solid var(--primary-color);
    text-align: center;
    width: 120px;
    background: transparent;
}
.value-input:focus {
    outline: none;
}


.vital-item-body .unit {
    font-size: 14px;
    color: var(--text-light);
    margin-left: 8px;
}

.vital-item-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--secondary-color);
}

.vital-divider {
    width: 80%;
    height: 1px;
    background-color: var(--border-color);
    margin: 0 auto; /* Center the divider on mobile */
}


/* ===== TABLET STYLES (min-width: 768px) ===== */
@media (min-width: 768px) {
    .main-content { padding: 2rem; padding-bottom: 2rem; }
    
    #combined-vitals-card { margin-bottom: 1.5rem; }
    .vitals-content {
        flex-direction: row; /* Side-by-side on larger screens */
        justify-content: space-around;
        align-items: center;
        gap: 1rem;
    }
    .vital-divider {
        width: 1px;
        height: 100px; /* Vertical divider */
    }
    .vital-item {
        flex: 1; /* Each item takes equal space */
    }
    
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    #vitals-chart-card { grid-column: 1 / -1; }
    .chart-container { min-height: 300px; }
    .form-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }
}

/* ===== DESKTOP STYLES (min-width: 1024px) ===== */
@media (min-width: 1024px) {
    .container { flex-direction: row; }
    .sidebar {
        order: unset;
        width: 260px;
        flex-direction: column;
        justify-content: flex-start;
        padding: 24px;
        border-top: none;
        border-right: 1px solid var(--border-color);
    }
    .sidebar .logo { 
        display: flex;
        margin-bottom: 40px; 
    }
    .sidebar .nav-links {
        flex-direction: column;
        justify-content: flex-start;
        flex-grow: 1;
    }
    .sidebar .nav-links a {
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        font-size: initial;
        margin-bottom: 8px;
        transition: all 0.3s ease;
    }
    .sidebar .nav-links a i {
        font-size: initial;
    }
    .sidebar .nav-links a:hover, .sidebar .nav-links li.active a {
        background-color: #eef2ff;
        color: var(--primary-color);
    }
    .sidebar .user-profile {
        display: flex;
        align-items: center;
        gap: 12px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
    }
    .sidebar .user-profile .user-info { display: block; }
    .sidebar .user-profile h4 { font-size: 14px; font-weight: 600; }
    .sidebar .user-profile small { font-size: 12px; color: var(--text-light); }

    .main-content { 
        order: unset;
        padding: 32px; 
    }
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(2, minmax(0, 1fr));
        height: 100%;
    }
    #today-schedule { 
        grid-column: span 2; 
        grid-row: span 2; 
    }
    #vitals-chart-card { grid-column: span 2; grid-row: span 2; }
    #calendar-card { grid-column: span 2; }
    #streak-card, #quick-actions-card { grid-column: span 1; }
}

/* ===== Global Styles & Variables ===== */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #10b981;
    --bg-color: #f3f4f6;
    --card-bg-color: #ffffff;
    --text-color: #374151;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --bottom-nav-height: 65px;
}

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

html, body {
    height: 100vh;
    overflow: hidden; 
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* ===== MOBILE-FIRST LAYOUT (WITH BOTTOM NAV) ===== */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-color);
}

.sidebar {
    order: 2;
    width: 100%;
    background-color: var(--card-bg-color);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar .logo,
.sidebar .user-profile {
    display: none;
}

.sidebar .nav-links {
    display: flex;
    justify-content: space-around;
    list-style: none;
    width: 100%;
}

.sidebar .nav-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 500;
}
.sidebar .nav-links a i {
    font-size: 20px;
}
.sidebar .nav-links li.active a {
    color: var(--primary-color);
}

.main-content {
    order: 1;
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: var(--bottom-nav-height);
}

.main-content header { margin-bottom: 1.5rem; }
.main-content header h1 { font-size: 24px; }
.main-content header p { color: var(--text-light); }


.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.card {
    background-color: var(--card-bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.card-header h3 {
    margin-bottom: 0;
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.add-btn:hover {
    transform: scale(1.1);
}

#meds-list {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
}
#meds-list .no-meds {
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
}
#meds-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
#meds-list li:last-child { border-bottom: none; }
.med-info { display: flex; align-items: center; gap: 12px; }
.med-info .icon { font-size: 18px; color: var(--primary-color); }
.med-info .details p { font-weight: 500; font-size: 14px; }
.med-info .details small { color: var(--text-light); }
.actions button { padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; transition: opacity 0.3s ease; }
.actions .btn-taken { background-color: #dcfce7; color: #166534; }
.actions .btn-skip { background-color: transparent; color: var(--text-light); }
li.taken { opacity: 0.5; text-decoration: line-through; }
li.taken .actions button { cursor: not-allowed; }

.chart-container {
    position: relative;
    flex-grow: 1;
    min-height: 250px;
}

#calendar-card .calendar { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 4px; }
.day-name { font-weight: 600; color: var(--text-light); font-size: 12px; }
.date { padding: 6px; font-size: 14px; border-radius: 50%; cursor: pointer; transition: background-color 0.3s; }
.date:hover { background-color: #eef2ff; }
.other-month { color: #d1d5db; }
.today { background-color: var(--primary-color); color: white; font-weight: 600; }

#quick-actions-card { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.action-btn { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--card-bg-color); font-weight: 500; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 12px; transition: all 0.2s ease; }
.action-btn:hover { background-color: var(--bg-color); border-color: var(--primary-color); color: var(--primary-color); }

/* ----- Modern Streak Card Styles ----- */
#streak-card {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#streak-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.2);
}

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

.streak-header h3 {
    margin-bottom: 0;
    font-weight: 500;
}

.streak-header i {
    font-size: 24px;
    animation: flame-flicker 2.5s ease-in-out infinite;
}

.streak-body {
    text-align: center;
    margin: 1rem 0;
}

.streak-body .streak-count {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
}

.streak-body .streak-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.streak-stats {
    text-align: center;
    padding: 0.75rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item small {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.stat-item span {
    font-size: 18px;
    font-weight: 600;
}

.weekly-tracker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
}

.day-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.day-dot.active {
    background-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    transform: scale(1.1);
}

@keyframes flame-flicker {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal {
    background: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 400px;
    transform: scale(1);
    transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal {
    transform: scale(0.9);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
    font-size: 20px;
    color: var(--text-color);
}
.close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}
.submit-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.submit-btn:hover {
    background-color: #4338ca;
}


/* ----- Add Medicine Form Page Styles ----- */
.form-container {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.form-section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.form-section:last-of-type {
    border-bottom: none;
}
.form-group input[type="text"],
.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background-color: var(--bg-color);
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}
.day-selector {
    padding-left: 1rem;
}
.day-selector.hidden {
    display: none;
}
.days-checkboxes {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.days-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}
#time-list .med-time {
    margin-bottom: 0.5rem;
}
.add-time-btn {
    background: transparent;
    color: var(--primary-color);
    border: none;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0;
    font-size: 14px;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}
.form-actions .cancel-btn {
    padding: 12px 24px;
    background-color: var(--bg-color);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
}
.form-actions .cancel-btn:hover {
    background-color: #e5e7eb;
}
.form-actions .submit-btn {
    padding: 12px 24px;
}


/* ----- REVISED: Modern & Optimized Settings Page Styles ----- */

/* FIX: Increased padding to prevent icon and placeholder clash */
.input-wrapper input {
    padding-left: 50px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 2rem; /* The gap you wanted between tiles */
}

/* FIX: Added gap to the form for vertical spacing of sections */
#settings-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    margin-bottom: 2rem;
    font-size: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-section h2 i {
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
}
.input-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    transition: color 0.3s ease;
}
.input-wrapper input:focus ~ i {
    color: var(--primary-color);
}

.form-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 6px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.setting-group:last-of-type {
    border-bottom: none;
}
.setting-group-label div {
    margin-right: 1rem;
}
.setting-group-label label {
    font-weight: 500;
    color: var(--text-color);
}

.segmented-control {
    display: flex;
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 4px;
}
.segmented-control button {
    padding: 6px 12px;
    border: none;
    background-color: transparent;
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.8rem;
}
.segmented-control button.active {
    background-color: var(--card-bg-color);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.toggle-group:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
.toggle-group label {
    font-weight: 500;
}
.toggle-group div {
    margin-right: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(22px);
}
.slider.round {
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}


/* ----- Dark Mode Theme & Accessibility ----- */
:root {
    --text-size: 16px; /* Default text size */
}

html[data-text-size="normal"] { --text-size: 16px; }
html[data-text-size="large"] { --text-size: 18px; }
html[data-text-size="larger"] { --text-size: 20px; }

html {
    font-size: var(--text-size);
}

[data-theme="dark"] {
    --bg-color: #111827;
    --card-bg-color: #1f2937;
    --text-color: #d1d5db;
    --text-light: #9ca3af;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

[data-theme="dark"] .segmented-control {
    background-color: #374151;
}

[data-theme="dark"] .segmented-control button.active {
    background-color: #4b5563;
}


/* ===== TABLET STYLES (min-width: 768px) ===== */
@media (min-width: 768px) {
    .main-content { padding: 2rem; padding-bottom: 2rem; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    #vitals-chart-card { grid-column: 1 / -1; }
    .chart-container { min-height: 300px; }
    .form-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }
}

/* ===== DESKTOP STYLES (min-width: 1024px) ===== */
@media (min-width: 1024px) {
    .container { flex-direction: row; }
    .sidebar {
        order: unset;
        width: 260px;
        flex-direction: column;
        justify-content: flex-start;
        padding: 24px;
        border-top: none;
        border-right: 1px solid var(--border-color);
    }
    .sidebar .logo { 
        display: flex;
        margin-bottom: 40px; 
    }
    .sidebar .nav-links {
        flex-direction: column;
        justify-content: flex-start;
        flex-grow: 1;
    }
    .sidebar .nav-links a {
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        font-size: initial;
        margin-bottom: 8px;
        transition: all 0.3s ease;
    }
    .sidebar .nav-links a i {
        font-size: initial;
    }
    .sidebar .nav-links a:hover, .sidebar .nav-links li.active a {
        background-color: #eef2ff;
        color: var(--primary-color);
    }
    .sidebar .user-profile {
        display: flex;
        align-items: center;
        gap: 12px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
    }
    .sidebar .user-profile .user-info { display: block; }
    .sidebar .user-profile h4 { font-size: 14px; font-weight: 600; }
    .sidebar .user-profile small { font-size: 12px; color: var(--text-light); }

    .main-content { 
        order: unset;
        padding: 32px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(2, minmax(0, 1fr));
        height: 100%;
    }
    #today-schedule { 
        grid-column: span 2; 
        grid-row: span 2; 
    }
    #vitals-chart-card { grid-column: span 2; grid-row: span 2; }
    #calendar-card { grid-column: span 2; }
    #streak-card, #quick-actions-card { grid-column: span 1; }

    .settings-grid {
        grid-template-columns: 1fr 1fr; /* Two columns on desktop */
        align-items: start;
    }
}
