﻿/**
 * UI Enhancements Stylesheet
 * Version: 1.3.0
 * Contains styles for page transitions, micro-interactions, glassmorphism, and more
 */

/* ==============================================
   FEATURE 1: Page Transitions - Fast & Clean
   ============================================== */
body {
    transition: opacity 0.15s ease-out !important;
}

.page-enter {
    animation: none;
}

.page-exit {
    animation: none;
}

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

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

/* ==============================================
   FEATURE 3: Micro-Interactions
   ============================================== */

/* Button Press Effect - Enhanced with visual feedback */
button, .btn, [role="button"], a.nav-item {
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s ease, 
                box-shadow 0.2s ease, 
                background-color 0.2s ease !important;
    position: relative;
}

button:active, .btn:active, [role="button"]:active, a.nav-item:active {
    transform: scale(0.96) translateY(1px) !important;
    opacity: 0.9 !important;
}

button:active::after, .btn:active::after, [role="button"]:active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.1);
    animation: buttonRipple 0.3s ease-out;
}

@keyframes buttonRipple {
    0% {
        opacity: 1;
        transform: scale(0.8);
    }
    100% {
        opacity: 0;
        transform: scale(1.2);
    }
}

/* Checkbox Bounce */
.checkbox-bounce {
    animation: checkboxBounce 0.3s ease;
}

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

/* Card Hover Lift */
.card-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Ripple Effect */
.ripple-btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

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

/* Input Focus Glow */
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* ==============================================
   FEATURE 6: Glassmorphism Cards (Advanced+)
   ============================================== */
body.glassmorphism-enabled .glass-card-enhanced,
body.glassmorphism-enabled [data-glass="true"] {
    background: rgba(10, 10, 12, 0.7) !important;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.glassmorphism-enabled .glass-card-enhanced:hover,
body.glassmorphism-enabled [data-glass="true"]:hover {
    background: rgba(15, 15, 20, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Frosted glass effect for modals */
.glass-modal {
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
}

/* ==============================================
   FEATURE 7: Animated Counters
   ============================================== */
.counter-animate {
    display: inline-block;
    min-width: 2ch;
}

/* Number highlight on change */
@keyframes numberPulse {
    0% { color: inherit; }
    50% { color: #10b981; transform: scale(1.05); }
    100% { color: inherit; transform: scale(1); }
}

.number-updated {
    animation: numberPulse 0.5s ease;
}

/* ==============================================
   MOBILE ENHANCEMENTS (Feature 38-40)
   ============================================== */

/* Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 100;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    /* Add padding to main content for bottom nav */
    main {
        padding-bottom: 80px !important;
    }
}

.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    color: #71717a;
    text-decoration: none;
    transition: color 0.2s ease;
    min-width: 60px;
}

.mobile-bottom-nav a.active {
    color: #ef4444;
}

.mobile-bottom-nav a:hover {
    color: white;
}

.mobile-bottom-nav a i {
    width: 20px;
    height: 20px;
}

.mobile-bottom-nav a span {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 90px;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 768px) {
    .fab {
        display: flex;
    }
}

.fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab i {
    width: 24px;
    height: 24px;
}

/* FAB Sub-actions */
.fab-actions {
    position: fixed;
    bottom: 155px;
    right: 1rem;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 98;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fab-actions.open {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .fab-actions {
        display: flex;
    }
}

.fab-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(10, 10, 12, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
}

.fab-action:hover {
    background: rgba(20, 20, 25, 0.95);
    transform: translateX(-5px);
}

.fab-action i {
    width: 18px;
    height: 18px;
}

/* Swipe Actions */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    transform: translateX(100%);
    transition: transform 0.2s ease;
}

.swipe-container.swiped .swipe-actions {
    transform: translateX(0);
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 100%;
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.swipe-action.edit {
    background: #3b82f6;
}

.swipe-action.delete {
    background: #ef4444;
}

/* Touch-friendly tap areas */
@media (max-width: 768px) {
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Pull to refresh indicator */
.pull-refresh-indicator {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.2s ease;
    z-index: 1000;
}

.pull-refresh-indicator.pulling {
    top: 20px;
}

.pull-refresh-indicator.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==============================================
   UNDO TOAST (Feature 11)
   ============================================== */
.undo-toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(10, 10, 12, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-width: 300px;
}

.undo-toast-message {
    flex: 1;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.undo-toast-btn {
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    color: #3b82f6;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
}

.undo-toast-btn:hover {
    background: rgba(59, 130, 246, 0.3);
}

.undo-toast-timer {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.undo-toast-timer-bar {
    height: 100%;
    background: #3b82f6;
    transition: width 0.1s linear;
}

/* ==============================================
   DATE SHORTCUTS (Feature 37)
   ============================================== */
.date-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.date-shortcut {
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #a1a1aa;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-shortcut:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.date-shortcut.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

/* ==============================================
   LOADING STATES ENHANCEMENTS
   ============================================== */
.skeleton-text {
    height: 1em;
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-circle {
    border-radius: 50%;
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-card {
    background: linear-gradient(90deg, #0a0a0c 25%, #111114 50%, #0a0a0c 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 1rem;
}

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

/* ==============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================== */
:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .page-enter, .page-exit {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .glass-card-enhanced {
        background: #0a0a0c !important;
        border: 2px solid white !important;
    }
}



/* ==============================================
   GLOBAL FORM SELECT POLISH
   ============================================== */
html, body { overflow-x: hidden; }

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.6) 50%),
                    linear-gradient(135deg, rgba(255,255,255,0.6) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(1em + 2px), calc(100% - 11px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px !important;
}

/* Match theme for custom dropdown menus */
.custom-options {
  max-height: 280px;
  overflow-y: auto;
}
.custom-options::-webkit-scrollbar { width: 6px; }
.custom-options::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }
.custom-options::-webkit-scrollbar-track { background: transparent; }

