* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 0 0% 98%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;
    --success: 142 76% 36%;
    --success-foreground: 0 0% 98%;
    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --ring: 262.1 83.3% 57.8%;
    --radius: 0.5rem;
}

.dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 0 0% 98%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;
    --success: 142 76% 36%;
    --success-foreground: 0 0% 98%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 262.1 83.3% 57.8%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: hsl(262.1 83.3% 52%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid hsl(var(--border));
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: hsl(var(--accent));
}

.entries-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.entry-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 2px);
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.entry-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.entry-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.entry-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: hsl(var(--muted-foreground));
    transition: color 0.2s;
}

.btn-icon:hover {
    color: hsl(var(--foreground));
}

.btn-icon.disabled,
.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.gantt-container {
    overflow-x: auto;
    background: hsl(var(--card));
    border-radius: var(--radius);
}

.gantt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

.gantt-table thead {
    background: hsl(var(--muted));
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-table th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid hsl(var(--border));
    border-left: 1px solid hsl(var(--border));
    min-width: 60px;
}

.gantt-table th:first-child {
    text-align: left;
    min-width: 120px;
    max-width: 120px;
    width: 120px;
    position: sticky;
    left: 0;
    background: hsl(var(--muted));
    z-index: 11;
    border-right: 1px solid hsl(var(--border));
    border-left: none;
}

.gantt-table td {
    padding: 0.5rem;
    position: relative;
    height: 60px;
    border-bottom: 1px solid hsl(var(--border));
}

.gantt-table td:first-child {
    overflow-x: auto;
    padding: 0 30px 0 0;
    position: sticky;
    left: 0;
    background: hsl(var(--card));
    z-index: 5;
    font-weight: 500;
    border-right: 1px solid hsl(var(--border));
    min-width: 120px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gantt-table tbody tr:hover td {
    background: hsl(var(--muted) / 0.3);
}

.gantt-table tbody tr:hover td:first-child {
    background: hsl(var(--muted) / 0.5);
}

.drag-handle {
    cursor: grab;
    color: hsl(var(--muted-foreground));
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.drag-handle:hover {
    color: hsl(var(--foreground));
}

.drag-handle:active {
    cursor: grabbing;
}

.gantt-row.dragging-row {
    opacity: 0.5;
}

.gantt-row.drag-over-above {
    border-top: 3px solid hsl(var(--primary));
}

.gantt-row.drag-over-below {
    border-bottom: 3px solid hsl(var(--primary));
}

.drop-indicator {
    height: 4px;
    background: hsl(var(--primary));
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 8px hsla(var(--primary), 0.5);
    border-radius: 2px;
}

.gantt-row {
    position: relative;
    transition: border-color 0.2s;
}

.task-bar {
    position: absolute;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.875rem;
    height: 42px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
}

.task-bar:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.02);
}

.task-bar.dragging {
    opacity: 0.8;
    cursor: grabbing;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.task-bar-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-bar-resize-handle::after {
    content: '';
    width: 3px;
    height: 60%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.task-bar-resize-handle:hover::after {
    background: rgba(255, 255, 255, 0.6);
}

.task-bar-resize-handle.left {
    left: 0;
    padding-left: 2px;
}

.task-bar-resize-handle.right {
    right: 0;
    padding-right: 2px;
}

.task-bar-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-bar-actions {
    display: none;
    gap: 0.25rem;
    align-items: center;
}

.task-bar:hover .task-bar-actions {
    display: flex;
}

.task-bar.completed {
    opacity: 0.7;
}

.task-bar.completed .task-bar-content {
    text-decoration: line-through;
}

.task-bar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
    font-size: 0.75rem;
    line-height: 1;
}

.task-bar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.add-task-row {
    background: hsl(var(--muted));
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.add-task-row:hover {
    background: hsl(var(--accent));
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: hsl(var(--card));
    border-radius: calc(var(--radius) + 2px);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid hsl(var(--border));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    line-height: 1;
}

.close-btn:hover {
    color: hsl(var(--foreground));
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: hsl(var(--muted-foreground));
    opacity: 1;
}

/* Date input styling for dark mode */
.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0);
    cursor: pointer;
}

.dark .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Color input styling */
.form-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius) - 2px);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.form-group textarea {
    resize: vertical;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-picker-container input[type="color"] {
    width: 60px;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    cursor: pointer;
    padding: 0.25rem;
    background: hsl(var(--background));
}

.color-label {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.day-header {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.day-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.day-date {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.gantt-body-container {
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: hsl(var(--muted-foreground));
}

.empty-state p {
    margin-bottom: 1rem;
}

.gantt-table th.header-today {
    background: hsl(var(--success) / 0.15);
    font-weight: 600;
    color: hsl(var(--success));
}

.dark .gantt-table th.header-today {
    background: hsl(var(--success) / 0.2);
    color: hsl(142, 76%, 70%);
}

.gantt-table th.header-past {
    background: hsl(var(--muted));
    opacity: 0.7;
}

.gantt-table th.header-future {
    background: hsl(var(--muted));
}

.entry-card.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    margin: 0;
    border-radius: 0;
    overflow: auto;
}

.entry-card.fullscreen .gantt-container {
    max-height: none;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: hsl(var(--accent));
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.dark .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.dark .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
