/* ========================================= */
/* Global & Shared Component Styles      */
/* (For Dialogs and Main Page)           */
/* ========================================= */

/* ========================================= */
/* Page-Specific Styles                  */
/* ========================================= */

page[data-hash="tasks"] {
    .tasks-page {
        background: #f5f5f5;
    }

    /* Action Bar */
    .action-bar {
        background: white;
        padding: 20px 24px;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Floating Action Button */
    .btn-fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #1a73e8;
        color: white;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .btn-fab:hover {
        background: #1565c0;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
        transform: translateY(-2px);
    }

    /* Elevated Button */
    .btn-elevated {
        background: white;
        border: 1px solid #e0e0e0;
        padding: 0.5rem 1rem;
        border-radius: 4px;
        font-weight: 500;
        transition: all 0.3s ease;
        color: #424242;
    }

    .btn-elevated:hover {
        background: #f5f5f5;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Stat Cards */
    .stat-card {
        background-color: white;
        padding: 1.25rem;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        text-align: center;
        transition: transform 0.2s ease;
    }

    .stat-card:hover {
        transform: translateY(-4px);
    }

    .stat-card .stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 0.75rem;
        font-size: 1.25rem;
        color: white;
    }

    .stat-icon.blue { background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); }
    .stat-icon.red { background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%); }
    .stat-icon.green { background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%); }
    .stat-icon.purple { background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%); }

    .stat-card .stat-value {
        font-size: 2rem;
        font-weight: bold;
        color: #212121;
        line-height: 1;
        margin-bottom: 0.25rem;
    }

    .stat-card .stat-label {
        font-size: 0.875rem;
        color: #757575;
        font-weight: 500;
    }

    /* Material Card */
    .material-card {
        background: white;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        overflow: hidden;
    }

    .card-header-material {
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid #e0e0e0;
        font-weight: 600;
        font-size: 1rem;
        color: #212121;
    }

    .card-body-material {
        padding: 1.5rem;
    }

    /* Task List */
    .task-list {
        padding: 0;
    }

    .task-item {
        display: flex;
        align-items: center;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #f5f5f5;
        transition: background 0.2s ease;
        cursor: pointer;
        border-left: 4px solid transparent;
    }

    .task-item:last-child {
        border-bottom: none;
    }

    .task-item:hover {
        background: #fafafa;
    }

    .task-item.high { border-left-color: #d32f2f; }
    .task-item.medium { border-left-color: #f57c00; }
    .task-item.low { border-left-color: #388e3c; }

    /* Task Checkbox */
    .task-checkbox {
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .task-checkbox input[type="checkbox"] {
        display: none;
    }

    .task-checkbox label {
        cursor: pointer;
        margin: 0;
    }

    .task-checkbox .checkbox-icon {
        width: 24px;
        height: 24px;
        border: 2px solid #9e9e9e;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }

    .task-checkbox .checkbox-icon i {
        font-size: 0.875rem;
        color: white;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .task-checkbox input:checked+label .checkbox-icon {
        background: #1976d2;
        border-color: #1976d2;
    }

    .task-checkbox input:checked+label .checkbox-icon i {
        opacity: 1;
    }

    /* Task Content */
    .task-content {
        flex: 1;
        min-width: 0;
    }

    .task-title {
        margin: 0 0 0.5rem 0;
        font-size: 1rem;
        font-weight: 500;
        color: #212121;
    }

    .task-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: center;
    }

    .task-tag {
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.75rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 500;
    }

    .task-time {
        display: inline-flex;
        align-items: center;
        font-size: 0.875rem;
        color: #757575;
    }

    .task-priority {
        display: inline-flex;
        align-items: center;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-weight: 500;
    }

    .task-priority.high { background: #ffebee; color: #c62828; }
    .task-priority.medium { background: #fff3e0; color: #e65100; }
    .task-priority.low { background: #e8f5e9; color: #2e7d32; }

    /* Task Actions */
    .task-actions {
        display: flex;
        gap: 0.5rem;
        margin-left: 1rem;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .task-item:hover .task-actions {
        opacity: 1;
    }

    .icon-button {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: #757575;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        cursor: pointer;
    }

    .icon-button:hover {
        background: #f5f5f5;
        color: #212121;
    }

    /* Chip */
    .chip {
        display: inline-block;
        padding: 0.25rem 0.75rem;
        background: #e3f2fd;
        color: #1976d2;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 500;
    }

    /* --- CORRECTED: Styles for Quick Add Form --- */
    .input-label {
        display: block;
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
        font-weight: 500;
        color: #424242;
    }

    .material-input {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        font-size: 1rem;
        transition: all 0.2s ease;
    }
    
    .material-input:focus {
        outline: none;
        border-color: #1976d2;
        box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
    }
    
    .material-select-wrapper {
        position: relative;
    }
    
    .material-select {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        font-size: 1rem;
        background: white;
        cursor: pointer;
        appearance: none;
        transition: all 0.2s ease;
    }
    
    .material-select:focus {
        outline: none;
        border-color: #1976d2;
        box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
    }
    
    .material-select-wrapper::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        color: #757575;
    }
    /* --- End Quick Add Form Styles --- */

    /* Progress Circle */
    .progress-circle {
        display: inline-block;
    }

    /* List Material (Categories) */
    .list-material {
        padding: 0;
    }

    .list-item-material {
        display: flex;
        align-items: center;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #f5f5f5;
        transition: background 0.2s ease;
        cursor: pointer;
        position: relative;
    }

    .list-item-material:last-child {
        border-bottom: none;
    }

    .list-item-material:hover {
        background: #fafafa;
    }

    .list-item-material.active {
        background-color: #e3f2fd;
        font-weight: 600;
    }

    .list-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 1rem;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .list-content {
        flex: 1;
        min-width: 0;
    }

    .list-title {
        margin: 0;
        font-size: 1rem;
        font-weight: 500;
        color: #212121;
    }

    .list-item-material .list-actions {
        display: flex;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .list-item-material:hover .list-actions {
        opacity: 1;
    }

    .icon-button-sm {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: #757575;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        cursor: pointer;
    }

    .icon-button-sm:hover {
        background: #e0e0e0;
    }

    .doublegrow {
        flex-grow: 1.5;
    }

    /* Responsive */
    @media (max-width: 991px) {
        .action-bar {
            flex-direction: column;
            gap: 1rem;
            align-items: flex-start;
        }

        .task-actions {
            opacity: 1;
        }
    }

    @media (max-width: 576px) {
        .task-meta {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
        }

        .priority-selector {
            flex-direction: column;
        }
    }
    
    /* Material Buttons */
    .btn-primary-material {
        padding: 0.75rem 1.5rem;
        background: #1976d2;
        color: white;
        border: none;
        border-radius: 4px;
        font-weight: 600;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .btn-primary-material:hover {
        background: #1565c0;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    }
    
    .btn-text-material {
        background: transparent;
        border: none;
        color: #1976d2;
        font-weight: 500;
        padding: 0.5rem;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.2s ease;
    }
    
    .btn-text-material:hover {
        background: rgba(25, 118, 210, 0.08);
    }
    
    /* Material "Filled" Text Field Style (Used in Dialogs) */
    .material-textfield {
        position: relative;
        background-color: #f5f5f5;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding: 1rem;
        border-bottom: 1px solid #9e9e9e;
    }
    
    .material-textfield input,
    .material-textfield select {
        border: none;
        background: none;
        outline: none;
        width: 100%;
        font-size: 1rem;
        padding-top: 0.25rem;
        position: relative;
        z-index: 1;
    }
    
    .material-textfield select {
        appearance: none;
    }
    
    .material-textfield label {
        position: absolute;
        top: 1rem;
        left: 1rem;
        color: #757575;
        pointer-events: none;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .material-textfield input:focus+label,
    .material-textfield input:not(:placeholder-shown)+label,
    .material-textfield select:focus+label,
    .material-textfield select:valid+label {
        top: 0.25rem;
        font-size: 0.75rem;
        color: #1976d2;
    }
    
    .material-textfield::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 2px;
        background-color: #1976d2;
        transform: scaleX(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .material-textfield input:focus~::after,
    .material-textfield select:focus~::after {
        transform: scaleX(1);
    }
    
    .material-textfield:has(select)::before {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        color: #757575;
    }
    
    /* Priority Selector (Used in Dialogs and Quick Add) */
    .priority-selector {
        display: flex;
        gap: 0.5rem;
    }
    
    .priority-btn {
        flex: 1;
        padding: 0.5rem;
        border: 2px solid #e0e0e0;
        border-radius: 4px;
        background: white;
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .priority-btn.high { color: #c62828; }
    .priority-btn.medium { color: #e65100; }
    .priority-btn.low { color: #2e7d32; }
    .priority-btn.active.high { background: #ffebee; border-color: #c62828; }
    .priority-btn.active.medium { background: #fff3e0; border-color: #e65100; }
    .priority-btn.active.low { background: #e8f5e9; border-color: #2e7d32; }
    
    
    /* ========================================= */
    /* Dialog System & Specific Dialog Styles  */
    /* ========================================= */
    
    .dialog-overlay {
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(0, 0, 0, 0.5);
        display: none;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.2s ease-out;
    }
    
    .dialog-main {
        background: #fff;
        border-radius: 12px;
        width: 90%;
        max-width: 500px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
        max-height: 90vh;
        animation: slideIn 0.3s ease-out;
    }
    
    .dialog-header { padding: 1.25rem; border-bottom: 1px solid #e0e0e0; font-size: 1.25rem; font-weight: 500; }
    .dialog-body { padding: 1.25rem; overflow-y: auto; }
    .dialog-footer { padding: 1rem 1.25rem; border-top: 1px solid #e0e0e0; display: flex; justify-content: flex-end; gap: 0.5rem; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
    
    .cat-dialog-section-title {
        font-size: 0.875rem;
        font-weight: 500;
        color: #757575;
        margin-bottom: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Category Dialog Specifics */
    .cat-dialog-preview { padding: 1rem; background-color: #f5f5f5; border-radius: 8px; margin-bottom: 1.5rem; }
    .cat-dialog-preview .list-item-material { background: #f5f5f5; border-bottom: none; padding: 0; }
    .cat-color-palette, .cat-icon-grid { display: grid; gap: 0.75rem; }
    .cat-color-palette { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
    .cat-icon-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
    .cat-color-swatch, .cat-icon-swatch { width: 100%; aspect-ratio: 1/1; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
    .cat-color-swatch { border-radius: 50%; }
    .cat-color-swatch.selected { border-color: #1976d2; transform: scale(1.1); box-shadow: 0 0 0 2px white; }
    .cat-icon-swatch { border-radius: 8px; background-color: #f5f5f5; color: #424242; font-size: 1.25rem; }
    .cat-icon-swatch.selected { background-color: #e3f2fd; color: #1976d2; border-color: #1976d2; }
    
    /* Completed Tasks Dialog List */
    .completed-tasks-list { display: flex; flex-direction: column; }
    .completed-task-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid #f0f0f0; }
    .completed-task-item:last-child { border-bottom: none; }
    .completed-task-content { display: flex; flex-direction: column; }
    .completed-task-title { text-decoration: line-through; color: #5f6368; }
    .completed-task-meta { font-size: 0.8rem; color: #9e9e9e; }
    
    .progress-circle {
    display: inline-block;
    position: relative; /* Needed for proper layering if required */
}

/* --- NEW: Styles for the progress bar --- */
.progress-circle-bar {
    /* Start the circle from the top (12 o'clock) instead of the side (3 o'clock) */
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    
    /* Add a smooth transition for the filling animation */
    transition: stroke-dashoffset 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

}