/* ============================================
   Reusable Components
   ============================================ */

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

/* Shimmer effect on hover */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.25),
            transparent);
    transition: none;
}

.btn:hover::before {
    animation: shimmer 0.6s ease forwards;
}

/* Ripple effect container */
.btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.4s, opacity 0.6s;
}

.btn:active::after {
    transform: scale(0, 0);
    opacity: 0.4;
    transition: 0s;
}

/* Primary Button */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow:
        var(--shadow-md),
        0 0 25px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        var(--shadow-lg),
        0 0 40px rgba(99, 102, 241, 0.5),
        0 15px 30px -10px rgba(99, 102, 241, 0.4);
}

/* Secondary Button */
.btn-secondary {
    background: var(--surface-glass);
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--surface-glass-hover);
    border-color: var(--surface-border-hover);
    transform: translateY(-2px);
}

/* Icon Button */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* Large Button */
.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    backdrop-filter: blur(20px);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--surface-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--surface-border);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    background: var(--surface-glass);
    color: var(--text-secondary);
    border: 1px solid var(--surface-border);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-400);
    border-color: rgba(99, 102, 241, 0.3);
}

.badge-secondary {
    background: rgba(139, 92, 246, 0.15);
    color: var(--secondary-400);
    border-color: rgba(139, 92, 246, 0.3);
}

.badge-accent {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-400);
    border-color: rgba(6, 182, 212, 0.3);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-500);
    border-color: rgba(34, 197, 94, 0.3);
}

/* ===== Tags ===== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tag {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--primary-300);
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.tag:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-glass);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    animation: shimmer 2s ease-in-out infinite;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,
            var(--primary-500),
            var(--secondary-500),
            var(--accent-500));
    background-size: 200% auto;
    border-radius: var(--radius-full);
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gradientShift 3s ease infinite;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-bar:hover .progress-fill::after {
    opacity: 1;
}

/* ===== Avatar ===== */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--surface-border);
}

.avatar-lg {
    width: 120px;
    height: 120px;
    border-width: 3px;
}

.avatar-xl {
    width: 200px;
    height: 200px;
    border-width: 4px;
}

/* Avatar with glow effect */
.avatar-glow {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
    border-color: var(--primary-400);
}

/* ===== Icon Wrapper ===== */
.icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    color: var(--primary-400);
    transition: all var(--transition-base);
}

.icon-wrap:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-400);
    transform: scale(1.05);
}

.icon-wrap svg {
    width: 24px;
    height: 24px;
}

/* ===== Divider ===== */
.divider {
    width: 100%;
    height: 1px;
    background: var(--surface-border);
    margin: var(--space-8) 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--surface-border);
}

/* ===== Tooltip ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: white;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: var(--z-tooltip);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* ===== Social Links ===== */
.social-links {
    display: flex;
    gap: var(--space-3);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Glow background effect */
.social-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.social-link:hover::before {
    opacity: 1;
}

.social-link:hover {
    border-color: transparent;
    color: white;
    transform: translateY(-5px) scale(1.1);
    box-shadow:
        0 15px 30px rgba(99, 102, 241, 0.4),
        0 0 20px rgba(99, 102, 241, 0.3);
}

.social-link svg {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1) rotate(5deg);
}

/* ===== Skeleton Loader ===== */
.skeleton {
    background: linear-gradient(90deg,
            var(--surface-glass) 25%,
            var(--surface-glass-hover) 50%,
            var(--surface-glass) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* ===== Glow Effect ===== */
.glow {
    position: relative;
}

.glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    filter: blur(40px);
    opacity: 0.3;
    z-index: -1;
    transition: opacity var(--transition-base);
}

.glow:hover::before {
    opacity: 0.5;
}

/* ===== Project Card Overlay ===== */
.project-image {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    aspect-ratio: 16 / 10;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.1s;
}

.project-card:hover .project-actions {
    transform: translateY(0);
}

/* Small button variant */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    gap: var(--space-1);
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

/* Quick Contact FAB */
.quick-contact-fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.6);
}

.quick-contact-fab:active {
    transform: translateY(-2px) scale(1);
}

/* Mobile-optimized touch targets */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: var(--space-3) var(--space-5);
    }
    
    .btn-sm {
        min-height: 38px;
        padding: var(--space-2) var(--space-3);
    }
    
    .project-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, transparent 50%);
    }
    
    .project-actions {
        transform: translateY(0);
        position: absolute;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .quick-contact-fab {
        width: 52px !important;
        height: 52px !important;
        bottom: 80px !important;
    }
}

/* CTA Section Responsive */
.cta-section .btn {
    white-space: nowrap;
}

/* Arrow animation for CTA */
.btn-primary svg {
    transition: transform 0.3s ease;
}

.btn-primary:hover svg {
    transform: translateX(4px);
    animation: arrow-slide 0.6s ease infinite;
}

@keyframes arrow-slide {
    0%, 100% {
        transform: translateX(4px);
    }
    50% {
        transform: translateX(8px);
    }
}

@media (max-width: 640px) {
    .cta-section h2 {
        font-size: 1.5rem !important;
    }
    
    .cta-section p {
        font-size: 1rem !important;
    }
    
    .cta-section .btn {
        width: 100%;
        justify-content: center;
    }
}
