/**
 * Agentic Vibe - Component Library
 * Reusable UI components for settings page
 *
 * @package WP_Agentic_Writer
 * @since 0.2.0
 */

/* ============================================
   Stat Cards
   ============================================ */

.wpaw-stat-card {
    background: var(--wpaw-bg-secondary);
    padding: var(--wpaw-space-md);
    border-radius: var(--wpaw-radius-md);
    border: 1px solid var(--wpaw-border);
    border-left: 3px solid var(--wpaw-primary);
    transition: all var(--wpaw-transition-normal);
    height: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wpaw-stat-card:hover {
    background: var(--wpaw-bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-left-width: 4px;
}

.wpaw-stat-label {
    font-size: var(--wpaw-text-xs);
    text-transform: uppercase;
    font-family: var(--wpaw-font-mono);
    letter-spacing: 0.05em;
    color: var(--wpaw-text-tertiary);
    margin-bottom: var(--wpaw-space-sm);
    font-weight: 600;
    display: block;
}

.wpaw-stat-value {
    font-size: var(--wpaw-text-3xl);
    font-weight: 700;
    color: var(--wpaw-primary);
    font-family: var(--wpaw-font-sans);
    line-height: 1.2;
    display: block;
}

.wpaw-stat-value.text-success {
    color: var(--wpaw-success);
}

.wpaw-stat-value.text-warning {
    color: var(--wpaw-warning);
}

.wpaw-stat-value.text-danger {
    color: var(--wpaw-error);
}

.wpaw-stat-value.text-info {
    color: var(--wpaw-info);
}

/* ============================================
   Status Badges
   ============================================ */

.wpaw-status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--wpaw-space-xs);
    padding: var(--wpaw-space-xs) var(--wpaw-space-sm);
    border-radius: var(--wpaw-radius-sm);
    font-size: var(--wpaw-text-sm);
    font-weight: 500;
    transition: all var(--wpaw-transition-fast);
}

.wpaw-status-online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--wpaw-success);
    border: 1px solid var(--wpaw-success);
}

.wpaw-status-offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--wpaw-error);
    border: 1px solid var(--wpaw-error);
}

.wpaw-status-processing {
    background: rgba(59, 130, 246, 0.1);
    color: var(--wpaw-primary);
    border: 1px solid var(--wpaw-primary);
}

.wpaw-status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--wpaw-warning);
    border: 1px solid var(--wpaw-warning);
}

/* ============================================
   Code/Monospace Elements
   ============================================ */

.wpaw-code,
.wpaw-settings-v2-wrap code {
    font-family: var(--wpaw-font-mono);
    background: var(--wpaw-bg-secondary);
    padding: 2px 6px;
    border-radius: var(--wpaw-radius-sm);
    font-size: 0.85em;
    color: var(--wpaw-text-primary);
    border: 1px solid var(--wpaw-border);
}

.wpaw-code-muted,
.text-muted {
    color: var(--wpaw-text-tertiary);
    font-family: var(--wpaw-font-mono);
}

.wpaw-code-block {
    font-family: var(--wpaw-font-mono);
    background: var(--wpaw-bg-secondary);
    padding: var(--wpaw-space-md);
    border-radius: var(--wpaw-radius-md);
    border: 1px solid var(--wpaw-border);
    overflow-x: auto;
    font-size: var(--wpaw-text-sm);
    line-height: 1.6;
}

/* ============================================
   Header Section
   ============================================ */

.wpaw-agentic-header {
    margin-bottom: var(--wpaw-space-xl);
}

.wpaw-agentic-header h1 {
    color: var(--wpaw-text-primary);
    margin-bottom: var(--wpaw-space-xs);
}

.wpaw-agentic-header .text-muted {
    color: var(--wpaw-text-secondary);
    font-family: var(--wpaw-font-mono);
}

/* ============================================
   Model Cards
   ============================================ */

.wpaw-model-card {
    background: var(--wpaw-bg-secondary);
    border: 1px solid var(--wpaw-border);
    border-radius: var(--wpaw-radius-md);
    padding: var(--wpaw-space-lg);
    transition: all var(--wpaw-transition-normal);
    height: 100%;
}

.wpaw-model-card:hover {
    border-color: var(--wpaw-primary);
    box-shadow: var(--wpaw-shadow-md);
    transform: translateY(-2px);
}

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

.wpaw-model-header h5 {
    margin-bottom: var(--wpaw-space-xs);
    color: var(--wpaw-text-primary);
    font-weight: 600;
}

.wpaw-model-header p {
    font-size: var(--wpaw-text-sm);
    color: var(--wpaw-text-tertiary);
    font-family: var(--wpaw-font-mono);
    margin: 0;
}

.wpaw-model-stat {
    margin-top: var(--wpaw-space-md);
}

.wpaw-model-stat label {
    font-size: var(--wpaw-text-xs);
    text-transform: uppercase;
    color: var(--wpaw-text-tertiary);
    margin-bottom: var(--wpaw-space-xs);
    font-weight: 600;
}

.wpaw-model-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--wpaw-space-md);
    padding-top: var(--wpaw-space-md);
    border-top: 1px solid var(--wpaw-border);
    margin-top: var(--wpaw-space-md);
}

.wpaw-metric {
    text-align: center;
}

.wpaw-metric-label {
    display: block;
    font-size: var(--wpaw-text-xs);
    text-transform: uppercase;
    color: var(--wpaw-text-tertiary);
    margin-bottom: var(--wpaw-space-xs);
    font-weight: 600;
}

.wpaw-metric-value {
    display: block;
    font-size: var(--wpaw-text-xl);
    font-weight: 600;
    color: var(--wpaw-primary);
    font-family: var(--wpaw-font-sans);
}

.wpaw-model-actions {
    margin-top: var(--wpaw-space-md);
}

/* ============================================
   Cost Table Enhancements
   ============================================ */

.wpaw-cost-table {
    font-size: var(--wpaw-text-sm);
}

.wpaw-cost-table thead {
    background: var(--wpaw-bg-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--wpaw-text-xs);
    letter-spacing: 0.05em;
}

.wpaw-cost-table tbody tr {
    transition: background-color var(--wpaw-transition-fast);
    border-left: 3px solid transparent;
}

.wpaw-cost-table tbody tr:hover {
    background: var(--wpaw-bg-secondary) !important;
}

.wpaw-cost-table tbody tr.row-success {
    border-left-color: var(--wpaw-success);
}

.wpaw-cost-table tbody tr.row-warning {
    border-left-color: var(--wpaw-warning);
}

.wpaw-cost-table tbody tr.row-error {
    border-left-color: var(--wpaw-error);
}

.wpaw-cost-table .wpaw-code {
    font-size: 0.85em;
}

/* ============================================
   Animations
   ============================================ */

/* Pulse Animation */
@keyframes wpaw-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.wpaw-animate-pulse {
    animation: wpaw-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spin Animation */
@keyframes wpaw-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.wpaw-animate-spin {
    animation: wpaw-spin 2s linear infinite;
}

/* Fade In */
@keyframes wpaw-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpaw-fade-in {
    animation: wpaw-fade-in 300ms ease-out;
}

/* Slide In Right */
@keyframes wpaw-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wpaw-slide-in-right {
    animation: wpaw-slide-in-right 300ms ease-out;
}

/* Scale In */
@keyframes wpaw-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wpaw-scale-in {
    animation: wpaw-scale-in 200ms ease-out;
}

/* Shimmer Loading */
@keyframes wpaw-shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.wpaw-shimmer {
    background: linear-gradient(
        90deg,
        var(--wpaw-bg-secondary) 0%,
        var(--wpaw-bg-tertiary) 50%,
        var(--wpaw-bg-secondary) 100%
    );
    background-size: 1000px 100%;
    animation: wpaw-shimmer 2s infinite;
}

/* ============================================
   Utility Classes
   ============================================ */

/* Hover Lift */
.wpaw-hover-lift {
    transition: transform var(--wpaw-transition-normal);
}

.wpaw-hover-lift:hover {
    transform: translateY(-4px);
}

/* Glow Effect */
.wpaw-glow-primary {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transition: box-shadow var(--wpaw-transition-normal);
}

.wpaw-glow-primary:hover {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
}

/* Smooth Height Transition */
.wpaw-smooth-height {
    transition: height var(--wpaw-transition-slow);
    overflow: hidden;
}

/* Icon Dot */
.wpaw-icon-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Loading Skeleton */
.wpaw-skeleton {
    background: var(--wpaw-bg-secondary);
    border-radius: var(--wpaw-radius-sm);
    animation: wpaw-shimmer 2s infinite;
}

.wpaw-skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.wpaw-skeleton-heading {
    height: 2em;
    margin-bottom: 1em;
}

/* Divider */
.wpaw-divider {
    height: 1px;
    background: var(--wpaw-border);
    margin: var(--wpaw-space-lg) 0;
}

.wpaw-divider-vertical {
    width: 1px;
    background: var(--wpaw-border);
    margin: 0 var(--wpaw-space-md);
}

/* Section Spacing */
.wpaw-section {
    margin-bottom: var(--wpaw-space-2xl);
}

.wpaw-section-header {
    margin-bottom: var(--wpaw-space-lg);
}

.wpaw-section-title {
    font-size: var(--wpaw-text-2xl);
    font-weight: 600;
    color: var(--wpaw-text-primary);
    margin-bottom: var(--wpaw-space-xs);
}

.wpaw-section-description {
    font-size: var(--wpaw-text-sm);
    color: var(--wpaw-text-secondary);
}

/* Empty State */
.wpaw-empty-state {
    text-align: center;
    padding: var(--wpaw-space-3xl) var(--wpaw-space-xl);
    color: var(--wpaw-text-tertiary);
}

.wpaw-empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--wpaw-space-md);
    opacity: 0.5;
}

.wpaw-empty-state-title {
    font-size: var(--wpaw-text-lg);
    font-weight: 600;
    color: var(--wpaw-text-secondary);
    margin-bottom: var(--wpaw-space-sm);
}

.wpaw-empty-state-description {
    font-size: var(--wpaw-text-sm);
    color: var(--wpaw-text-tertiary);
}

/* ============================================
   Responsive Utilities
   ============================================ */

@media (max-width: 768px) {
    .wpaw-stat-card {
        margin-bottom: var(--wpaw-space-md);
    }

    .wpaw-model-metrics {
        grid-template-columns: 1fr;
        gap: var(--wpaw-space-sm);
    }

    .wpaw-section {
        margin-bottom: var(--wpaw-space-xl);
    }

    .wpaw-stat-value {
        font-size: var(--wpaw-text-2xl);
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .wpaw-settings-v2-wrap {
        background: white;
        color: black;
    }

    .wpaw-stat-card,
    .wpaw-model-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .wpaw-animate-pulse,
    .wpaw-animate-spin {
        animation: none;
    }
}

/* GEO Score Indicator */
.wpaw-geo-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--wpaw-bg-secondary);
    border-top: 1px solid var(--wpaw-border);
    font-size: var(--wpaw-text-sm);
}

.wpaw-geo-score {
    font-weight: 600;
}

.wpaw-geo-score.excellent {
    color: var(--wpaw-success);
}

.wpaw-geo-score.good {
    color: var(--wpaw-info);
}

.wpaw-geo-score.fair {
    color: var(--wpaw-warning);
}

.wpaw-geo-score.poor {
    color: var(--wpaw-error);
}

.wpaw-geo-eligible {
    background: var(--wpaw-success);
    color: #000;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Session edit-lock banner (multi-tab safety) */
.wpaw-session-lock-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    margin: 0 0 4px;
    background: var(--wpaw-warning-bg, #fef3cd);
    border: 1px solid var(--wpaw-warning-border, #ffc107);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--wpaw-warning-text, #856404);
}

.dark-theme .wpaw-session-lock-banner {
    background: rgba(255, 193, 7, 0.12);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.dark-theme .wpaw-session-lock-banner button {
    color: #ffc107;
    background-color: unset;
    border: 1px solid #ffc107;
    outline: unset !important;
    box-shadow: unset !important;
}

.dark-theme .wpaw-session-lock-banner button:is(:hover, :focus) {
    color: #2c3137 !important;
    background-color: #ffc107 !important;
    outline: unset !important;
    box-shadow: unset !important;
}

.wpaw-session-lock-takeover {
    flex-shrink: 0;
    white-space: nowrap;
}
