/* CRUD Pages - Shared Styles */
.page-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    font-family: 'Vazir', 'Tahoma', 'Arial', sans-serif;
}

/* Page Header */
.page-header {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.title-area h1.page-title {
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-area h1.page-title svg {
    color: #3b82f6;
    flex-shrink: 0;
}

.stats-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.stat-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-badge.total {
    background: #f3f4f6;
    color: #374151;
}

.stat-badge.completed {
    background: #dcfce7;
    color: #166534;
}

.stat-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.actions-area {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Filters Panel */
.filters-panel {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.form-select,
.form-control {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    font-family: inherit;
}

.form-select:focus,
.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-actions {
    display: flex;
    align-items: end;
}

/* Page Content */
.page-content {
    background: white;
    border-radius: 16px;
    min-height: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #9ca3af;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
}

.empty-state p {
    margin: 0 0 1.5rem 0;
    color: #6b7280;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.item-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
}

.item-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.item-card.completed {
    opacity: 0.8;
    background: #f9fafb;
}

.item-card.completed .item-title {
    text-decoration: line-through;
    color: #6b7280;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.item-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    line-height: 1.4;
}

.item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.action-btn {
    background: none;
    border: none;
    padding: 0.375rem;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.action-btn.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.item-body {
    margin-bottom: 1rem;
}

.item-description {
    margin: 0 0 1rem 0;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.priority-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-1 {
    background: #f3f4f6;
    color: #374151;
}

.priority-2 {
    background: #dbeafe;
    color: #1e40af;
}

.priority-3 {
    background: #fef3c7;
    color: #92400e;
}

.priority-4 {
    background: #fed7d7;
    color: #c53030;
}

.priority-5 {
    background: #fee2e2;
    color: #dc2626;
}

.due-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.due-date.overdue {
    color: #dc2626;
    font-weight: 600;
}

.item-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.checkbox-container input[type="checkbox"] {
    margin: 0;
}

.checkmark {
    font-weight: 500;
}

/* Form Styles */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.required {
    color: #dc2626;
}

.form-control,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.tag-checkbox:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.tag-checkbox input[type="checkbox"]:checked + .tag-label {
    font-weight: 600;
    color: #3b82f6;
}

/* Detail Styles */
.detail-container {
    padding: 1rem 0;
}

.detail-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.completed {
    background: #dcfce7;
    color: #166534;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.detail-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.detail-section p {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
}

.detail-section p.description {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.detail-value {
    font-size: 0.875rem;
    color: #6b7280;
}

.detail-value.overdue {
    color: #dc2626;
    font-weight: 600;
}

.overdue-text {
    font-weight: 700;
    color: #dc2626;
}

.detail-footer {
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.last-edit {
    color: #9ca3af;
    font-size: 0.75rem;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #374151;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-container {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .actions-area {
        justify-content: stretch;
    }
    
    .actions-area .btn {
        flex: 1;
        justify-content: center;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .item-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .item-actions {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .page-container {
        padding: 0.75rem;
    }
    
    .page-header,
    .filters-panel,
    .page-content {
        border-radius: 8px;
        padding: 1rem;
    }
    
    .stats-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-badge {
        justify-content: center;
    }
}



