/* ========================================
   PRODUCTION UI POLISH
   Final Layer of Micro-Interactions & Polish
   ======================================== */

/* ========== ENHANCED BUTTON STATES ========== */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.btn:not(:disabled):not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn:not(:disabled):not(.disabled):active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 107, 138, 0.25);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ========== ENHANCED CARD INTERACTIONS ========== */
.card,
.feature-card,
.service-card,
.project-card,
.dashboard-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.card:hover,
.feature-card:hover,
.service-card:hover,
.project-card:hover,
.dashboard-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Clickable card indication */
a.card,
a.dashboard-card,
.card[onclick],
.card[data-href] {
    cursor: pointer;
}

a.card:active,
a.dashboard-card:active {
    transform: translateY(-6px) scale(1.01);
}

/* ========== ENHANCED INPUT STATES ========== */
.form-control,
input,
textarea,
select {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    transform: scale(1.01);
    border-color: var(--primary, #FF6B8A);
    box-shadow: 0 0 0 4px rgba(255, 107, 138, 0.1);
    outline: none;
}

/* Validation states with animation */
.form-control.is-valid,
input.is-valid {
    border-color: var(--success, #10B981);
    animation: input-success 0.5s ease-out;
}

.form-control.is-invalid,
input.is-invalid {
    border-color: var(--danger, #EF4444);
    animation: input-error 0.5s ease-out;
}

@keyframes input-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes input-error {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ========== ENHANCED NAVIGATION ========== */
.nav-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary, #FF6B8A);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary, #FF6B8A);
    transform: translateY(-2px);
}

/* Mobile menu animation */
.navbar-collapse {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== IMAGE LOADING EFFECTS ========== */
img {
    transition: opacity 0.6s ease-in-out;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded,
img.loaded {
    opacity: 1;
}

/* Image zoom on hover */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-zoom:hover img {
    transform: scale(1.1);
}

/* ========== TOOLTIP STYLES ========== */
.custom-tooltip {
    position: absolute;
    background: var(--dark, #1A1A2E);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--dark, #1A1A2E);
}

/* ========== NOTIFICATION ANIMATIONS ========== */
.notification-item {
    animation: notificationSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-item.hiding {
    animation: notificationSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes notificationSlideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========== SCROLL REVEAL ANIMATIONS ========== */
.reveal,
.fade-in,
.slide-in-left,
.slide-in-right {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active,
.fade-in.active {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left.active {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* ========== LOADING STATES ========== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.15em;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* ========== DROPDOWN ANIMATIONS ========== */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    pointer-events: none;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ========== MODAL ANIMATIONS ========== */
.modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-50px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ========== TAB ANIMATIONS ========== */
.tab-content {
    animation: tabFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== BADGE ANIMATIONS ========== */
.badge {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge:hover {
    transform: scale(1.1);
}

.badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 138, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 107, 138, 0);
    }
}

/* ========== PROGRESS BAR ANIMATIONS ========== */
.progress-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== ALERT ANIMATIONS ========== */
.alert {
    animation: alertSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== ACCESSIBILITY ENHANCEMENTS ========== */
*:focus-visible {
    outline: 3px solid var(--primary, #FF6B8A);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary, #FF6B8A);
    color: white;
    padding: 10px 20px;
    z-index: 10000;
    transition: top 0.3s;
    text-decoration: none;
}

.skip-to-content:focus {
    top: 0;
}

/* ========== RESPONSIVE ENHANCEMENTS ========== */
@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    .card:hover,
    .feature-card:hover,
    .service-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
    
    /* Simplify hover effects */
    .btn:not(:disabled):not(.disabled):hover {
        transform: translateY(-1px);
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    * {
        animation: none !important;
        transition: none !important;
        box-shadow: none !important;
    }
    
    .no-print,
    .navbar,
    .back-to-top,
    .notification-container {
        display: none !important;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== HIGH CONTRAST MODE ========== */
@media (prefers-contrast: high) {
    * {
        border-width: 2px !important;
    }
    
    .btn {
        border: 2px solid currentColor !important;
    }
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform;
}

/* Remove will-change after animation */
.gpu-accelerated.complete {
    will-change: auto;
}
