/**
 * Reusable UI Components
 *
 * Modern, production-ready components:
 * - Enhanced cards with glassmorphism
 * - Timeline components
 * - Avatar & avatar groups
 * - Progress indicators
 * - Empty state illustrations
 * - Alert & notification banners
 * - Chips & tags
 * - List items
 * - Action sheets
 */

/* ============================================================================
   ENHANCED CARDS
   ============================================================================ */
/* Glassmorphism card */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Card with gradient border */
.card-gradient-border {
    position: relative;
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.card-gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 2px;
    background: linear-gradient(135deg, var(--accent), #3b82f6, #8b5cf6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Hover lift card */
.card-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-lift:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Card with ribbon */
.card-ribbon {
    position: relative;
    overflow: hidden;
}

.card-ribbon::after {
    content: attr(data-ribbon);
    position: absolute;
    top: 20px;
    right: -35px;
    background: var(--accent);
    color: white;
    padding: 0.5rem 3rem;
    transform: rotate(45deg);
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   TIMELINE COMPONENTS
   ============================================================================ */
.timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: 2rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    box-shadow: 0 0 0 4px var(--card-bg);
    z-index: 2;
}

.timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.timeline-time {
    font-size: 0.813rem;
    color: var(--text-muted);
}

.timeline-body {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Timeline variants */
.timeline-icon.success {
    background: #10b981;
}

.timeline-icon.warning {
    background: #fbbf24;
}

.timeline-icon.danger {
    background: #ef4444;
}

.timeline-icon.info {
    background: #3b82f6;
}

/* ============================================================================
   AVATARS & AVATAR GROUPS
   ============================================================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

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

/* Avatar sizes */
.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.813rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 1.75rem;
}

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

.avatar-status::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--card-bg);
}

.avatar-status.offline::after {
    background: #94a3b8;
}

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

.avatar-status.away::after {
    background: #fbbf24;
}

/* Avatar group */
.avatar-group {
    display: flex;
    flex-direction: row-reverse;
    padding-left: 20px;
}

.avatar-group .avatar {
    margin-left: -20px;
    border: 2px solid var(--card-bg);
    transition: transform 0.2s ease;
}

.avatar-group .avatar:hover {
    transform: translateY(-4px);
    z-index: 10;
}

/* ============================================================================
   PROGRESS INDICATORS
   ============================================================================ */
.progress-wrapper {
    width: 100%;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

.progress-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
}

.progress-bar-container {
    height: 8px;
    background: var(--hover-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

/* Gradient progress bar */
.progress-bar-fill.gradient {
    background: linear-gradient(90deg, var(--accent), #3b82f6);
}

/* Animated stripe progress */
.progress-bar-fill.striped {
    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;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* Circular progress */
.circular-progress {
    width: 80px;
    height: 80px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.circular-progress svg {
    transform: rotate(-90deg);
}

.circular-progress-circle {
    fill: none;
    stroke: var(--hover-bg);
    stroke-width: 8;
}

.circular-progress-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.circular-progress-text {
    position: absolute;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    display: inline-block;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.empty-state-description {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.empty-state-action {
    margin-top: 1.5rem;
}

/* ============================================================================
   ALERT & NOTIFICATION BANNERS
   ============================================================================ */
.alert-banner {
    padding: 1rem 1.25rem;
    border-radius: 0.875rem;
    border: 1px solid;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

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

.alert-message {
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.alert-close:hover {
    opacity: 1;
}

/* Alert variants */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
    color: #f59e0b;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

[data-theme="light"] .alert-success {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .alert-info {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .alert-warning {
    background: rgba(251, 191, 36, 0.15);
}

[data-theme="light"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================================================
   CHIPS & TAGS
   ============================================================================ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.chip:hover {
    background: var(--border-color);
}

.chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-left: -0.25rem;
}

.chip-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-right: -0.25rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.chip-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

/* Chip variants */
.chip-primary {
    background: rgba(126, 58, 242, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.chip-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.chip-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
    color: #f59e0b;
}

.chip-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

/* ============================================================================
   LIST ITEMS
   ============================================================================ */
.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.875rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.list-item:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
}

.list-item:active {
    transform: scale(0.98);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    font-size: 0.938rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 0.813rem;
    color: var(--text-muted);
}

.list-item-action {
    flex-shrink: 0;
    color: var(--text-muted);
}

/* ============================================================================
   BADGES & LABELS
   ============================================================================ */
.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.5rem;
    background: currentColor;
}

/* ============================================================================
   ACTION SHEETS
   ============================================================================ */
.action-sheet {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    color: var(--text-main);
}

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

.action-sheet-item:hover {
    background: var(--hover-bg);
}

.action-sheet-item:active {
    background: var(--border-color);
}

.action-sheet-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.action-sheet-text {
    flex: 1;
    font-size: 0.938rem;
    font-weight: 500;
}

.action-sheet-item.danger {
    color: #ef4444;
}

.action-sheet-item.danger .action-sheet-icon {
    color: #ef4444;
}

/* ============================================================================
   DIVIDERS
   ============================================================================ */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ============================================================================
   TOOLTIPS
   ============================================================================ */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--text-main);
    color: var(--card-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.813rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-main);
}

.tooltip-wrapper:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}
