/* Analytics Dashboard Styles */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e3f2fd;
}

.analytics-header h2 {
    color: #1976d2;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.analytics-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.analytics-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.refresh-analytics {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-analytics:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Analytics Grid Layout */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.metric-content {
    flex: 1;
}

.metric-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    transition: transform 0.2s ease;
}

.metric-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Analytics Cards */
.analytics-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
}

.analytics-card.full-width {
    grid-column: 1 / -1;
}

.analytics-card h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Conversion Funnel Styles */
.funnel-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.funnel-bar {
    height: 50px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    color: white;
    font-weight: 600;
    min-width: 150px;
    transition: width 0.3s ease;
}

.funnel-label {
    font-size: 0.9rem;
}

.funnel-count {
    font-size: 1.1rem;
    font-weight: 700;
}

.funnel-rate {
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    min-width: 50px;
    text-align: center;
}

/* Property Performance Styles */
.performance-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.property-performance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #1976d2;
}

.property-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.property-id {
    font-weight: 600;
    color: #333;
}

.property-source {
    font-size: 0.8rem;
    color: #666;
    text-transform: capitalize;
}

.property-metrics {
    display: flex;
    gap: 1.5rem;
}

.property-metrics .metric {
    text-align: center;
}

.property-metrics .metric-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1976d2;
}

.property-metrics .metric-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Registration Trends Styles */
.trends-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.trend-date {
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.trend-metrics {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.trend-bar {
    height: 20px;
    background: #2ecc71;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 30px;
    transition: width 0.3s ease;
}

.trend-count {
    font-size: 0.8rem;
}

.trend-type {
    font-size: 0.8rem;
    color: #666;
    text-transform: capitalize;
    min-width: 120px;
}

/* Activity Feed Styles */
.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.activity-icon.registration {
    background: #2ecc71;
}

.activity-icon.property-click {
    background: #3498db;
}

.activity-icon.document-sign {
    background: #e74c3c;
}

.activity-content {
    flex: 1;
}

.activity-description {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.activity-details {
    font-size: 0.8rem;
    color: #666;
}

.activity-time {
    font-size: 0.75rem;
    color: #999;
    min-width: 80px;
    text-align: right;
}

/* Analytics Error State */
.analytics-error {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.analytics-error h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.analytics-error button {
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .analytics-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .analytics-controls {
        justify-content: center;
    }

    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-number {
        font-size: 1.5rem;
    }

    .property-performance-item {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .property-metrics {
        justify-content: space-around;
    }

    .trend-item {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .trend-metrics {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .metrics-row {
        grid-template-columns: 1fr;
    }

    .analytics-card {
        padding: 1rem;
    }

    .funnel-bar {
        height: 40px;
        padding: 0 0.75rem;
    }

    .funnel-label,
    .funnel-count {
        font-size: 0.8rem;
    }
}

/* Animation Classes */
.metric-card.updating {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.analytics-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.analytics-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Chart Styles */
.chart-container {
    position: relative;
    height: 200px;
    margin: 1rem 0;
}

.chart-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.chart-bar:hover {
    transform: scaleY(1.05);
    filter: brightness(1.1);
}

/* Data Table Styles for Analytics */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.analytics-table th,
.analytics-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.analytics-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
}

.analytics-table tr:hover {
    background: #f9f9f9;
}

/* Export Button */
.export-analytics {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.export-analytics:hover {
    background: #27ae60;
    transform: translateY(-1px);
}
