/* Enhanced Micro-interactions and Polish */

/* Smooth button press effect */
.btn-primary:active, 
.btn-secondary:active, 
.btn-outline:active {
    transform: translateY(1px) scale(0.98);
}

/* Card hover effect (subtle) */
.card {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Input focus glow */
input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--grit-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Smooth modal entry */
.modal {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast notifications slide in */
.toast {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Success pulse animation */
@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

.success-animation {
    animation: successPulse 0.6s ease-out;
}

/* Link hover underline */
nav a {
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--grit-blue);
    transition: width var(--transition-fast), left var(--transition-fast);
}

nav a:hover::after, 
nav a.active::after {
    width: 100%;
    left: 0;
}

/* Stat card number count-up effect */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-value {
    animation: countUp 0.4s ease-out;
}

/* Draggable workout card feedback */
.workout-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    cursor: grabbing;
}

.calendar-day.drag-over {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--grit-blue);
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--grit-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress bar fill animation */
progress::-webkit-progress-value {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

progress::-moz-progress-bar {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checkbox custom animation */
input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-base);
}

input[type="checkbox"]:checked {
    background: var(--grit-blue);
    border-color: var(--grit-blue);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Table row hover pulse */
table tr {
    transition: background var(--transition-fast), transform var(--transition-fast);
}

table tr:hover {
    transform: translateX(4px);
}

/* Smooth scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--grit-blue) var(--bg-dark-900);
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--grit-blue);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
