/**
 * Wisewand Dashboard Redesign (v1.7.5+)
 * "Silicon Valley SaaS" Aesthetic
 */

:root {
    /* Color Palette */
    --wisewand-bg: #f8fafc;
    --wisewand-surface: #ffffff;
    --wisewand-primary: #6366f1; /* Indigo 500 */
    --wisewand-primary-hover: #4f46e5; /* Indigo 600 */
    --wisewand-text-main: #1e293b; /* Slate 800 */
    --wisewand-text-muted: #64748b; /* Slate 500 */
    --wisewand-border: #e2e8f0; /* Slate 200 */
    --wisewand-success: #10b981; /* Emerald 500 */
    --wisewand-warning: #f59e0b; /* Amber 500 */
    --wisewand-danger: #ef4444; /* Red 500 */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Spacing */
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    
    /* Radius */
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Reset & Base */
.wisewand-dashboard-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--wisewand-text-main);
    background-color: var(--wisewand-bg);
    margin: 0 -20px 0 -20px; /* Break out of WP wrap padding */
    padding: var(--space-8);
    min-height: calc(100vh - 32px);
    box-sizing: border-box;
}

.wisewand-dashboard-page * {
    box-sizing: border-box;
}

/* Header Section */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
}

.header-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--wisewand-text-main);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.header-subtitle {
    color: var(--wisewand-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

/* Buttons */
.ww-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    gap: 0.5rem;
}

.ww-btn-primary {
    background-color: var(--wisewand-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.ww-btn-primary:hover {
    background-color: var(--wisewand-primary-hover);
    color: white;
    transform: translateY(-1px);
}

.ww-btn-secondary {
    background-color: white;
    color: var(--wisewand-text-main);
    border-color: var(--wisewand-border);
    box-shadow: var(--shadow-sm);
}

.ww-btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: var(--wisewand-text-main);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.metric-card {
    background: var(--wisewand-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--wisewand-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.metric-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wisewand-text-muted);
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background-color: #f1f5f9;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--wisewand-text-main);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-up { color: var(--wisewand-success); }
.trend-down { color: var(--wisewand-danger); }
.trend-neutral { color: var(--wisewand-text-muted); }

/* Main Layout Grid */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 and 1/3 layout */
    gap: var(--space-8);
}

@media (max-width: 1024px) {
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

/* Content Cards */
.content-card {
    background: var(--wisewand-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--wisewand-border);
    margin-bottom: var(--space-8);
    overflow: hidden;
}

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--wisewand-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wisewand-text-main);
    margin: 0;
}

.card-body {
    padding: var(--space-6);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--wisewand-border);
}

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

.activity-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-4);
    flex-shrink: 0;
}

.activity-details {
    flex-grow: 1;
}

.activity-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wisewand-text-main);
    margin-bottom: 0.25rem;
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--wisewand-text-muted);
}

.activity-action {
    opacity: 0;
    transition: opacity 0.2s;
}

.activity-item:hover .activity-action {
    opacity: 1;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-success { background-color: #dcfce7; color: #166534; }
.status-warning { background-color: #fef3c7; color: #92400e; }
.status-error { background-color: #fee2e2; color: #991b1b; }
.status-neutral { background-color: #f1f5f9; color: #475569; }

/* System Health List */
.health-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
}

.health-label {
    font-size: 0.875rem;
    color: var(--wisewand-text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.health-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--wisewand-border);
}

.health-status-dot.active { background-color: var(--wisewand-success); box-shadow: 0 0 0 2px #dcfce7; }
.health-status-dot.issue { background-color: var(--wisewand-warning); }
.health-status-dot.offline { background-color: var(--wisewand-danger); }

/* Quick Links */
.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.quick-link-card {
    background: #f8fafc;
    border: 1px solid var(--wisewand-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
    text-decoration: none;
    color: var(--wisewand-text-main);
    transition: all 0.2s;
}

.quick-link-card:hover {
    background: white;
    border-color: var(--wisewand-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quick-link-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.quick-link-text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Footer */
.dashboard-footer {
    margin-top: var(--space-8);
    text-align: center;
    color: var(--wisewand-text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--wisewand-border);
    padding-top: var(--space-6);
}

.footer-links a {
    color: var(--wisewand-text-muted);
    margin: 0 0.5rem;
    text-decoration: none;
}

/* Automation Hub */
.automation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.automation-card {
    background: #f8fafc;
    border: 1px solid var(--wisewand-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all 0.2s;
}

.automation-card:hover {
    background: white;
    border-color: var(--wisewand-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.automation-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.automation-icon.status-check { background: #e0e7ff; color: #4338ca; }
.automation-icon.daily-gen { background: #dbeafe; color: #1e40af; }
.automation-icon.rss-sync { background: #fae8ff; color: #86198f; }

.automation-content {
    flex-grow: 1;
}

.automation-title {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wisewand-text-main);
}

.automation-meta {
    margin: 0;
    font-size: 0.75rem;
    color: var(--wisewand-text-muted);
}

.run-automation {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Credit balance card states */
.metric-card.credits-ok {
    border-left: 3px solid var(--wisewand-success);
}

.metric-card.credits-low {
    border-left: 3px solid var(--wisewand-warning);
}

.metric-card.credits-empty {
    border-left: 3px solid var(--wisewand-danger);
}

.metric-card.credits-unknown {
    border-left: 3px solid var(--wisewand-border);
}

.metric-card .trend-link {
    color: var(--wisewand-text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.metric-card .trend-link:hover {
    color: var(--wisewand-primary);
}
