/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: #c53030;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

.user-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Tasks */
.task-list {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.task-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem;
    padding: 0.25rem;
    border-bottom: 1px solid #f1f3f4;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.task-clickable-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
    width: 100%;
    overflow: hidden;
    flex-wrap: nowrap;
}

.task-clickable-area:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.task-item:last-child {
    border-bottom: none;
}

.task-content {
    flex: 1;
    min-width: 0; /* Allow text to shrink */
    overflow: hidden;
}

.task-text {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    min-width: 0;
}

.task-category-col {
    flex-shrink: 0;
    white-space: nowrap;
}

.task-time-col {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Task decay styling removed - now using background colors */

.task-category {
    font-size: 0.875rem;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-time {
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
}

/* Task expanded styles */
.task-expanded {
    border: 2px solid #007bff;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem;
    padding: 0.5rem;
    align-items: flex-start;
}

.task-expanded-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.task-action-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.task-action-btn:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.task-complete-btn:hover {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.task-edit-btn:hover {
    background-color: #cce5ff;
    border-color: #80bdff;
}

.task-decay-btn:hover {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.task-collapse-btn {
    margin-left: auto;
    font-weight: bold;
}

.task-full-content {
    padding: 0.5rem 0 0 0;
    line-height: 1.6;
}

.task-full-content h1,
.task-full-content h2,
.task-full-content h3,
.task-full-content h4,
.task-full-content h5,
.task-full-content h6 {
    margin-bottom: 0.5rem;
}

.task-full-content p {
    margin-bottom: 0.75rem;
}

.task-full-content p:last-child {
    margin-bottom: 0;
}

.task-full-content ul,
.task-full-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.task-full-content blockquote {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
}

.task-full-content code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.task-full-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
}

.task-metadata {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    margin-top: 0;
    border-top: 1px solid #e9ecef;
    font-size: 0.875rem;
    color: #6c757d;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Decay date visual options */
.decay-pill {
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    display: inline-block;
    color: #d63384;
}

.decay-box {
    border: 1px solid #e9ecef;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875rem;
    display: inline-block;
}

.decay-brackets {
    font-family: monospace;
    font-size: 0.875rem;
    color: #6c757d;
}

.decay-underline {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.1rem;
    font-size: 0.875rem;
}

.decay-plain {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Drag Handle */
.drag-handle {
    cursor: grab;
    padding: 0.25rem 0.125rem 0.25rem 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: color 0.2s ease;
    border-radius: 0.25rem;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.drag-handle:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.02);
}

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

.drag-handle svg {
    fill: currentColor;
    pointer-events: none;
}

/* Sortable States */
.sortable-ghost {
    opacity: 0.3;
    background: #e9ecef !important;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

.sortable-drag {
    background: white !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2) !important;
    border-radius: 0.5rem;
    transform: rotate(3deg);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Prevent text selection during drag */
.task-item.sortable-chosen,
.task-item.sortable-drag {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Prevent click events on task content during drag */
.task-item.sortable-chosen .task-clickable-area,
.task-item.sortable-drag .task-clickable-area {
    pointer-events: none;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: end;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .filters {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filters > div:first-child {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .task-metadata {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    .task-actions {
        flex-wrap: wrap;
    }

    .task-action-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.1rem;
    }
}
