/* ════════════════════════════════════════════════════════════════
   MICRO-INTERACTIONS - 2026 Best Practice
   Subtle, delightful interactions that enhance UX
   ════════════════════════════════════════════════════════════════ */

/* ─── CARD MICRO-INTERACTIONS ─── */
.card, [data-hover="card"] {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s;
    z-index: 1;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) translateX(0);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.card:active {
    transform: translateY(-4px);
}

/* ─── BUTTON MICRO-INTERACTIONS ─── */
button, [data-hover="button"] {
    position: relative;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(61, 122, 127, 0.3);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── LINK MICRO-INTERACTIONS ─── */
a, [data-hover="link"] {
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
}

a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #3d7a7f;
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

a:hover::after {
    width: 100%;
}

a:hover {
    color: #3d7a7f;
}

/* ─── INPUT FIELD INTERACTIONS ─── */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #ddd;
    position: relative;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3d7a7f;
    box-shadow: 0 0 0 3px rgba(61, 122, 127, 0.1);
    transform: scale(1.01);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
textarea::placeholder {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

input[type="text"]:focus::placeholder,
input[type="email"]:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.3;
}

/* ─── CHECKBOX & RADIO INTERACTIONS ─── */
input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    transform: scale(1.1);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    animation: checkboxCheck 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkboxCheck {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ─── ICON INTERACTIONS ─── */
.icon, i, svg {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

button:hover .icon,
a:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

/* ─── SECTION DIVIDER INTERACTIONS ─── */
.divider {
    height: 2px;
    background: linear-gradient(to right, transparent, #3d7a7f, transparent);
    margin: 2rem 0;
    transition: all 0.6s ease;
}

section:hover .divider {
    height: 3px;
    background: linear-gradient(to right, transparent, #2a5c60, transparent);
}

/* ─── LOADING STATE ANIMATIONS ─── */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3d7a7f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ─── SUCCESS/ERROR STATE ANIMATIONS ─── */
.success {
    animation: successPulse 0.6s ease-out;
}

.error {
    animation: errorShake 0.4s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        background-color: rgba(39, 174, 96, 0.2);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        background-color: transparent;
    }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ─── TOOLTIP INTERACTIONS ─── */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #2a3a3f;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    font-size: 12px;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #2a3a3f;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── GRADIENT TEXT ANIMATION ─── */
.gradient-text {
    background: linear-gradient(135deg, #3d7a7f, #7bbfc4);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ─── FLOATING ELEMENTS ─── */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* ─── SLIDE-IN ANIMATIONS ─── */
.slide-in-from-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-from-right {
    animation: slideInRight 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ─── SCALE ANIMATIONS ─── */
.scale-on-hover {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-on-hover:hover {
    transform: scale(1.1);
}

/* ─── RESPECT PREFERS-REDUCED-MOTION ─── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
