/* Modern UI Enhancements - Skeleton Loading, Animations & Glassmorphism */

/* ===== SKELETON LOADING STATES ===== */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2d3748 25%, #4a5568 50%, #2d3748 75%);
    background-size: 200px 100%;
}

/* Skeleton Components */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.large { height: 24px; }
.skeleton-text.small { height: 12px; }
.skeleton-text.wide { width: 100%; }
.skeleton-text.medium { width: 75%; }
.skeleton-text.narrow { width: 50%; }

.skeleton-card {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.skeleton-circle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-block;
}

.skeleton-circle.large { width: 80px; height: 80px; }
.skeleton-circle.small { width: 24px; height: 24px; }

.skeleton-button {
    height: 38px;
    width: 120px;
    border-radius: 6px;
}

/* ===== MICRO-ANIMATIONS & TRANSITIONS ===== */
* {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth reveal animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

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

/* Scale hover effect */
.scale-hover:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Slide animations */
.slide-in-left {
    transform: translateX(-100%);
    animation: slideInLeft 0.5s ease-out forwards;
}

.slide-in-right {
    transform: translateX(100%);
    animation: slideInRight 0.5s ease-out forwards;
}

@keyframes slideInLeft {
    to { transform: translateX(0); }
}

@keyframes slideInRight {
    to { transform: translateX(0); }
}

/* Pulse animation for loading states */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* ===== GLASSMORPHISM DESIGN ===== */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

[data-theme="dark"] .glass-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .glass-nav {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* ===== ENHANCED BUTTONS ===== */
.btn-enhanced {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn-enhanced:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Ripple effect */
.btn-enhanced::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-enhanced:active::before {
    width: 300px;
    height: 300px;
}

/* Gradient buttons */
.btn-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.btn-gradient-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    color: white;
}

.btn-gradient-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    color: white;
}

.btn-gradient-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    color: white;
}

/* ===== ENHANCED TOAST NOTIFICATIONS ===== */
.toast-enhanced {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 10000;
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.toast-enhanced.show {
    transform: translateX(0);
}

.toast-enhanced-success {
    background: rgba(16, 185, 129, 0.9);
    color: white;
    border-left: 4px solid #10b981;
}

.toast-enhanced-error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-left: 4px solid #ef4444;
}

.toast-enhanced-warning {
    background: rgba(245, 158, 11, 0.9);
    color: white;
    border-left: 4px solid #f59e0b;
}

.toast-enhanced-info {
    background: rgba(6, 182, 212, 0.9);
    color: white;
    border-left: 4px solid #06b6d4;
}

.toast-enhanced-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-enhanced-content {
    flex: 1;
}

.toast-enhanced-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.toast-enhanced-message {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
}

.toast-enhanced-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.toast-enhanced-close:hover {
    opacity: 1;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: loading-dots 1.4s infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-dots {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* ===== FORM ENHANCEMENTS ===== */
.form-enhanced {
    position: relative;
}

.form-control-enhanced {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.form-control-enhanced:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

[data-theme="dark"] .form-control-enhanced {
    background: rgba(30, 41, 59, 0.8);
    border-color: #475569;
    color: #f8fafc;
}

[data-theme="dark"] .form-control-enhanced:focus {
    background: rgba(30, 41, 59, 0.9);
}

/* ===== CARD ENHANCEMENTS ===== */
.card-enhanced {
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.card-enhanced:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* Mobile Navigation Optimizations */
@media (max-width: 991.98px) {
    .navbar-nav {
        padding-top: 1rem;
    }
    
    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        margin-bottom: 0.25rem;
    }
    
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        margin-top: 0.5rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        margin-bottom: 0.5rem;
    }
    
    .voice-input-btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

/* Mobile Card Layout Optimizations */
@media (max-width: 768px) {
    /* Reduce excessive vertical spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    main.container {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Optimize card spacing for mobile */
    .card {
        margin-bottom: 1rem !important;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .glass-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 16px;
    }
    
    /* Compact welcome section */
    .welcome-hero {
        padding: 1.5rem 0 !important;
        margin-bottom: 1rem !important;
    }
    
    .welcome-content {
        text-align: center;
    }
    
    /* Feature cards mobile optimization */
    .feature-card .card-body {
        padding: 1rem !important;
    }
    
    .feature-card .icon-circle {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 0.75rem !important;
    }
    
    .feature-card h5 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .feature-card p {
        font-size: 0.85rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Row spacing optimization */
    .row {
        margin-bottom: 0.5rem;
    }
    
    .row.g-4 {
        --bs-gutter-y: 1rem;
    }
    
    /* Disable hover effects on mobile */
    .card-enhanced:hover,
    .scale-hover:hover {
        transform: none;
    }
    
    .toast-enhanced {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Ultra compact spacing */
    main.container {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
    
    .glass-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Compact feature cards for small screens */
    .feature-card .card-body {
        padding: 0.75rem !important;
        text-align: center;
    }
    
    .feature-card .icon-circle {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .feature-card h5 {
        font-size: 0.9rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .feature-card p {
        font-size: 0.8rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.3;
    }
    
    /* Compact welcome section */
    .welcome-hero {
        padding: 1rem 0 !important;
    }
    
    .welcome-back-text {
        font-size: 1.25rem !important;
    }
    
    .username-display {
        font-size: 1.75rem !important;
    }
    
    .welcome-subtitle {
        font-size: 0.85rem !important;
    }
    
    .upgrade-section {
        margin-top: 0.75rem !important;
    }
    
    .btn-gradient-premium {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.75rem !important;
    }
    
    /* Optimize button sizes */
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

/* Touch-friendly mobile optimizations */
@media (max-width: 768px) and (pointer: coarse) {
    /* Ensure minimum touch targets */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-sm {
        min-height: 38px;
    }
    
    /* Improve form controls for touch */
    .form-control,
    .form-select,
    .form-control-enhanced {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Better spacing for touch */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Voice input button optimization */
    .voice-input-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Landscape phone optimizations */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 414px) {
    /* Reduce vertical spacing in landscape */
    main.container {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .welcome-hero {
        padding: 0.75rem 0 !important;
        margin-bottom: 0.5rem !important;
    }
    
    .card {
        margin-bottom: 0.5rem !important;
    }
    
    .glass-card {
        margin-bottom: 0.5rem !important;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
.btn-enhanced:focus-visible,
.form-control-enhanced:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}