/* --- NATIVE APP ANIMATIONS & INTERACTIONS --- */

/* View Transitions */
@keyframes viewEnter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.view-section.active {
    animation: viewEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal Snappy Animation */
.modal-overlay {
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-content {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(40px) scale(0.95);
}
.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    background-color: rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 100;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Relative positioning for ripples */
.btn, .project-card, .fmt-btn, .toolbar-dropdown-btn, .add-sheet-btn, .sheet-tab, .back-btn {
    position: relative;
    overflow: hidden;
    /* isolation: isolate; helps keep ripple inside border-radius in some browsers */
    isolation: isolate;
}

/* Hover & Active enhancements for buttons */
.btn, .back-btn {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover, .back-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}
.btn:active, .back-btn:active {
    transform: translateY(1px) scale(0.96) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Format and Toolbar buttons */
.fmt-btn, .toolbar-dropdown-btn, .add-sheet-btn {
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
}
.fmt-btn:active, .toolbar-dropdown-btn:active, .add-sheet-btn:active {
    transform: scale(0.9) !important;
}

/* Project Cards */
.project-card {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12);
    border-color: #000;
}
.project-card:active {
    transform: scale(0.97) translateY(-2px);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.1);
}

/* Dropdown Menus */
.dropdown-menu {
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
    transform: scale(0.92) translateY(8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.dropdown-menu.show {
    transform: scale(1) translateY(0);
}

/* Format Popup Details */
.format-popup {
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(12px) scale(0.95);
}
.format-popup.active {
    transform: translateY(0) scale(1);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.12);
}

/* Loading Overlay Interpolated */
#global-loading {
    transition: opacity 0.3s ease;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}
.spreadsheet-container, .toolbar {
    scroll-behavior: smooth;
}

/* Spreadsheet Cells Gliding UI */
td.selected {
    transition: box-shadow 0.15s ease-out;
}
td.in-selection {
    transition: box-shadow 0.15s ease-out;
}
.cell-content {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Input Fields Native Snappiness */
input[type="text"] {
    transition: border-color 0.2s, box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sheet Tabs Animations */
.sheet-tab {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.sheet-tab:active {
    transform: scale(0.95);
}
