/* dashboard.css - Dashboard component styles */

dashboard-component {
    display: block;
}

/* Mobile header */
.dashboard-mobile-header {
    text-align: center;
    padding: 20px 10px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.dashboard-mobile-header h2 {
    margin: 0 0 8px 0;
    color: white;
    font-size: 1.5rem;
}

.mobile-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.custom-hr {
    border: none;
    height: 3px;
    background-color: purple;
    width: 75%;
    margin: 20px auto; /* Centers the rule horizontally */
}

.dashboard-container {
    /* margin: 0 auto; */
    width: 100%;
}

.dashboard-title {
    margin-bottom: 30px;
    color: var(--text-dark);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-green));
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
    color: var(--white);
}

.card-icon.campaigns {
    background: linear-gradient(135deg, var(--primary-purple), var(--purple-light));
}

.card-icon.revenue {
    background: linear-gradient(135deg, var(--primary-green), var(--green-light));
}

.card-icon.engagement {
    background: linear-gradient(135deg, var(--purple-dark), var(--primary-purple));
}

.card-icon.customers {
    background: linear-gradient(135deg, var(--green-dark), var(--primary-green));
}

.card-icon.insights {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.card-icon.learning {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-dark);
    margin: 0;
}

.card-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1;
}

.card-subtitle {
    font-size: 14px;
    color: var(--gray-dark);
    margin: 0;
}

.card-subtitle-small {
    font-size: 12px;
    color: var(--gray-dark);
    margin: 0 0 8px 0;
}

/* Learning card mini progress */
.card-progress-mini {
    margin-top: 8px;
}

.progress-unit-name {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-bar-mini {
    height: 6px;
    background: var(--gray-light, #e9ecef);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-green));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.card-trend {
    display: flex;
    align-items: center;
    margin-top: 15px;
    font-size: 14px;
}

.trend-positive {
    color: var(--primary-green);
}

.trend-negative {
    color: #e74c3c;
}

.trend-icon {
    margin-right: 5px;
    font-weight: bold;
}

/* Recent Activity Section */
.recent-activity {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 10px;
    box-shadow: var(--shadow);
}

.activity-title {
    margin-bottom: 15px;
    color: var(--text-dark);
}

.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-medium);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 16px;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: var(--gray-dark);
}

/* Tablet responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dashboard-card {
        padding: 20px;
    }

    .card-value {
        font-size: 28px;
    }

    .recent-activity {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .dashboard-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    .dashboard-card {
        /* Ensure adequate touch target size */
        min-height: 180px;
        padding: 24px 20px;
    }

    .card-header {
        margin-bottom: 15px;
    }

    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .card-value {
        font-size: 24px;
    }

    .card-title {
        font-size: 15px;
    }

    .activity-item {
        padding: 15px 0;
        /* Increased touch target */
    }
}

/* Empty State Styles */
.dashboard-card.empty {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
}

.dashboard-card.empty:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(139, 126, 200, 0.25);
}

.dashboard-card.empty .card-header {
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 20px 10px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-message {
    font-size: 16px;
    color: var(--gray-dark);
    margin: 10px 0;
    font-weight: 500;
}

.empty-cta {
    font-size: 14px;
    color: var(--primary-purple);
    margin: 10px 0 0 0;
    font-weight: 600;
}

/* Clickable Cards */
.dashboard-card[data-navigate] {
    cursor: pointer;
}

.dashboard-card[data-navigate]:not(.empty) {
    transition: all 0.3s ease;
}

/* Loading Skeleton Styles */
.dashboard-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.card-skeleton {
    display: flex;
    flex-direction: column;
}

.skeleton-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    margin-bottom: 20px;
}

.skeleton-title {
    width: 60%;
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    margin-bottom: 20px;
}

.skeleton-value {
    width: 40%;
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

.skeleton-subtitle {
    width: 80%;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.dashboard-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-dark);
    font-size: 16px;
}

/* Activity Loading/Empty States */
.activity-loading,
.activity-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--gray-dark);
    font-size: 14px;
}

.activity-empty p {
    margin: 0;
    line-height: 1.6;
}

/* Clickable Activity Items */
.activity-item[data-link] {
    transition: background-color 0.2s ease;
}

.activity-item[data-link]:hover {
    background-color: #f9fafb;
    cursor: pointer;
}

/* ========================================================================
   AI Insights Preview
   ======================================================================== */

.latest-insight-preview {
    margin-top: 16px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid var(--primary-purple);
}

.insight-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-dark);
    font-style: italic;
    margin-bottom: 8px;
}

.insight-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.insight-time {
    color: var(--gray-dark);
}

.view-all-link {
    color: var(--primary-purple);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.view-all-link:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* Enhanced insights card */
.dashboard-card.insights-preview {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card.insights-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 126, 200, 0.2);
}
