/**
 * Enhanced Tasks Styles for ALBND
 * PKG-08 Tasks - Complete Task Management
 */

/* ============================================
   Statistics Cards
   ============================================ */
.tasks-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-total .stat-icon { background: rgba(76, 196, 255, 0.15); color: var(--primary); }
.stat-pending .stat-icon { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.stat-progress .stat-icon { background: rgba(76, 196, 255, 0.15); color: var(--primary); }
.stat-completed .stat-icon { background: rgba(32, 204, 118, 0.15); color: var(--success); }
.stat-overdue .stat-icon { background: rgba(220, 53, 69, 0.15); color: #dc3545; }
.stat-overdue.has-overdue { border-color: #dc3545; animation: pulse-danger 2s infinite; }

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Toolbar
   ============================================ */
.tasks-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
}

.view-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--primary);
    color: white;
}

.filter-select {
    min-width: 140px;
    padding: 8px 12px;
    font-size: 14px;
}

/* ============================================
   Tasks Grid (List View)
   ============================================ */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.tasks-card .card-body {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
}

.tasks-list {
    display: flex;
    flex-direction: column;
}

/* ============================================
   Task Card
   ============================================ */
.task-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.task-card:hover {
    background: var(--bg-hover);
}

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

.task-card.completed {
    opacity: 0.6;
}

.task-card.completed .task-title {
    text-decoration: line-through;
}

.task-card.overdue:not(.completed) {
    background: rgba(220, 53, 69, 0.08);
    border-left: 3px solid #dc3545;
}

.task-checkbox {
    padding-top: 2px;
}

.task-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.task-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.task-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-meta .text-danger {
    color: #dc3545 !important;
    font-weight: 500;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-menu {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-card:hover .task-menu {
    opacity: 1;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-icon.text-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* ============================================
   Kanban Board
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    min-height: 500px;
}

.kanban-column {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.kanban-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.kanban-header i {
    font-size: 16px;
}

.kanban-cards {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.kanban-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kanban-card.overdue {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.kanban-card-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.kanban-card-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.kanban-card-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   Modal Enhancements
   ============================================ */
.task-detail-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.task-detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.task-detail-section {
    margin-bottom: 20px;
}

.task-detail-section label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.task-detail-section p {
    color: var(--text-primary);
    line-height: 1.6;
}

.task-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
}

.detail-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-item span {
    font-weight: 500;
    color: var(--text-primary);
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

/* ============================================
   Badge Variants
   ============================================ */
.badge-sm {
    font-size: 10px;
    padding: 2px 6px;
}

.badge-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #d39e00;
}

.badge-info {
    background: rgba(76, 196, 255, 0.15);
    color: var(--primary);
}

.badge-success {
    background: rgba(32, 204, 118, 0.15);
    color: var(--success);
}

/* ============================================
   Loading State
   ============================================ */
.tasks-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.tasks-loading i {
    font-size: 32px;
    color: var(--primary);
}

/* ============================================
   Empty State (Small)
   ============================================ */
.empty-state.small {
    padding: 40px 20px;
}

.empty-state.small i {
    font-size: 32px;
}

.empty-state.small p {
    font-size: 14px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .tasks-grid {
        grid-template-columns: 1fr;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .kanban-column {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .tasks-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tasks-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .task-card {
        flex-wrap: wrap;
    }
    
    .task-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }
    
    .task-menu {
        opacity: 1;
    }
}

/* ============================================
   RTL Support
   ============================================ */
[dir="rtl"] .task-card.overdue:not(.completed) {
    border-left: none;
    border-right: 3px solid #dc3545;
}

[dir="rtl"] .kanban-card-footer {
    flex-direction: row-reverse;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg, #1a1a2e);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color, #2a2a4a);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 700px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
    background: var(--card-header-bg, #0f0f1a);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary-color, var(--primary));
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color, #2a2a4a);
    background: var(--card-header-bg, #0f0f1a);
}

/* Form Styles inside Modal */
.modal-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body .form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-muted, #aaa);
    font-weight: 500;
}

.modal-body .form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg, #0a0a15);
    border: 1px solid var(--border-color, #2a2a4a);
    border-radius: 6px;
    color: var(--text-primary, #fff);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary-color, var(--primary));
    box-shadow: 0 0 0 3px rgba(76, 196, 255, 0.1);
}

.modal-body textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.modal-body select.form-control {
    cursor: pointer;
}

/* Task Details in Modal */
.task-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.task-detail-item {
    background: var(--input-bg, #0a0a15);
    padding: 12px;
    border-radius: 8px;
}

.task-detail-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-detail-item span {
    font-size: 0.95rem;
    color: var(--text-primary, #fff);
}

/* Responsive */
@media (max-width: 600px) {
    .modal-body .form-row {
        grid-template-columns: 1fr;
    }
    
    .task-details-grid {
        grid-template-columns: 1fr;
    }
}
