/* =============================================
   ToDo Task — Simple & Professional Design
   ============================================= */

/* Header */
.todo-header {
    padding: 0.75rem 0 0.75rem 0;
    margin-bottom: 1rem;
    border-bottom: 2px dotted #ccc;
}

/* Summary stat cards */
.todo-stat-card {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    border-left: 4px solid transparent;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.todo-stat-count {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.todo-stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

.todo-stat-open        { border-left-color: #17a2b8; }
.todo-stat-open .todo-stat-count        { color: #17a2b8; }

.todo-stat-inprogress  { border-left-color: #4071a8; }
.todo-stat-inprogress .todo-stat-count  { color: #4071a8; }

.todo-stat-hold        { border-left-color: #ffc107; }
.todo-stat-hold .todo-stat-count        { color: #e6a800; }

.todo-stat-completed   { border-left-color: #28a745; }
.todo-stat-completed .todo-stat-count   { color: #28a745; }

/* Task list container */
.todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Individual task card */
.todo-item {
    background: #fff;
    border-radius: 8px;
    border-left: 4px solid #dee2e6;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    overflow: hidden;
}

.todo-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Two-column grid: 60% data | 40% actions */
.todo-item-grid {
    display: grid;
    grid-template-columns: 75% 25%;
    align-items: stretch;
}

/* Data card — left 60% */
.todo-data-section {
    min-width: 0;
    padding: 0.75rem 1rem;
    background: #ffffff;
}

/* Action card — right 40%, single row */
.todo-action-section {
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #eef2fb;
    border-left: 1px solid #d9e4f5;
}

/* Center layout when only one button (Completed) */
.todo-action-center {
    justify-content: center;
}

/* Status button group — inline, no wrap */
.todo-status-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: center;
}

/* Base status button */
.todo-status-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.todo-status-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.todo-status-btn:active {
    transform: translateY(0);
}

.todo-status-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

.todo-status-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Open */
.todo-status-btn-open                { border-color: #c3d9f8; }
.todo-status-btn-open:hover          { background: #e8f0fe; border-color: #1a56db; }
.todo-status-btn-open.active         { background: #dbeafe; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,0.18); }

/* In Progress */
.todo-status-btn-inprogress          { border-color: #ffe499; }
.todo-status-btn-inprogress:hover    { background: #fff3cd; border-color: #856404; }
.todo-status-btn-inprogress.active   { background: #fef3c7; border-color: #856404; box-shadow: 0 0 0 3px rgba(133,100,4,0.18); }

/* On Hold */
.todo-status-btn-hold                { border-color: #d5d5d5; }
.todo-status-btn-hold:hover          { background: #f0f0f0; border-color: #6b7280; }
.todo-status-btn-hold.active         { background: #e5e7eb; border-color: #6b7280; box-shadow: 0 0 0 3px rgba(107,114,128,0.18); }

/* Completed */
.todo-status-btn-completed           { border-color: #a7f3d0; }
.todo-status-btn-completed:hover     { background: #d1fae5; border-color: #065f46; }
.todo-status-btn-completed.active    { background: #d1fae5; border-color: #065f46; box-shadow: 0 0 0 3px rgba(6,95,70,0.18); }

/* Vertical divider between status buttons and crud actions */
.todo-action-divider {
    width: 1px;
    height: 28px;
    background: #c9d6ed;
    flex-shrink: 0;
}

/* Edit + Delete button row */
.todo-crud-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.todo-btn-edit,
.todo-btn-delete {
    font-weight: 700 !important;
}

/* Priority left border colors */
.todo-item.todo-priority-low      { border-left-color: #6c757d; }
.todo-item.todo-priority-medium   { border-left-color: #17a2b8; }
.todo-item.todo-priority-high     { border-left-color: #ffc107; }
.todo-item.todo-priority-critical { border-left-color: #dc3545; }

/* .todo-item-body kept for backward compat but grid sections are preferred */
.todo-item-body {
    padding: 0.75rem 1rem;
}

/* Title */
.todo-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    word-break: break-word;
}

.todo-title-done {
    text-decoration: line-through;
    color: #6c757d;
}

/* Description */
.todo-desc {
    font-size: 0.82rem;
    color: #6c757d;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta row (dates, remarks) */
.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.todo-meta span {
    font-size: 0.75rem;
    color: #868e96;
    display: flex;
    align-items: center;
    gap: 3px;
}

.todo-meta i {
    font-size: 0.7rem;
}

/* Badges */
.todo-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Stage badges */
.todo-stage-open        { background: #e3f6f8; color: #0f7a8a; }
.todo-stage-inprogress  { background: #dce8f5; color: #2d5f8e; }
.todo-stage-hold        { background: #fff3cd; color: #856404; }
.todo-stage-completed   { background: #d4edda; color: #155724; }

/* Date badge */
.todo-date-badge {
    background: #eef2fb;
    color: #4071a8;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

/* Priority badges */
.todo-priority-badge-low      { background: #f0f0f0; color: #555; }
.todo-priority-badge-medium   { background: #e3f6f8; color: #0f7a8a; }
.todo-priority-badge-high     { background: #fff3cd; color: #856404; }
.todo-priority-badge-critical { background: #fde8e8; color: #a01010; }

/* Stage badges */
.todo-stage-badge-open        { background: #e8f0fe; color: #1a56db; }
.todo-stage-badge-inprogress  { background: #fff3cd; color: #856404; }
.todo-stage-badge-hold        { background: #f0f0f0; color: #555; }
.todo-stage-badge-completed   { background: #d1fae5; color: #065f46; }

/* Action buttons */
.todo-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.todo-btn-edit {
    color: #4071a8 !important;
    border-color: #c8d9ee !important;
    background: #f0f5fb !important;
    width: 32px;
    height: 32px;
}

.todo-btn-delete {
    color: #dc3545 !important;
    border-color: #f5c6cb !important;
    background: #fdf0f1 !important;
    width: 32px;
    height: 32px;
}

.todo-btn-edit:hover   { background: #dce8f5 !important; }
.todo-btn-delete:hover { background: #fde8ea !important; }

/* Empty state */
.todo-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.todo-empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    color: #adb5bd;
}

/* =============================================
   Add / Edit Form
   ============================================= */

/* Form card wrapper */
.todo-form-card {
    border-radius: 10px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07) !important;
    border: 1px solid #e8edf3 !important;
    padding: 0.25rem 0 !important;
}

/* Each section block */
.todo-form-section {
    padding: 0.85rem 1.25rem 0.75rem;
}

/* Section header label */
.todo-form-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #4071a8;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

/* Divider between sections (not used) */
.todo-form-divider {
    display: none;
}

/* Action buttons row */
.todo-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem 0.85rem;
    border-top: 1px solid #edf0f5;
    margin-top: 0.25rem;
}

.todo-form-wrapper {
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    padding: 1.25rem 1.5rem 1rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* Each row is a flex row with a consistent gap */
.todo-form-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.todo-form-row:last-child {
    margin-bottom: 0;
}

/* Individual field wrapper — fills its flex share */
.todo-field {
    min-width: 0;
}

/* Inline textarea — visually matches single-line inputs */
.todo-textarea-inline {
    resize: none !important;
    overflow-y: hidden !important;
    line-height: 1.45 !important;
}

/* Row 3 — remarks + buttons aligned at bottom */
.todo-row-remarks {
    align-items: flex-end;
}

.todo-remarks-field {
    flex: 1 1 auto;
    min-width: 0;
}

/* Buttons container */
.todo-form-buttons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    padding-bottom: 3px;
}

.todo-btn-cancel {
    min-width: 82px;
}

.todo-btn-bold {
    font-weight: 700 !important;
}

.todo-input-disabled {
    background: #f5f7fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

/* =============================================
   DatePicker — scoped to todo form only
   ============================================= */

/* Stretch the datepicker to fill the form field */
.todo-form-card .rz-datepicker,
.todo-form-card .rz-datepicker .rz-inputgroup {
    width: 100% !important;
    display: flex !important;
}

/* Input text fills remaining space */
.todo-form-card .rz-datepicker .rz-inputtext {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    border-radius: 4px 0 0 4px !important;
    font-size: 0.875rem !important;
    height: 36px !important;
    line-height: 36px !important;
    padding: 0 0.5rem !important;
}

/* Calendar toggle button — match input height */
.todo-form-card .rz-datepicker .rz-button.rz-inputgroup-addon {
    height: 36px !important;
    border-radius: 0 4px 4px 0 !important;
    flex-shrink: 0 !important;
}

/* =============================================
   Responsive
   ============================================= */

/* Tablet */
@media (max-width: 768px) {
    .todo-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .todo-stat-card {
        padding: 0.6rem 0.75rem;
    }

    .todo-stat-count {
        font-size: 1.25rem;
    }

    .todo-action-section {
        min-width: 150px;
    }
}

/* Mobile — stack data and action sections vertically */
@media (max-width: 576px) {
    .todo-item-grid {
        flex-direction: column;
    }

    .todo-data-section {
        border-bottom: 1px solid #d9e4f5;
        padding: 0.6rem 0.75rem;
    }

    .todo-action-section {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0.75rem;
    }

    .todo-action-center {
        justify-content: center;
    }

    .todo-status-group {
        justify-content: center;
    }

    .todo-title {
        font-size: 0.9rem;
    }

    .todo-meta {
        gap: 0.4rem;
    }

    .todo-stat-count {
        font-size: 1.1rem;
    }

    .todo-stat-label {
        font-size: 0.7rem;
    }
}
