/* DmApp Screen Transitions */

/* ===== BASE TRANSITION SETUP ===== */

.transition-ready {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== FADE TRANSITIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOutScale {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ===== SLIDE TRANSITIONS ===== */

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

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

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

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

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

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

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

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

/* ===== ZOOM TRANSITIONS ===== */

@keyframes zoomIn {
    from {
        transform: scale(0.3);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.3);
        opacity: 0;
    }
}

/* ===== FLIP TRANSITIONS ===== */

@keyframes flipIn {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes flipOut {
    from {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
    to {
        transform: perspective(400px) rotateY(-90deg);
        opacity: 0;
    }
}

/* ===== MODAL TRANSITIONS ===== */

@keyframes modalZoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes modalZoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.7);
        opacity: 0;
    }
}

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

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

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

/* ===== DROPDOWN TRANSITIONS ===== */

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

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

/* ===== CARD FLIP TRANSITIONS ===== */

@keyframes cardFlipToBack {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

@keyframes cardFlipToFront {
    0% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* ===== SECTION HIGHLIGHT ===== */

@keyframes highlightSection {
    0% {
        background: rgba(0, 255, 0, 0);
    }
    50% {
        background: rgba(0, 255, 0, 0.1);
    }
    100% {
        background: rgba(0, 255, 0, 0);
    }
}

/* ===== ROTATE TRANSITIONS ===== */

@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes rotateOut {
    from {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    to {
        transform: rotate(180deg) scale(0);
        opacity: 0;
    }
}

/* ===== ELASTIC TRANSITIONS ===== */

@keyframes elasticIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== SCREEN/PAGE CONTAINERS ===== */

.screen,
.page {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.entering {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.exiting {
    animation: slideOutLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== MODAL STYLES ===== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ===== TAB TRANSITIONS ===== */

.tab-content {
    opacity: 1;
    transform: scale(1);
}

.tab-content.active {
    display: block;
}

.tab-content:not(.active) {
    display: none;
}

/* ===== STAGGER ANIMATIONS ===== */

.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item.animated {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== REVEAL ON SCROLL ===== */

[data-reveal] {
    opacity: 0;
}

[data-reveal].revealed {
    opacity: 1;
}

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

html {
    scroll-behavior: smooth;
}

/* ===== PAGE LOAD ANIMATIONS ===== */

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

body {
    animation: pageLoad 0.6s ease-out;
}

/* ===== NAVIGATION TRANSITIONS ===== */

.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
}

.nav-link:active {
    transform: translateY(0);
}

/* ===== CARD TRANSITIONS ===== */

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.2);
}

/* ===== BUTTON TRANSITIONS ===== */

button,
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

button:active,
.btn:active {
    transform: translateY(0);
}

/* ===== LOADING TRANSITIONS ===== */

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

.loading-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(0, 255, 0, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

.modal,
.modal-content,
.screen,
.page,
[data-reveal] {
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform, opacity;
}

/* ===== 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;
    }
}

/* ===== MOBILE OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        padding: 20px;
    }
    
    /* Faster transitions on mobile */
    .screen,
    .page {
        transition-duration: 0.2s;
    }
}

/* ===== DARK MODE TRANSITIONS ===== */

@media (prefers-color-scheme: dark) {
    .modal-backdrop {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .modal-content {
        background: rgba(0, 0, 0, 0.9);
        color: white;
    }
}
