* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* ============================================
   VIEW SYSTEM
   ============================================ */
.view {
    display: none;
    animation: view-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.view.active {
    display: block;
}
.view-enter {
    animation: view-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes view-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 0.75rem;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}
.skeleton-text:last-child {
    width: 60%;
}

/* ============================================
   BOTTOM SHEET MODAL
   ============================================ */
.modal-sheet {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: calc(90vh - env(safe-area-inset-bottom, 0px) - 2rem);
}
.modal-sheet.open {
    transform: translateY(0);
}
.modal-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ============================================
   NAVIGATION
   ============================================ */
#nav {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.nav-btn {
    color: #9ca3af;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 0;
    border-radius: 12px;
    margin: 0 2px;
}

.nav-btn svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 24px;
    height: 24px;
    margin-bottom: 1px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.nav-btn.active {
    color: #4f46e5;
}

.nav-btn.active svg {
    stroke-width: 2.5;
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(79, 70, 229, 0.25));
}

.nav-btn::before {
    content: '';
    position: absolute;
    inset: 4px -4px;
    border-radius: 12px;
    background: currentColor;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
    transform: scale(0.8);
}

.nav-btn.active::before {
    opacity: 0.12;
    transform: scale(1);
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-btn:hover {
    color: #6366f1;
}

.nav-btn.active:hover {
    color: #4f46e5;
}

/* Active indicator */
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #4f46e5;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-btn.active::after {
    opacity: 1;
}

/* ============================================
   INTERACTIONS
   ============================================ */
.btn-ripple {
    position: relative;
    overflow: hidden;
}
.btn-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-ripple:active::after {
    opacity: 1;
}

.checkbox-custom {
    position: relative;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.checkbox-custom:active {
    transform: scale(0.85);
}

.check-icon {
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(0) rotate(-45deg);
}
.check-icon.checked {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ============================================
   TOAST
   ============================================ */
.toast-enter {
    animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-exit {
    animation: toast-out 0.25s ease forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ============================================
   PULL TO REFRESH
   ============================================ */
.pull-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.2s;
    opacity: 0;
}
.pull-indicator.visible {
    opacity: 1;
}
.pull-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.pull-spinner.spinning {
    animation: spin 0.6s linear infinite;
}

/* ============================================
   PRIORITY INDICATORS
   ============================================ */
.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.priority-dot.low { background: #d1d5db; }
.priority-dot.normal { background: #9ca3af; }
.priority-dot.high { background: #f59e0b; }
.priority-dot.urgent { background: #ef4444; }

/* ============================================
   SCROLLBAR
   ============================================ */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ============================================
   SAFE AREA
   ============================================ */
#nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 0 rgba(0,0,0,0.05);
    height: calc(4rem + env(safe-area-inset-bottom, 0px));
}
#nav .nav-btn {
    padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#app-header {
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
}
#content {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}
#modal-body {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

/* ============================================
   TOUCH FEEDBACK
   ============================================ */
.touch-feedback {
    transition: transform 0.15s, background 0.15s;
}
.touch-feedback:active {
    transform: scale(0.97);
}

/* ============================================
   LIST ITEM SWIPE
   ============================================ */
.swipe-container {
    overflow: hidden;
    position: relative;
}
.swipe-actions {
    position: absolute;
    right: -120px;
    top: 0;
    bottom: 0;
    display: flex;
    transition: right 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.swipe-container.swiping .swipe-actions {
    right: 0;
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: #e0e7ff;
    color: #3730a3;
}

/* ============================================
   RESPONSIVE FIXES
   ============================================ */
@media (min-width: 481px) {
    #app {
        box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 20px 60px rgba(0,0,0,0.08);
    }
}
