/* Modal Components */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

/* Progress Components */
.progress-info {
    margin-bottom: 1.5rem;
}

.progress-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.progress-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-messages {
    max-height: 200px;
    overflow-y: auto;
    background: var(--background-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.progress-message {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.progress-message:last-child {
    border-bottom: none;
}

.progress-message .timestamp {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-right: 1rem;
    min-width: 60px;
}

.progress-message .message {
    flex: 1;
}

.progress-message.success {
    color: var(--success-color);
}

.progress-message.error {
    color: var(--danger-color);
}

.progress-message.info {
    color: var(--primary-color);
}

/* Notification Components */
.notifications-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.notification {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
    animation: notificationSlideIn 0.3s ease;
    position: relative;
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
}

.notification-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Chart Components */
.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: var(--background-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.chart-placeholder .chart-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chart-placeholder .chart-text {
    font-size: 0.875rem;
    text-align: center;
}

/* Simple Bar Chart */
.bar-chart {
    display: flex;
    align-items: end;
    gap: 0.5rem;
    height: 200px;
    padding: 1rem 0;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar {
    width: 100%;
    background: var(--primary-color);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.bar:hover {
    background: var(--primary-hover);
    transform: scaleY(1.05);
}

.bar-value {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bar:hover .bar-value {
    opacity: 1;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-word;
}

/* Simple Pie Chart */
.pie-chart {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

.pie-visual {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(
        var(--success-color) 0deg 120deg,
        var(--warning-color) 120deg 240deg,
        var(--danger-color) 240deg 360deg
    );
}

.pie-legend {
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 600;
    color: var(--text-primary);
    margin-left: auto;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-online .status-dot {
    background: var(--success-color);
}

.status-offline .status-dot {
    background: var(--danger-color);
}

.status-processing .status-dot {
    background: var(--warning-color);
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--surface-color);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state .empty-message {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    max-width: 400px;
}

/* Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .notifications-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0f172a;
        --surface-color: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }
}

/* Print styles */
@media print {
    .modal,
    .notifications-container,
    .header-actions,
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .content-area {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}
/* Export functionality */
.export-section {
    margin: 2rem 0;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.export-buttons .btn {
    min-width: 120px;
}

/* Action buttons for table rows */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-vcard {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.btn-vcard::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.3s ease;
}

.btn-vcard:hover::before {
    left: 100%;
}

.btn-vcard:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-vcard:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Mobile responsive for action buttons */
@media (max-width: 768px) {
    .btn-vcard {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.3rem;
    }
}