@charset "UTF-8";

/* ------------------ GENERAL ------------------ */

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(to right, #f5f7fa, #eaeff5);
    margin: 0;
    padding: 20px;
    color: #333;
}

h2, h3, h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ------------------ TOP BAR Header------------------ */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #FFFF99, #eaeff5);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left .logo-img {
    height: 40px;
    object-fit: contain;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.actions a,
.actions button {
    padding: 6px 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
}

.actions a:hover,
.actions button:hover {
    background-color: #0056b3;
}

.btn-add-goal {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-add-goal:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.btn-add-goal:active {
    background-color: #1e7e34;
    transform: scale(0.98);
}

/* ------------------ FORM ELEMENTS ------------------ */

/* Bọc khối chọn thời gian */
.date-picker-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: #66FFFF;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    flex-wrap: wrap;
}

.date-picker-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-picker-form label {
    font-weight: bold;
    font-size: 14px;
}

.date-picker-form select {
    width: auto;
    min-width: 80px;
}

/* Hiển thị ngày tháng hiện tại */
.current-month-display {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    padding: 8px 14px;
    background: #e9ecef;
    border-radius: 6px;
    white-space: nowrap;
}

/* ------------------ TABLES ------------------ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    box-shadow: 0 0 8px rgba(0,0,0,0.03);
    table-layout: auto;
}

th, td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    vertical-align: middle;
}

th {
    background-color: #f1f3f5;
    font-weight: bold;
}

/* ------------------ DASHBOARD ------------------ */

.dashboard-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.section {
    flex: 1;
    min-width: 260px;
    background: #FFCCCC;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(0,0,0,0.05);
}

.summary-box,
.chart-box {
    background: #CC99FF;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
}

.mood-chart-box {
    background: #FF7070;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 4px rgba(0,0,0,0.05);
    margin-top: 20px; /* Tạo khoảng cách với phần trên */
}

.scroll-x {
    overflow-x: auto;
}

/* ------------------ GOAL TABLE ------------------ */

.goal-table {
    border-collapse: collapse;
    font-size: 13px;
    min-width: 900px;
    white-space: nowrap;
}

.goal-table th, .goal-table td {
    padding: 6px;
    border: 1px solid #ccc;
}

.goal-title {
    text-align: left;
}

.goal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goal-actions {
    display: flex;
    gap: 6px;
}

.icon-button {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    padding: 3px 5px;
}

.icon-button:hover {
    background-color: #eee;
    border-radius: 3px;
}

.goal-check {
    width: 18px;
    height: 18px;
    accent-color: #28a745;
}

.week-label,
.day-label,
.date-label {
    font-size: 11px;
}

/* ------------------ MOOD SECTION ------------------ */

.mood-table {
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
    width: 100%;
}

.mood-table th,
.mood-table td {
    padding: 6px;
    border: 1px solid #ccc;
}

.mood-select {
    font-size: 18px;
    padding: 4px 6px;
    width: 48px;
    height: 36px;
    text-align: center;
    line-height: 1;
    appearance: none;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.mood-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 4px rgba(0,123,255,0.3);
}

/* Fix emoji overflow in Safari/Chrome */
.mood-select option {
    font-size: 18px;
    padding: 6px;
}

/* Chú thích cảm xúc */
.mood-legend-horizontal {
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
}

.mood-legend-horizontal .legend-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 35px;
    background: #f7f7f7;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.mood-legend-horizontal .legend-row span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
}

.mood-counts td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-weight: 600;
    color: #333;
}

.mood-counts tr:last-child td {
    border-bottom: none;
}

.mood-counts td:first-child {
    width: 60%;
    font-size: 16px;
}


/* ------------------ SUMMARY TABLE ------------------ */

.summary-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.summary-table th,
.summary-table td {
    padding: 6px 10px;
    border: 1px solid #ddd;
}

/* ------------------ CHART STYLES ------------------ */

/* Tối ưu hiển thị cho canvas */
canvas {
    max-width: 100%;
    min-width: 520px;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

/* Chỉnh biểu đồ riêng nếu cần */
canvas#goalChart {
    max-width: 240px;
}

/* Gộp bố cục biểu đồ mục tiêu và cảm xúc */
.section-flex {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 20px;
}

/* Hộp biểu đồ mục tiêu và cảm xúc */
.goal-summary,
.mood-summary {
    flex: 1 1 320px;
    padding: 16px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Căn giữa phần text dưới biểu đồ */
.center-text {
    text-align: center;
    font-size: 15px;
    margin-top: 12px;
    font-weight: 500;
    color: #333;
}

/* Cải thiện bảng thống kê cảm xúc */
.mood-summary table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.mood-summary td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

/* Responsive nhỏ hơn */
@media (max-width: 600px) {
    .goal-summary,
    .mood-summary {
        flex: 1 1 100%;
    }
}

/* ------------------ MODALS ------------------ */

.modal {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 20px;
    width: 320px;
    z-index: 1000;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

/* ------------------ FEEDBACK ------------------ */

.success, .error {
    padding: 10px;
    margin-bottom: 15px;
    text-align: center;
    border-radius: 4px;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal chỉnh sửa thông tin người dùng */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
	transition: all 0.2s ease-in-out;.


}

.modal h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 20px;
    color: #2c3e50;
    text-align: center;
}

.modal h4 {
    font-size: 15px;
    margin-top: 18px;
    color: #444;
    margin-bottom: 10px;
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal form label {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.modal form input[type="email"],
.modal form input[type="text"],
.modal form input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.modal form hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.modal-actions button {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-actions button[type="submit"] {
    background-color: #007bff;
    color: white;
}

.modal-actions button[type="submit"]:hover {
    background-color: #0056b3;
}

.modal-actions button[type="button"] {
    background-color: #6c757d;
    color: white;
}

.modal-actions button[type="button"]:hover {
    background-color: #5a6268;
}

@media (max-width: 480px) {
    .modal {
        width: 92%;
        padding: 20px 15px;
    }

    .modal h3 {
        font-size: 18px;
    }

    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-actions button {
        width: 100%;
    }
}


/* ------------------ RESPONSIVE ------------------ */

@media (max-width: 768px) {
    .top-bar, .dashboard-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .goal-table,
    .summary-table,
    .mood-table {
        font-size: 12px;
    }

    .goal-check {
        width: 16px;
        height: 16px;
    }

    input, select, button {
        width: 100%;
    }
}

#backToTopBtn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    background-color: #E0C200;
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 60%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: none; /* Ẩn mặc định */
    transition: opacity 0.7s ease;
}

#backToTopBtn:hover {
    background-color: #E2E909;
}
