/* Professional UI Enhancements CSS */
/* Touch-friendly with smooth animations */

/* ==========================================
   QUICK ACTIONS MODAL
   ========================================== */
.quick-actions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-actions-modal.active {
    opacity: 1;
    pointer-events: all;
}

.quick-actions-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.quick-actions-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-actions-modal.active .quick-actions-content {
    transform: scale(1) translateY(0);
}

.quick-actions-search {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.quick-actions-search input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: none;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    outline: none;
    font-family: 'Nunito', sans-serif;
    transition: background 0.2s;
}

.quick-actions-search input:focus {
    background: rgba(0, 0, 0, 0.05);
}

.quick-actions-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 4px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid transparent;
}

.quick-action-item:hover,
.quick-action-item:active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateX(4px);
}

.quick-action-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    flex-shrink: 0;
}

.quick-action-label {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #111827;
}

.quick-action-item kbd {
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #6b7280;
}

/* Ensure buttons have proper contrast in modals */
.quick-actions-content .btn-primary,
.shortcuts-content .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    background-color: #6366f1 !important; /* Fallback + ensure it's always visible */
    color: white !important; /* Ensure white text with purple background */
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.quick-actions-content .btn-outline,
.shortcuts-content .btn-outline {
    background: transparent;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.quick-actions-content .btn-outline:hover,
.shortcuts-content .btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Dark theme */
[data-theme="dark"] .quick-actions-content {
    background: rgba(31, 41, 55, 0.98);
}

[data-theme="dark"] .quick-actions-search input {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

[data-theme="dark"] .quick-action-label {
    color: #f3f4f6;
}

[data-theme="dark"] .quick-actions-content .btn-outline,
[data-theme="dark"] .shortcuts-content .btn-outline {
    color: #818cf8;
    border-color: #818cf8;
}

[data-theme="dark"] .quick-actions-content .btn-outline:hover,
[data-theme="dark"] .shortcuts-content .btn-outline:hover {
    background: rgba(129, 140, 248, 0.1);
}

/* ==========================================
   KEYBOARD SHORTCUTS OVERLAY
   ========================================== */
.shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shortcuts-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.shortcuts-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.shortcuts-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shortcuts-overlay.active .shortcuts-content {
    transform: scale(1);
}

.shortcuts-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    color: #111827;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    transition: all 0.2s;
}

.shortcut-item:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.shortcut-item kbd {
    background: linear-gradient(135deg, #ffffff, #f3f4f6);
    border: 1px solid #d1d5db;
    border-bottom: 3px solid #9ca3af;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 32px;
    text-align: center;
    display: inline-block;
}

.shortcut-item span {
    font-size: 15px;
    color: #4b5563;
    font-weight: 500;
}

.shortcuts-note {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Dark theme */
[data-theme="dark"] .shortcuts-content {
    background: rgba(31, 41, 55, 0.98);
}

[data-theme="dark"] .shortcuts-content h3 {
    color: #f3f4f6;
}

[data-theme="dark"] .shortcut-item {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .shortcut-item kbd {
    background: linear-gradient(135deg, #374151, #1f2937);
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .shortcut-item span {
    color: #d1d5db;
}

/* ==========================================
   PULL TO REFRESH
   ========================================== */
.pull-to-refresh-indicator {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    opacity: 0;
}

.pull-to-refresh-indicator.ready {
    background: rgba(99, 102, 241, 0.98);
    border-color: rgba(99, 102, 241, 1);
}

.pull-to-refresh-indicator.ready .pull-text {
    color: white;
}

.pull-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.pull-to-refresh-indicator.ready .pull-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

.pull-to-refresh-indicator.refreshing .pull-spinner {
    animation: spin 0.6s linear infinite;
}

.pull-text {
    font-size: 14px;
    font-weight: 600;
    color: #6366f1;
    transition: color 0.2s;
}

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

/* Dark theme */
[data-theme="dark"] .pull-to-refresh-indicator {
    background: rgba(31, 41, 55, 0.98);
}

/* ==========================================
   FLOATING ACTION BUTTON (FAB)
   ========================================== */
.floating-action-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    -webkit-tap-highlight-color: transparent;
}

.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

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

.fab-main svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-menu {
    position: absolute;
    bottom: 76px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-action-button.active .fab-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.fab-action {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    transform: scale(0);
}

.floating-action-button.active .fab-action {
    transform: scale(1);
}

.floating-action-button.active .fab-action:nth-child(1) {
    transition-delay: 0.05s;
}

.floating-action-button.active .fab-action:nth-child(2) {
    transition-delay: 0.1s;
}

.floating-action-button.active .fab-action:nth-child(3) {
    transition-delay: 0.15s;
}

.floating-action-button.active .fab-action:nth-child(4) {
    transition-delay: 0.2s;
}

.fab-action:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

/* Dark theme */
[data-theme="dark"] .fab-action {
    background: #374151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .floating-action-button {
        bottom: 80px;
        right: 16px;
    }
    
    .fab-main {
        width: 56px;
        height: 56px;
    }
    
    .fab-action {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* ==========================================
   ENHANCED TOOLTIPS
   ========================================== */
.enhanced-tooltip {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.enhanced-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.95);
}

/* ==========================================
   SWIPE FEEDBACK
   ========================================== */
.swipe-feedback {
    animation: swipeFeedbackIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes swipeFeedbackIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ==========================================
   KEYBOARD HINT
   ========================================== */
@keyframes fadeInHint {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.7;
        transform: translateY(0);
    }
}

.keyboard-hint kbd {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin: 0 2px;
}

/* ==========================================
   CIRCULAR PROGRESS RINGS
   ========================================== */
.circular-progress-container {
    display: inline-block;
    position: relative;
}

.progress-ring-circle-bg {
    opacity: 0.2;
}

.progress-ring text {
    font-family: 'Nunito', sans-serif;
}

[data-theme="dark"] .progress-ring text {
    fill: #f3f4f6;
}

/* ==========================================
   VIEW TRANSITIONS
   ========================================== */
.fade-transition {
    animation: fadeTransition 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.slide-transition {
    animation: slideTransition 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideTransition {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================
   LOADING PROGRESS BAR
   ========================================== */
.page-loading-bar {
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ==========================================
   TOUCH FEEDBACK
   ========================================== */
@media (hover: none) {
    /* Enhanced touch targets */
    .btn,
    .quick-action-item,
    .fab-action,
    .shortcut-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover::before {
        display: none;
    }
    
    /* Add touch feedback */
    .btn:active,
    .quick-action-item:active,
    .fab-action:active {
        opacity: 0.8;
    }
}

/* ==========================================
   SAFE AREA INSETS (for notched devices)
   ========================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .floating-action-button {
        bottom: calc(24px + env(safe-area-inset-bottom));
        right: calc(24px + env(safe-area-inset-right));
    }
    
    .keyboard-hint {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: calc(20px + env(safe-area-inset-right));
    }
}

/* ==========================================
   REDUCED MOTION SUPPORT
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .pull-spinner,
    .fab-main svg {
        animation: none !important;
    }
}

/* ==========================================
   HIGH CONTRAST MODE
   ========================================== */
@media (prefers-contrast: high) {
    .quick-actions-content,
    .shortcuts-content,
    .pull-to-refresh-indicator,
    .fab-main,
    .fab-action {
        border: 2px solid currentColor;
    }
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */
@media (max-width: 768px) {
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .shortcuts-content {
        padding: 24px;
        width: 95%;
    }
    
    .quick-actions-modal {
        padding-top: 10vh;
    }
    
    .keyboard-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .shortcuts-content h3 {
        font-size: 24px;
    }
    
    .shortcut-item {
        padding: 12px;
        gap: 12px;
    }
    
    .shortcut-item kbd {
        padding: 4px 8px;
        font-size: 12px;
    }
}

