/* ===================================
   Table Toolbar Styles
   =================================== */

.table-toolbar {
    animation: slideInDown 0.4s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toolbar Buttons Hover Effects */
.toolbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.toolbar-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

#export-excel-btn:hover {
    background: #059669 !important;
}

#export-pdf-btn:hover {
    background: #dc2626 !important;
}

#print-table-btn:hover {
    background: #2563eb !important;
}

#refresh-table-btn:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Loading State for Refresh Button */
#refresh-table-btn.loading .fa-sync-alt {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* View Toggle Buttons */
.view-btn {
    transition: all 0.3s ease;
}

.view-btn:hover:not(.active) {
    background: rgba(255,255,255,0.1) !important;
    color: white !important;
}

.view-btn.active {
    background: white !important;
    color: #667eea !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ===================================
   Cards View Styles
   =================================== */

.view-container {
    transition: opacity 0.3s ease;
}

.view-container:not(.active) {
    display: none;
}

.cards-grid {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Client Card */
.client-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.client-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.card-main-info {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-file-number {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-file-number i {
    color: #667eea;
}

.card-file-number.dasht {
    color: #ef4444;
    font-weight: 600;
}

.card-file-number.dasht i {
    color: #ef4444;
}

/* Card Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
}

.card-info-row i {
    width: 20px;
    color: #667eea;
    margin-top: 2px;
    flex-shrink: 0;
}

.card-info-label {
    font-weight: 500;
    color: #6b7280;
    min-width: 100px;
    flex-shrink: 0;
}

.card-info-value {
    color: #1f2937;
    flex: 1;
    word-break: break-word;
}

/* Card Footer */
.card-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.card-date {
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-date i {
    color: #667eea;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.card-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* Card Badges */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.card-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-badge.vat-badge {
    background: #dbeafe;
    color: #1e40af;
}

.card-badge.law6-badge {
    background: #fef3c7;
    color: #92400e;
}

.card-badge.inv-badge {
    background: #d1fae5;
    color: #065f46;
}

.card-badge.social-insurance-badge {
    background: #e0e7ff;
    color: #3730a3;
}

/* Responsive */
@media (max-width: 768px) {
    .table-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }
    
    .toolbar-right,
    .toolbar-left {
        justify-content: center;
    }
    
    .toolbar-btn span,
    .view-btn span {
        display: none;
    }
    
    .toolbar-btn,
    .view-btn {
        padding: 8px 12px !important;
    }
    
    .cards-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .toolbar-right {
        flex-wrap: wrap;
    }
    
    .card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .card-info-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .card-info-label {
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    .table-toolbar {
        display: none !important;
    }
    
    #cards-view {
        display: none !important;
    }
    
    #table-view {
        display: block !important;
    }
}

/* Dark Mode Support (إذا كان موجود) */
@media (prefers-color-scheme: dark) {
    .client-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .card-header {
        border-bottom-color: #374151;
    }
    
    .card-title {
        color: #f9fafb;
    }
    
    .card-info-label {
        color: #9ca3af;
    }
    
    .card-info-value {
        color: #e5e7eb;
    }
    
    .card-footer {
        border-top-color: #374151;
    }
    
    .card-action-btn {
        background: #374151;
        border-color: #4b5563;
        color: #9ca3af;
    }
    
    .card-action-btn:hover {
        background: #667eea;
        color: white;
        border-color: #667eea;
    }
}
