/**
 * Premium Polish & Animations
 * Phase 6: Final polish, animations, and micro-interactions
 * 
 * @package SENNA_Launcher
 * @since 4.0.0
 */

/* ===========================================
   SMOOTH TRANSITIONS
   =========================================== */

* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Transition Classes */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-fast {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-slow {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================================
   ENTRANCE ANIMATIONS
   =========================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInBottom {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Entrance Animation Classes */
.animate-fadeInUp {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Staggered Animations */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.3s; }

/* ===========================================
   MICRO-INTERACTIONS
   =========================================== */

/* Button Polish */
.action-btn,
.apply-btn,
.opp-action-btn,
.opp-apply-btn,
button {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn::before,
.apply-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn:hover::before,
.apply-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Card Hover Effects */
.visual-card,
.opp-visual-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.visual-card:hover,
.opp-visual-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 10px 20px rgba(13, 53, 62, 0.1),
        0 6px 6px rgba(13, 53, 62, 0.05);
}

.visual-card.selected,
.opp-visual-card.selected {
    transform: scale(1.02);
    border-color: var(--premium-sage);
    background: linear-gradient(135deg, 
        var(--premium-ivory) 0%, 
        rgba(113, 142, 104, 0.05) 100%
    );
}

/* Input Focus Effects */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--premium-sage);
    box-shadow: 
        0 0 0 3px rgba(113, 142, 104, 0.1),
        0 2px 4px rgba(13, 53, 62, 0.05);
    transform: translateY(-1px);
}

/* Checkbox & Radio Polish */
input[type="checkbox"],
input[type="radio"] {
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--premium-sage);
    border-color: var(--premium-sage);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    animation: checkmark 0.3s ease;
}

@keyframes checkmark {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===========================================
   LOADING ANIMATIONS
   =========================================== */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton-loading {
    background: linear-gradient(
        90deg,
        var(--premium-cream) 0%,
        var(--premium-ivory) 40%,
        var(--premium-cream) 80%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spinner Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 2px solid var(--premium-cream);
    border-top-color: var(--premium-sage);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

/* ===========================================
   SMOOTH SCROLL INDICATORS
   =========================================== */

.scroll-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* ===========================================
   PREMIUM HOVER STATES
   =========================================== */

/* Link Hover */
a {
    position: relative;
    transition: color 0.3s ease;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--premium-sage);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Icon Hover */
.icon-wrapper {
    transition: all 0.3s ease;
}

.icon-wrapper:hover {
    transform: scale(1.1) rotate(5deg);
    color: var(--premium-sage);
}

/* ===========================================
   FOCUS TRAP STYLES
   =========================================== */

.focus-visible {
    outline: 2px solid var(--premium-sage);
    outline-offset: 2px;
}

.focus-visible:not(:focus-visible) {
    outline: none;
}

/* ===========================================
   SMOOTH PAGE TRANSITIONS
   =========================================== */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================================
   NUMBER ANIMATIONS
   =========================================== */

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-animation {
    display: inline-block;
    animation: countUp 0.5s ease forwards;
}

/* ===========================================
   TOOLTIP STYLES
   =========================================== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--premium-espresso);
    color: var(--premium-cream);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

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

/* ===========================================
   PREMIUM SHADOWS
   =========================================== */

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(13, 53, 62, 0.05);
}

.shadow-md {
    box-shadow: 
        0 4px 6px -1px rgba(13, 53, 62, 0.1),
        0 2px 4px -1px rgba(13, 53, 62, 0.06);
}

.shadow-lg {
    box-shadow: 
        0 10px 15px -3px rgba(13, 53, 62, 0.1),
        0 4px 6px -2px rgba(13, 53, 62, 0.05);
}

.shadow-xl {
    box-shadow: 
        0 20px 25px -5px rgba(13, 53, 62, 0.1),
        0 10px 10px -5px rgba(13, 53, 62, 0.04);
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(13, 53, 62, 0.25);
}

.shadow-inner {
    box-shadow: inset 0 2px 4px 0 rgba(13, 53, 62, 0.06);
}

/* ===========================================
   GLASSMORPHISM EFFECTS
   =========================================== */

.glass {
    background: rgba(255, 254, 249, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(13, 53, 62, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===========================================
   PREMIUM GRADIENTS
   =========================================== */

.gradient-sage {
    background: linear-gradient(135deg, 
        var(--premium-sage) 0%, 
        var(--premium-muted-sage) 100%
    );
}

.gradient-premium {
    background: linear-gradient(135deg, 
        var(--premium-ivory) 0%, 
        var(--premium-cream) 50%, 
        rgba(113, 142, 104, 0.1) 100%
    );
}

.gradient-text {
    background: linear-gradient(135deg, 
        var(--premium-espresso) 0%, 
        var(--premium-sage) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===========================================
   NOTIFICATION ANIMATIONS
   =========================================== */

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

.notification {
    animation: slideInTop 0.3s ease forwards;
}

.notification-exit {
    animation: slideInTop 0.3s ease reverse forwards;
}

/* ===========================================
   FINAL POLISH DETAILS
   =========================================== */

/* Selection Color */
::selection {
    background: rgba(113, 142, 104, 0.2);
    color: var(--premium-espresso);
}

::-moz-selection {
    background: rgba(113, 142, 104, 0.2);
    color: var(--premium-espresso);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--premium-cream);
}

::-webkit-scrollbar-thumb {
    background: var(--premium-sage);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--premium-muted-sage);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--premium-sage) var(--premium-cream);
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Premium Focus Ring */
:focus-visible {
    outline: 2px solid var(--premium-sage);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Disabled State Polish */
:disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

/* Print Refinements */
@media print {
    @page {
        margin: 2cm;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
}