﻿:root {
    --primary-color: #4285f4;
    --secondary-color: #fbbc05;
    --accent-color: #34a853;
    --danger-color: #ea4335;
    --light-color: #f8f9fa;
    --dark-color: #202124;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
}

h2 {
    color: var(--dark-color);
    margin-bottom: 15px;
}

.input-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.period-inputs, .dosage-inputs, .time-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dosage-inputs span, .time-inputs span {
    margin: 0 5px;
}

.period-inputs input,
.period-inputs select,
.time-inputs input {
    flex: 1;
}

.dosage-inputs input:nth-child(1) {
    flex: 0.8;
}

.dosage-inputs input:nth-child(3) {
    flex: 0.8;
}

.dosage-inputs select {
    flex: 1.4;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #3367d6;
}

.medications-list {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

#medicationsList {
    list-style-type: none;
}

#medicationsList li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#medicationsList li:last-child {
    border-bottom: none;
}

.delete-btn {
    background-color: var(--danger-color);
    padding: 5px 10px;
    font-size: 14px;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.calendar-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-controls button {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#currentMonth {
    font-size: 18px;
    font-weight: 500;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
    font-weight: 500;
    margin-bottom: 5px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    height: 80px; /* Increased height to accommodate medicine names */
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.1s;
}

.calendar-day:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.day-number {
    font-size: 16px;
    font-weight: 500;
}

.med-count {
    font-size: 12px;
    margin-top: 2px;
}

.med-names {
    font-size: 11px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.calendar-day.inactive {
    background-color: #f0f0f0;
    color: #aaa;
    cursor: default;
}

.calendar-day.inactive:hover {
    transform: none;
    box-shadow: none;
}

.calendar-day.no-med {
    background-color: #f9f9f9;
}

.calendar-day.one-med {
    background-color: rgba(66, 133, 244, 0.3);
}

.calendar-day.multiple-med {
    background-color: rgba(52, 168, 83, 0.3);
}

.legend {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.color-box.no-med {
    background-color: #f9f9f9;
}

.color-box.one-med {
    background-color: rgba(66, 133, 244, 0.3);
}

.color-box.multiple-med {
    background-color: rgba(52, 168, 83, 0.3);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 10% auto;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 600px;
    animation: modalopen 0.3s;
}

@keyframes modalopen {
    from {opacity: 0; transform: translateY(-30px);}
    to {opacity: 1; transform: translateY(0);}
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger-color);
}

#modalDate {
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.med-schedule {
    margin-bottom: 15px;
    padding: 10px;
    border-left: 4px solid var(--primary-color);
    background-color: #f9f9f9;
}

.med-schedule h3 {
    color: var(--dark-color);
    margin-bottom: 5px;
}

.time-list {
    list-style-type: none;
    padding-left: 10px;
}

.time-list li {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.time-list li:before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .calendar-day {
        height: 70px;
    }

    .legend {
        flex-direction: column;
        align-items: center;
    }

    .period-inputs, .time-inputs {
        flex-direction: column;
    }

    .dosage-inputs {
        flex-wrap: wrap;
    }

    .dosage-inputs input,
    .dosage-inputs select,
    .dosage-inputs span {
        flex: 1 0 30%;
        margin-bottom: 5px;
    }

    .med-names {
        font-size: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 30px auto;
        padding: 15px;
    }
}