/* CSS for the application */
body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
}
:root {
    --time-slot-height: 48px;
}

/* --- Main Layout --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
.dark ::-webkit-scrollbar-track { background: #1f2937; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
.dark ::-webkit-scrollbar-thumb:hover { background: #6b7280; }
main { min-width: 0; }


/* --- Mini Calendar (Sidebar) --- */
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.mini-calendar-day {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 2rem;
    font-size: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}
.mini-calendar-day.other-month {
    color: #9ca3af;
}
.mini-calendar-day.unsupported-date {
    color: #d1d5db !important;
    cursor: not-allowed;
    pointer-events: none;
    background-color: transparent !important;
}
.mini-calendar-day.today, .mini-calendar-day.selected {
    background-color: #6366f1 !important;
    color: white !important;
}
.mini-calendar-day.has-tasks::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #f43f5e;
}
.mini-calendar-day.has-tasks.today::after, .mini-calendar-day.has-tasks.selected::after {
    background-color: white;
}
.mini-calendar-day.sunday, .mini-calendar-day.holiday { color: #ef4444; }
.mini-calendar-day.saturday { color: #3b82f6; }

/* --- Main Calendar (Month View) --- */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    height: 100%;
}
.month-tasks-container { overflow-y: auto; scrollbar-width: thin; }

/* --- Main Calendar (Week/Day View) --- */
.time-column {
    display: flex;
    flex-direction: column;
}

.time-slot {
    height: var(--time-slot-height);
    position: relative;
}

.time-label {
    position: absolute;
    top: -0.7em;
    right: 0.5em;
    font-size: 0.75rem;
}

.day-column {
    position: relative;
    min-height: calc(var(--time-slot-height) * 24);
}
.day-column:last-child { border-right: none; }

.week-header {
    display: flex;
    flex-direction: column;
}

.week-day-headers {
    display: grid;
    grid-template-columns: repeat(var(--day-columns, 7), minmax(0, 1fr));
}
.week-day-header {
    text-align: center;
    padding: 0.5rem 0.25rem;
    min-width: 0;
}
.week-day-header .day-name { font-size: 0.75rem; }
.week-day-header .day-number { font-size: 1.25rem; font-weight: 500; line-height: 1; }
.week-day-header .holiday-name {
    font-size: 0.7rem;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    margin-top: 2px;
}
.week-day-header.today .day-number {
    background-color: #6366f1;
    color: white;
    border-radius: 0.375rem;
    padding: 0.25rem;
    display: inline-block;
}
.week-day-header.sunday, .week-day-header.holiday { color: #ef4444; }
.week-day-header.saturday { color: #3b82f6; }
.dark .week-day-header.holiday .holiday-name { color: #f87171; }


.all-day-container {
    padding: 4px 0;
}

.all-day-task-item {
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
}


/* --- Task Block --- */
.task-block {
    position: absolute;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
    transition: filter 0.2s;
}
.dark .task-block { border-color: rgba(255,255,255,0.1); }
.task-block:hover { filter: brightness(1.1); z-index: 100 !important; }
.task-block.is-repeating { cursor: default; }
.task-content-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.task-memo-icon {
    flex-shrink: 0;
}
.task-priority-icon {
    flex-shrink: 0;
    width: 0.8rem;
    height: 0.8rem;
    color: inherit; /* This is the key change for visibility */
}


/* --- Agenda View --- */
.agenda-view {
    padding: 1rem;
    overflow-y: auto;
}
.agenda-day-header {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}
.dark .agenda-day-header {
    border-bottom-color: #374151;
}
.agenda-day-header.today {
    color: #4f46e5;
}
.dark .agenda-day-header.today {
    color: #818cf8;
}

.agenda-task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.agenda-task-item:hover {
    background-color: #f9fafb;
}
.dark .agenda-task-item:hover {
    background-color: rgba(255,255,255,0.05);
}
.agenda-task-time {
    width: 110px;
    flex-shrink: 0;
    text-align: right;
}


/* --- Drag and Drop Styles --- */
.task-block.dragging-source { opacity: 0.5; }
.task-ghost {
    position: fixed;
    z-index: 1000 !important;
    pointer-events: none;
    opacity: 0.8;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.resize-ghost {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    background-color: rgba(99, 102, 241, 0.3);
    border: 1px dashed #4f46e5;
    border-radius: 4px;
}
.task-resizer {
    position: absolute;
    left: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.task-resizer-top { top: 0; }
.task-resizer-bottom { bottom: 0; }
.task-resizer::after {
    content: '';
    width: 20px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}
.task-block:hover .task-resizer::after { opacity: 1; }


/* --- Modal --- */
.modal-overlay {
    position: fixed; inset: 0;
    background-color: rgba(17, 24, 39, 0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}

/* --- Priority Selector --- */
.priority-btn.selected {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
}
.dark .priority-btn.selected {
    background-color: #6366f1;
    border-color: #6366f1;
}

/* --- Subtask / Checklist --- */
.subtask-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.subtask-text {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 4px 0;
}
.subtask-text:focus {
    box-shadow: none;
    ring: none;
}
.subtask-text.completed {
    text-decoration: line-through;
    color: #9ca3af;
}
.dark .subtask-text.completed {
    color: #6b7280;
}
.progress-bar {
    background-color: #e5e7eb;
    border-radius: 9999px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}
.dark .progress-bar {
    background-color: #374151;
}
.progress-bar-inner {
    background-color: #4f46e5;
    height: 100%;
    transition: width 0.3s ease-in-out;
}


/* --- Help Modal --- */
.help-tab {
    border-color: transparent;
    color: #6b7280;
}
.dark .help-tab {
    color: #9ca3af;
}
.help-tab.active {
    color: #4f46e5;
    border-color: #4f46e5;
}
.dark .help-tab.active {
    color: #818cf8;
    border-color: #818cf8;
}
kbd {
    font-family: monospace;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    background-color: #f3f4f6;
    color: #1f2937;
    font-size: 0.8em;
}
.dark kbd {
    border-color: #4b5563;
    background-color: #374151;
    color: #d1d5db;
}

/* --- Toast --- */
@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateY(-20px); }
    10%, 90% { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-out {
    animation: fadeInOut 3s ease-in-out forwards;
}

/* --- Filter Dropdown --- */
.filter-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50; /* Needs to be higher than content but lower than modals */
    padding: 1rem;
}
.dark .filter-dropdown {
    background-color: #1f2937; /* gray-800 */
    border-color: #374151; /* gray-700 */
}
#filter-container-mobile .filter-dropdown {
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
}
.filter-section {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}
.dark .filter-section {
    border-bottom-color: #374151;
}
.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- Dark Mode Visibility Fixes --- */

/* Header & Sidebar Icons */
.dark header button svg,
.dark aside button svg {
    color: #e5e7eb; /* Tailwind gray-200 */
}

/* Make sure the text next to icons in the sidebar is also visible */
.dark aside button span {
    color: #e5e7eb; /* Tailwind gray-200 */
}

/* Filter indicator border color */
.dark #filter-indicator-desktop,
.dark #filter-indicator-mobile {
    border-color: #111827; /* Tailwind gray-900 */
}

/* Inactive View Toggle Buttons text color */
.dark .view-btn:not([class*="text-indigo-400"]) { /* Target inactive buttons specifically */
    color: #e5e7eb; /* Tailwind gray-200 */
}

