/**
 * Modern Component Library
 * shadcn-inspired components for WordPress
 * CSS-only implementation for maximum compatibility
 * Version: 1.0.0
 */

/* ============================================
   MODERN CARD COMPONENTS
   ============================================ */

/* Base Card */
.component-card {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.component-card:hover {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Card with Header */
.component-card-header {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.component-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #18181b;
}

.component-card-description {
    font-size: 0.875rem;
    color: #71717a;
    margin-top: 0.25rem;
}

.component-card-content {
    padding: 0;
}

.component-card-footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Interactive Card */
.component-card-interactive {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.component-card-interactive::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    opacity: 0;
    transition: opacity 0.3s;
}

.component-card-interactive:hover::before {
    opacity: 1;
}

/* Elevated Card */
.component-card-elevated {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: none;
}

/* Ghost Card */
.component-card-ghost {
    background: transparent;
    border: 2px dashed rgba(0, 0, 0, 0.12);
}

/* ============================================
   BADGES & LABELS
   ============================================ */

.component-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Badge Variants */
.component-badge-default {
    background: #f4f4f5;
    color: #18181b;
}

.component-badge-primary {
    background: #6366f1;
    color: white;
}

.component-badge-secondary {
    background: #8b5cf6;
    color: white;
}

.component-badge-success {
    background: #10b981;
    color: white;
}

.component-badge-warning {
    background: #f59e0b;
    color: white;
}

.component-badge-error {
    background: #ef4444;
    color: white;
}

/* Outline Badges */
.component-badge-outline {
    background: transparent;
    border: 1px solid currentColor;
}

.component-badge-outline.component-badge-primary {
    color: #6366f1;
}

.component-badge-outline.component-badge-secondary {
    color: #8b5cf6;
}

/* Badge with Dot */
.component-badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   ALERT COMPONENTS
   ============================================ */

.component-alert {
    position: relative;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.component-alert-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.component-alert-content {
    flex: 1;
}

.component-alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.component-alert-description {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Alert Variants */
.component-alert-info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

.component-alert-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.component-alert-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #b45309;
}

.component-alert-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* ============================================
   ACCORDION COMPONENTS
   ============================================ */

.component-accordion {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    overflow: hidden;
}

.component-accordion-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

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

.component-accordion-trigger {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: white;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #18181b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.component-accordion-trigger:hover {
    background: #f9fafb;
}

.component-accordion-trigger[aria-expanded="true"] {
    background: #f4f4f5;
}

.component-accordion-icon {
    transition: transform 0.3s;
}

.component-accordion-trigger[aria-expanded="true"] .component-accordion-icon {
    transform: rotate(180deg);
}

.component-accordion-content {
    padding: 0 1.5rem 1.25rem;
    color: #52525b;
    font-size: 0.9375rem;
    line-height: 1.7;
}

/* ============================================
   TAB COMPONENTS
   ============================================ */

.component-tabs {
    width: 100%;
}

.component-tabs-list {
    display: flex;
    border-bottom: 2px solid #f4f4f5;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.component-tabs-trigger {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #71717a;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    border-radius: 0.375rem 0.375rem 0 0;
}

.component-tabs-trigger:hover {
    color: #18181b;
    background: #f9fafb;
}

.component-tabs-trigger[aria-selected="true"] {
    color: #6366f1;
    font-weight: 600;
}

.component-tabs-trigger[aria-selected="true"]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366f1;
}

.component-tabs-content {
    animation: fadeIn 0.3s;
}

/* Pills variant */
.component-tabs-pills .component-tabs-list {
    border-bottom: none;
    gap: 0.5rem;
}

.component-tabs-pills .component-tabs-trigger {
    border-radius: 9999px;
    padding: 0.5rem 1rem;
}

.component-tabs-pills .component-tabs-trigger[aria-selected="true"] {
    background: #6366f1;
    color: white;
}

.component-tabs-pills .component-tabs-trigger[aria-selected="true"]::after {
    display: none;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

.component-skeleton {
    background: linear-gradient(
        90deg,
        #f4f4f5 0%,
        #e4e4e7 50%,
        #f4f4f5 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

.component-skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.component-skeleton-heading {
    height: 2rem;
    margin-bottom: 1rem;
}

.component-skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.component-skeleton-button {
    height: 2.5rem;
    width: 8rem;
}

.component-skeleton-card {
    height: 12rem;
    width: 100%;
}

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

/* ============================================
   AVATAR COMPONENTS
   ============================================ */

.component-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e4e4e7;
    color: #52525b;
    font-weight: 600;
    overflow: hidden;
}

.component-avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.component-avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.component-avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.component-avatar-xl {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
}

.component-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Avatar with status */
.component-avatar-status {
    position: relative;
}

.component-avatar-status::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 25%;
    height: 25%;
    border-radius: 50%;
    border: 2px solid white;
}

.component-avatar-status-online::after {
    background: #10b981;
}

.component-avatar-status-offline::after {
    background: #71717a;
}

.component-avatar-status-busy::after {
    background: #ef4444;
}

/* Avatar Group */
.component-avatar-group {
    display: flex;
    align-items: center;
}

.component-avatar-group .component-avatar {
    margin-left: -0.75rem;
    border: 2px solid white;
}

.component-avatar-group .component-avatar:first-child {
    margin-left: 0;
}

/* ============================================
   MODAL/DIALOG COMPONENTS
   ============================================ */

.component-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    animation: fadeIn 0.2s;
}

.component-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    z-index: 1000;
    animation: scaleIn 0.2s;
}

.component-modal-sm {
    width: 400px;
}

.component-modal-md {
    width: 600px;
}

.component-modal-lg {
    width: 800px;
}

.component-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.component-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.component-modal-close {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #71717a;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.component-modal-close:hover {
    background: #f4f4f5;
    color: #18181b;
}

.component-modal-content {
    padding: 1.5rem;
}

.component-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================
   PROGRESS INDICATORS
   ============================================ */

.component-progress {
    width: 100%;
    height: 0.5rem;
    background: #f4f4f5;
    border-radius: 9999px;
    overflow: hidden;
}

.component-progress-bar {
    height: 100%;
    background: #6366f1;
    border-radius: 9999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.component-progress-striped .component-progress-bar {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.component-progress-animated .component-progress-bar {
    animation: progressStripe 1s linear infinite;
}

@keyframes progressStripe {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* Circular Progress */
.component-progress-circular {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 3px solid #f4f4f5;
    border-top-color: #6366f1;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   BREADCRUMBS
   ============================================ */

.component-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #71717a;
}

.component-breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.component-breadcrumb-link {
    color: #71717a;
    text-decoration: none;
    transition: color 0.2s;
}

.component-breadcrumb-link:hover {
    color: #18181b;
}

.component-breadcrumb-current {
    color: #18181b;
    font-weight: 500;
}

.component-breadcrumb-separator {
    color: #d4d4d8;
}

/* ============================================
   TOOLTIPS
   ============================================ */

.component-tooltip {
    position: relative;
    display: inline-block;
}

.component-tooltip-content {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #18181b;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.component-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #18181b;
}

.component-tooltip:hover .component-tooltip-content {
    opacity: 1;
}

/* ============================================
   DIVIDERS
   ============================================ */

.component-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 1.5rem 0;
}

.component-divider-vertical {
    width: 1px;
    height: 100%;
    background: rgba(0, 0, 0, 0.08);
    margin: 0 1.5rem;
}

.component-divider-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    color: #71717a;
}

.component-divider-text::before,
.component-divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Animation utilities */
.animate-fade-in {
    animation: fadeIn 0.3s;
}

.animate-scale-in {
    animation: scaleIn 0.3s;
}

.animate-slide-up {
    animation: slideUp 0.3s;
}

.animate-slide-down {
    animation: slideDown 0.3s;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.component-interactive {
    cursor: pointer;
    transition: all 0.2s;
}

.component-interactive:hover {
    opacity: 0.8;
}

.component-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.component-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.component-line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.component-line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
