/* Basic Reset & Font */
body {
    margin: 0;
    font-family: 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.13em;
    background-color: #1a1a2e; /* Dark background */
    color: #e0e0e0; /* Light text color */
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* Header Styling */
.dashboard-header {
    text-align: center;
    padding: 30px 20px;
    background-color: #0f044c; /* Slightly darker header */
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.dashboard-header h1 {
    margin-top: 0;
    font-size: 2.7em;
    color: #e6e6fa; /* Lighter color for main heading */
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
    margin-bottom: 0.2em;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.dashboard-header p {
    font-size: 1.08em;
    opacity: 0.8;
    color: #e0e0e0;
    margin-bottom: 0.5em;
}

/* Main Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Widget Styling */
.widget {
    background-color: #282a5c;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid #3c3f7a;
    display: flex;
    display: -webkit-box; /* Add for Safari flexbox compatibility */
    display: -webkit-flex; /* Add for Safari flexbox compatibility */
    flex-direction: column;
    /* Common fix for flex/grid items in Safari */
    min-width: 0;
    min-height: 0;
}

.widget h2 {
    color: #8aff8a;
    margin-top: 0;
    margin-bottom: 0.7em;
    font-size: 1.5em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* Quick Links Specific Styling */
.quick-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-links li {
    margin-bottom: 10px;
}

.quick-links a {
    color: #8aff8a;
    text-decoration: none;
    font-size: 1.1em;
    transition: color 0.2s ease-in-out;
}

.quick-links a:hover {
    color: #c7ffc7;
}

/* To-Do List Specific Styling */
.todo-input-container {
    display: flex;
    display: -webkit-box; /* Add for Safari flexbox compatibility */
    display: -webkit-flex; /* Add for Safari flexbox compatibility */
    margin-bottom: 15px;
}

#new-todo-item {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #4a4d8c;
    border-radius: 6px;
    background-color: #3f427a;
    color: #e0e0e0;
    font-size: 1em;
    outline: none;
    /* Ensure flex item can shrink */
    min-width: 0;
}

#new-todo-item::placeholder {
    color: #a0a0a0;
}

#add-todo-btn {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.2s ease-in-out;
}

#add-todo-btn:hover {
    background-color: #0056b3;
}

#todo-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

#todo-items li {
    background-color: #3f427a;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    display: -webkit-box; /* Add for Safari flexbox compatibility */
    display: -webkit-flex; /* Add for Safari flexbox compatibility */
    justify-content: space-between;
    align-items: center;
    border: 1px solid #4a4d8c;
    /* Ensure flex item can shrink */
    min-width: 0;
    min-height: 0;
}

.delete-todo {
    background: none;
    border: none;
    color: #ff6666;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2em;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
}

.delete-todo:hover {
    opacity: 1;
    color: #ff3333;
}

/* Weather widgets side by side, responsive */
.widget.weather-widget {
    min-width: 0;
    width: 100%;
    grid-column: span 1;
}
.hourly-forecast-widget.wide-widget {
    grid-column: 1 / -1;
    width: 100%;
}

@media (max-width: 800px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 12px;
    }
    .widget.weather-widget,
    .hourly-forecast-widget.wide-widget {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* Responsive adjustments for overall layout */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack all columns on smaller screens */
        padding: 15px;
    }

    /* Ensure wide-widget still takes full width on small screens */
    .wide-widget {
        grid-column: 1 / -1; /* Make it span the single column */
    }

    .dashboard-header h1 {
        font-size: 2em;
    }

    .widget {
        padding: 20px;
    }

    /* Adjust hourly forecast display on very small screens if it overflows */
    #hourly-forecast-info ul {
        flex-wrap: wrap; /* Allow items to wrap to the next line */
        justify-content: center; /* Center items when wrapped */
    }

    #hourly-forecast-info ul li {
        flex-basis: 45%; /* Give items some flexible width */
        margin: 5px; /* Adjust margin when wrapped */
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 20px 10px;
    }
    .dashboard-header h1 {
        font-size: 1.8em;
    }
    .widget h2 {
        font-size: 1.4em;
    }
}

/* Style for wider widgets (Desktop/Tablet) */
.wide-widget {
    /* For larger screens (where 2 or more columns would fit), span 2 columns */
    /* This rule should come AFTER the general .dashboard-grid definition */
    grid-column: span 4;
}

/* Style for horizontal hourly forecast */
#hourly-forecast-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    display: -webkit-box; /* Add for Safari flexbox compatibility */
    display: -webkit-flex; /* Add for Safari flexbox compatibility */
    justify-content: space-around;
    align-items: center;
    width: 100%;
    /* Allow wrapping only on smaller screens, define fixed number of elements for large screens */
    /* If you want to force all 8 items on one row on desktop, you might need:
       flex-wrap: nowrap;
       justify-content: space-between;
       And ensure items have enough space, or overflow if needed.
       For now, space-around is good. */
}

#hourly-forecast-info ul li {
    display: flex;
    display: -webkit-box; /* Add for Safari flexbox compatibility */
    display: -webkit-flex; /* Add for Safari flexbox compatibility */
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 10px;
    flex-basis: auto; /* Or use a percentage for more control if they don't size right */
    /* Ensure flex item can shrink */
    min-width: 0;
    min-height: 0;
}

#hourly-forecast-info ul li span {
    display: block;
    margin-bottom: 2px;
}

#hourly-forecast-info ul li img {
    margin: 5px 0;
}

/* Style for delete buttons in recent time entries */
.delete-entry-btn {
    background: none;
    border: none;
    color: #ff6666; /* Red color for delete */
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    margin-left: 15px; /* Space from text */
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
}

.delete-entry-btn:hover {
    opacity: 1;
    color: #ff3333;
}

/* Adjust list item display to accommodate the button */
#recent-time-entries li {
    display: flex;
    justify-content: space-between; /* Space out content and button */
    align-items: center;
    word-break: break-word; /* Prevents long text from overflowing */
}

#recent-time-entries li span {
    flex-grow: 1; /* Allow text to take available space */
    margin-right: 10px; /* Space between text and button */
}

/* Weekly Summary Table Styles */
.weekly-summary-table {
    width: 100%;
    min-width: 420px;
    border-collapse: separate;
    border-spacing: 0;
    background: #23244a;
    color: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px #0002;
    margin-bottom: 24px;
}
.weekly-summary-table th, .weekly-summary-table td {
    padding: 12px 10px;
    text-align: center;
    font-size: 1.08em;
    border-bottom: 1px solid #35367a;
    transition: background 0.2s;
}
.weekly-summary-table th {
    background: #2d2e5e;
    color: #8aff8a;
    font-weight: bold;
    font-size: 1.1em;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #35367a;
}
.weekly-summary-table tr:last-child td {
    border-bottom: none;
}
.weekly-summary-table tr:hover td {
    background: #2a2b4d;
}
.weekly-summary-table td.habit-name {
    text-align: left;
    font-weight: bold;
    color: #e0e0e0;
    background: #23244a;
}
.weekly-summary-table td.goal-met {
    font-size: 1.4em;
    background: #1e2e1e;
    color: #8aff8a;
    border-radius: 0 8px 8px 0;
}
.weekly-summary-table td.goal-not-met {
    background: #3c2323;
    color: #ffb4b4;
    border-radius: 0 8px 8px 0;
}
.weekly-summary-table td.day-complete {
    background: #193c1a;
    color: #8aff8a;
    border-radius: 6px;
    font-size: 1.2em;
}
.weekly-summary-table td.day-incomplete {
    background: #3c2323;
    color: #ffb4b4;
    border-radius: 6px;
}
@media (max-width: 600px) {
    .weekly-summary-table th, .weekly-summary-table td {
        padding: 7px 4px;
        font-size: 0.98em;
    }
    .weekly-summary-table {
        min-width: 320px;
    }
}

.minimalist-habit-table {
    width: 100%;
    min-width: 420px;
    border-collapse: separate;
    border-spacing: 0;
    background: #23244a;
    color: #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px #0002;
    margin-bottom: 24px;
    font-size: 1.08em;
    border: 2px solid #3c3f7a;
}
.minimalist-habit-table th, .minimalist-habit-table td {
    padding: 8px 4px;
    text-align: center;
    border: none;
    background: none;
}
.minimalist-habit-table th {
    color: #8aff8a;
    font-weight: 500;
    font-size: 1em;
    background: #2d2e5e;
    border: none;
}
.minimalist-habit-table th.current-day {
    background: #3f427a;
    color: #fff;
    border: 2px solid #8aff8a;
    border-radius: 6px;
}
.minimalist-habit-table td.current-day {
    background: #3f427a;
    border: 1px solid #8aff8a;
}
.minimalist-habit-table tr {
    border: none;
    background: none;
}
.habit-label-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e0e0e0;
}
.habit-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 2px;
}
.habit-emoji {
    font-size: 1.1em;
    margin-right: 2px;
}
.habit-name-text {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
    display: inline-block;
}

/* Show full name on hover as tooltip */
.habit-name-text[title] {
    cursor: help;
}

.habit-day-square {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    margin: 0 auto;
    display: block;
    transition: background 0.2s;
    box-shadow: 0 1px 2px #0001;
    background: #35367a;
}
/* Completed squares for Austin and Sadie (set by JS inline style) */
.habit-day-square.austin-complete {
    background: #8aff8a !important;
}
.habit-day-square.sadie-complete {
    background: #ff69b4 !important;
}
.habit-week-ratio {
    color: #b0b0b0;
    font-size: 0.95em;
    font-weight: 500;
    display: inline-block;
    min-width: 24px;
    text-align: right;
    border-radius: 5px;
    padding: 2px 8px;
    background: transparent;
    transition: background 0.2s, color 0.2s;
}
.habit-week-ratio.goal-met {
    background: #1fae51;
    color: #fff;
}
.minimalist-habit-table tr:hover td {
    background: #2d2e5e;
}
@media (max-width: 600px) {
    .minimalist-habit-table th, .minimalist-habit-table td {
        padding: 6px 2px;
        font-size: 0.95em;
    }
    .habit-day-square {
        width: 14px;
        height: 14px;
    }
    .habit-label-cell {
        max-width: 90px;
    }
    .habit-name-text {
        max-width: 60px;
    }
}

/* Dashboard Button Styles */
.dashboard-header a,
.dashboard-btn {
    display: inline-block;
    background: linear-gradient(90deg, #8aff8a 0%, #fc4c02 100%);
    color: #23244a !important;
    font-weight: bold;
    text-decoration: none;
    font-size: 1.15em;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transition: background 0.2s, color 0.2s, transform 0.1s;
    cursor: pointer;
}
.dashboard-header a:hover,
.dashboard-btn:hover {
    background: linear-gradient(90deg, #fc4c02 0%, #8aff8a 100%);
    color: #fff !important;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 16px rgba(252,76,2,0.15);
}

/* Enhanced Text Styling for Dashboard */
.widget p, .widget ul, .widget li {
    font-size: 1.08em;
    color: #e0e0e0;
    margin-bottom: 0.5em;
}

.widget ul {
    padding-left: 1.2em;
}

.widget li {
    margin-bottom: 0.3em;
    line-height: 1.6;
}

strong, b {
    color: #fc4c02;
    font-weight: 700;
}

em, i {
    color: #8aff8a;
}

/* Subtle accent for important text */
.accent {
    color: #fc4c02;
    font-weight: bold;
}

.dashboard-btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin: 22px 0 10px 0;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .dashboard-btn-group {
        flex-direction: column;
        gap: 10px;
        margin: 18px 0 8px 0;
    }
}

/* Finance page horizontal form layout */
.finance-flex-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 32px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}
.finance-flex-row .widget {
    flex: 1 1 250px;
    min-width: 250px;
}
@media (max-width: 900px) {
    .finance-flex-row {
        flex-wrap: wrap;
    }
}