/* /modules/styles.css */

/* --- Universal Box-Sizing Rule --- */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

/* --- Basic Setup & Body --- */
body {
    font-family: "Helvetica Neue", "Segoe UI", Segoe, Helvetica, Arial, "Lucida Grande", sans-serif;
    margin: 0;
    background-color: #f4f4f4;
}
a {
    color: black;
    text-decoration: none;
}

/* --- Main Header Bar Styles --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #4169e1; /* royalblue */
    height: 75px;
    padding: 0 20px;
    color: white;
    font-weight: bold;
}
.main-header a {
    color: white;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.hamburger {
    font-size: 35px;
    cursor: pointer;
}
.header-logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-logo {
    height: 60px;
    width: 60px;
}
.header-title {
    font-size: 24px;
}
.header-link {
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-icon {
    width: 25px;
    height: 25px;
}
.admin-badge {
    color: red;
    font-weight: bold;
}

/* --- Slide-out Sidenav Styles --- */
.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    background-color: #9370DB; /* mediumpurple */
    overflow-x: hidden;
    transition: 0.2s;
    padding-top: 60px;
}
.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 18px;
    color: #111;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: 0.3s;
}
.sidenav a:hover {
    color: #f1f1f1;
}
.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    padding: 8px;
}
.profile-info {
    padding: 0 32px 20px 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.profile-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}
.sidenav-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.nav-icon {
    width: 25px;
    height: 25px;
}
.nav-separator {
    height: 25px;
}
.nav-divider {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.2);
    margin: 12px 32px;
}

/* --- Form Container Styles --- */
.container {
    width: 80%;
    max-width: 960px;
    margin: 50px auto 20px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
}
label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
}
.page-header { 
    text-align: left; 
    margin-bottom: 20px; 
}
.page-header h2, .page-header h1 { 
    margin: 0;
    margin-bottom: 10px;
}
.page-header .step-indicator { 
    font-size: 14px; 
    color: #777; 
}
.label-with-counter {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}
.char-counter {
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

/* --- Form Input Styles --- */
input[type="date"], 
input[type="text"], 
input[type="email"], 
input[type="password"], 
select, 
textarea {
    width: 100%; 
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #ccc; 
    background-color: white;
    font-size: 16px;
}
input[type="date"], select {
    height: 45px;
    -webkit-appearance: none; 
    -moz-appearance: none;
    appearance: none; 
    padding-left: 12px;
}
select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat; 
    background-position: right 10px top 50%;
    background-size: 10px auto; 
    padding-right: 30px;
}
textarea { 
    height: 200px; 
    resize: vertical; 
}
.form-group { 
    margin-bottom: 25px; 
}
.form-row {
    display: flex; 
    gap: 15px; 
    align-items: flex-end;
    margin-bottom: 15px;
}
.form-row .form-group {
    flex: 1; 
    margin-bottom: 0;
}
.login-form-container {
    max-width: 350px;
    margin: 0 auto;
}
.login-toggle-link {
    text-align: center;
    color: #0645AD;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 10px;
    margin-bottom: 20px;
}
.login-toggle-link:hover {
    color: #333;
}

/* --- Button Styles --- */
input[type="submit"] {
    background-color: #4CAF50; 
    color: white; 
    padding: 12px 20px;
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 18px;
}
input[type="submit"]:hover { 
    background-color: #45a049; 
}
.button-row { 
    display: flex; 
    gap: 10px;
    justify-content: center;
}
.button-row input[type="submit"] {
    flex-grow: 0;
}
.button-secondary {
    background-color: #6c757d;
}
.button-secondary:hover {
    background-color: #5a6268;
}
.link-button {
    background: none;
    border: none;
    color: #0645AD;
    text-decoration: underline;
    cursor: pointer;
    font-size: 1em;
}

/* --- Message, Log & Calendar Styles --- */
.data-item, .log-entry { 
    margin-bottom: 20px; 
    padding: 0;
    background-color: #f9f9f9; 
    border: 1px solid #ddd;
    border-radius: 5px; 
    overflow: hidden;
}
.log-entry-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px;
    cursor: pointer;
}
.log-entry-header::after {
    content: '▼';
    font-size: 14px;
    color: #888;
    transition: transform 0.2s ease-in-out;
}
.log-entry.is-expanded .log-entry-header::after {
    transform: rotate(180deg);
}
.log-entry-header h3 { margin: 0; font-size: 20px; }
.log-entry-header .session-date { font-weight: bold; color: #555; }
.log-entry-summary {
    padding: 0 20px 15px 20px;
    border-top: 1px solid #eee;
    cursor: pointer;
}
.log-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 15px;
}
.log-entry-meta strong {
    color: #333;
    margin-right: 5px;
}
.log-entry-full-details {
    display: none;
    padding: 0 20px 15px 20px;
}
.log-entry.is-expanded .log-entry-full-details {
    display: block;
}
.log-entry-long-text { 
    margin-top: 15px; 
    padding-top: 15px; 
    border-top: 1px solid #eee; 
}
.log-entry-long-text:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.log-entry-long-text h4 { margin-top: 0; margin-bottom: 5px; }
.log-entry-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}
.action-link {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    color: white;
}
.edit-link {
    background-color: #007bff;
}
.edit-link:hover {
    background-color: #0069d9;
}
.delete-form {
    margin: 0;
}
.delete-button {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}
.delete-button:hover {
    background-color: #c82333;
}
.flash-message {
    position: fixed;
    top: 20px; /* Positioned from the top */
    left: 50%;
    transform: translateX(-50%);
    background-color: #4169e1;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    z-index: 1001;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 1;
    transition: opacity 0.5s ease-out; /* Smooth fade-out transition */
}
.flash-message.fade-out {
    opacity: 0;
}
.no-logs-message { text-align: center; padding: 40px; font-size: 18px; color: #777; }
.action-button-link {
    display: inline-block; margin-bottom: 20px; padding: 10px 20px;
    background-color: #28a745; color: white; text-decoration: none;
    border-radius: 5px; font-weight: bold;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.action-button-link:hover { background-color: #218838; }
.quick-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    margin-bottom: 40px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}
.quick-actions .action-button-link {
    margin-bottom: 0;
}
.action-button-link.secondary {
    background-color: #6c757d;
}
.action-button-link.secondary:hover {
    background-color: #5a6268;
}
.calendar-container { background-color: #fff; padding: 20px; border-radius: 5px; border: 1px solid #ddd; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.calendar-header h2 { margin: 0; }
.calendar-header button { background-color: #f0f0f0; border: 1px solid #ccc; padding: 5px 15px; border-radius: 4px; cursor: pointer; }
#calendar { width: 100%; border-collapse: collapse; }
#calendar th { text-align: center; padding-bottom: 10px; }
#calendar td {
    width: 14.28%;
    height: 70px;
    border: 1px solid #eee;
    vertical-align: top;
    padding: 5px;
    transition: background-color 0.2s;
}
#calendar td.calendar-day {
    position: relative;
}
.calendar-day { cursor: pointer; }
.calendar-day:hover { background-color: #f7f7f7; }
.day-number {
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
}
.day-other-month { color: #ccc; background-color: #fdfdfd; }
.day-selected { background-color: #e8f4ff; }
.day-current .day-number { 
    border-color: #007bff;
}
.day-with-entry .day-number {
    background-color: #28a745;
    color: white;
}
.day-current.day-with-entry .day-number {
    border-color: transparent;
}
.entry-count {
    font-size: 11px;
    text-align: center;
    margin-top: 5px;
    color: #333;
}
.log-new-on-hover {
    display: none;
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 3px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
}
.calendar-day:hover .log-new-on-hover {
    display: block;
}

/* --- Dashboard Styles --- */
.dashboard-subtitle {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 25px;
}
.month-selector-form {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px 20px;
    margin-bottom: 30px;
}
.month-selector-form form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
}
.month-selector-form .form-group {
    margin-bottom: 0;
}
.month-selector-form label {
    font-size: 14px;
}
.month-selector-form select {
    padding: 8px;
    height: auto;
    font-size: 14px;
    min-width: 120px;
}
.month-selector-form button {
    margin-bottom: 0;
    padding: 8px 20px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.stat-card {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
}
.stat-card.full-width-stat {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 20px;
}
.stat-card.full-width-stat .stat-label {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}
.stat-card.full-width-stat .stat-number {
    font-size: 28px;
    margin-bottom: 0;
}
.stat-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.stat-card .stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #4169e1; /* royalblue */
    margin-bottom: 10px;
}
.stat-card .stat-label {
    font-size: 14px;
    color: #666;
}
.stat-list ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.stat-list li {
    margin-bottom: 15px;
}
.stat-list .progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: bold;
}
.progress-bar {
    background-color: #e9ecef;
    border-radius: .25rem;
    height: 20px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background-color: #28a745;
    text-align: center;
    color: white;
    font-size: 12px;
    line-height: 20px;
    transition: width 0.6s ease;
}

/* --- Goals Page Styles --- */
.goals-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
.goal-item {
    background-color: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 20px;
}
.goal-textarea {
    min-height: 100px;
    resize: vertical;
}
.goal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}
.goal-action-btn {
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    cursor: pointer;
}
.goal-action-btn.complete { background-color: #28a745; }
.goal-action-btn.complete:hover { background-color: #218838; }
.goal-action-btn.archive { background-color: #ffc107; color: #212529; }
.goal-action-btn.archive:hover { background-color: #e0a800; }
.goal-action-btn.delete { background-color: #dc3545; }
.goal-action-btn.delete:hover { background-color: #c82333; }
.save-goals-button-container {
    text-align: center;
}
.save-goals-button-container .action-button-link {
    margin-bottom: 0;
}

/* --- AI Analysis Page Styles --- */
.analysis-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}
.analysis-content h3 {
    color: #4169e1; /* royalblue */
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 5px;
    margin-top: 20px;
}
.analysis-content p {
    line-height: 1.7;
}
.analysis-timestamp {
    display: block;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #888;
    text-align: right;
}
.generate-button-container {
    text-align: center;
    margin-top: 40px;
}

/* --- Log Session Form Styles --- */
textarea.notes-textarea {
    height: 100px;
}
.date-time-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 25px;
}
.date-time-row .form-group {
    margin-bottom: 0;
    flex: 1;
}
.time-inputs {
    display: flex;
    gap: 5px;
}
.time-inputs select {
    min-width: 60px;
    flex: 1;
}
.activity-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}
.activity-radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.activity-radio-label {
    flex: 0 1 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.activity-radio-label:hover {
    background-color: #d0d0d0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.activity-radio-input:checked + .activity-radio-label {
    background-color: #4169e1;
    color: white;
    box-shadow: 0 4px 8px rgba(65, 105, 225, 0.4);
    transform: translateY(-2px);
}
.performance-selector {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 10px;
}
.performance-radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.performance-radio-label {
    font-size: 30px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    filter: grayscale(80%);
    opacity: 0.6;
    background-color: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.performance-radio-label:hover {
    transform: scale(1.1);
    filter: grayscale(40%);
    opacity: 0.8;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.performance-radio-input:checked + .performance-radio-label {
    transform: scale(1.1);
    filter: grayscale(0%);
    opacity: 1;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(65, 105, 225, 0.4);
}


/* --- Responsive Styles for Mobile Devices --- */
@media (max-width: 768px) {
    .container {
        width: 95%;
        margin-top: 20px;
    }
    .date-time-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .calendar-container {
        padding: 10px;
    }
    .calendar-header {
        position: relative;
        justify-content: center;
    }
    .calendar-header h2 {
        font-size: 1.2em;
    }
    .calendar-header button {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        font-size: 0;
        width: 40px;
        height: 40px;
        color: #007bff;
    }
    .calendar-header button::before {
        font-size: 24px;
        font-weight: bold;
    }
    #prev-month-btn {
        left: 0;
    }
    #prev-month-btn::before {
        content: '←';
    }
    #next-month-btn {
        right: 0;
    }
    #next-month-btn::before {
        content: '→';
    }
    
    #calendar td {
        height: 50px;
        padding: 2px;
        text-align: center;
    }
    .log-new-on-hover {
        display: none !important;
    }
    .day-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .entry-count {
        display: block !important;
        position: static;
        background-color: transparent;
        color: #007bff;
        font-weight: bold;
        font-size: 11px;
        margin-top: 2px;
        text-align: center;
    }
    .log-entry-details dl {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    .action-button-link.active {
        background-color: #007bff;
        box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
    }
    .activity-selector {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .activity-radio-label {
        flex-basis: 32%;
        font-size: 14px;
        padding: 10px 5px;
    }
    .performance-selector {
        gap: 20px;
    }
    .performance-radio-label {
        font-size: 28px;
    }
}