/* static/css/modern_ux.css */
/* PyCRM Modern UX Transformation Stylesheet */
/* Ergonomics, Command Palette, Draft Auto-Save, Skeleton Loaders, Chevrons, & Mobile Bottom Bar */

/* ==========================================================================
   1. Universal Command Palette (Spotlight Ctrl+K)
   ========================================================================== */
.command-palette-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2147483600;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: cpFadeIn 0.15s ease-out;
}

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

.command-palette-modal {
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #0f172a);
    width: 640px;
    max-width: 92vw;
    border-radius: 14px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-color, rgba(226, 232, 240, 0.8));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
    animation: cpSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cpSlideDown {
    from { transform: translateY(-16px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.cp-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    gap: 12px;
    background: var(--bg-body, #f8fafc);
}

.cp-search-icon {
    font-size: 16px;
    color: var(--primary, #6366f1);
    flex-shrink: 0;
}

.cp-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary, #0f172a);
    font-family: inherit;
    font-weight: 500;
}

.cp-input::placeholder {
    color: var(--text-muted, #94a3b8);
}

.cp-esc-pill {
    font-size: 11px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary, #64748b);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 5px;
    padding: 2px 7px;
    font-weight: 600;
    font-family: monospace;
}

.cp-results-container {
    overflow-y: auto;
    padding: 8px 10px;
    flex: 1;
    max-height: 440px;
}

.cp-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #64748b);
    padding: 8px 10px 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.05s ease;
    user-select: none;
}

.cp-item:hover,
.cp-item.cp-item-selected {
    background: rgba(99, 102, 241, 0.08);
}

body.dark-theme .cp-item:hover,
body.dark-theme .cp-item.cp-item-selected {
    background: rgba(99, 102, 241, 0.2);
}

.cp-item-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary, #6366f1);
    flex-shrink: 0;
}

.cp-item-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cp-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-item-subtitle {
    font-size: 11.5px;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-item-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary, #475569);
    flex-shrink: 0;
}

.cp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-body, #f8fafc);
    font-size: 11px;
    color: var(--text-muted, #64748b);
}

.cp-footer-hints {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cp-footer-hint-key {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
    font-weight: 600;
}

/* ==========================================================================
   2. Form Draft Auto-Save Banner
   ========================================================================== */
.form-draft-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.04);
    animation: draftBannerSlide 0.2s ease-out;
}

@keyframes draftBannerSlide {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.draft-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
}

.draft-banner-icon {
    font-size: 16px;
    color: var(--primary, #6366f1);
}

.draft-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.draft-btn-restore {
    background: var(--primary, #6366f1);
    color: #ffffff;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.draft-btn-restore:hover {
    background: #4f46e5;
}

.draft-btn-discard {
    background: transparent;
    color: var(--text-secondary, #64748b);
    border: 1px solid var(--border-color, #cbd5e1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.draft-btn-discard:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   3. Shimmering Skeleton Loaders
   ========================================================================== */
.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        rgba(226, 232, 240, 0.4) 0%,
        rgba(241, 245, 249, 0.9) 50%,
        rgba(226, 232, 240, 0.4) 100%
    );
    background-size: 200% 100%;
    animation: shimmerWave 1.4s infinite linear;
    border-radius: 6px;
}

body.dark-theme .skeleton-shimmer {
    background: linear-gradient(
        90deg,
        rgba(30, 41, 59, 0.6) 0%,
        rgba(51, 65, 85, 0.8) 50%,
        rgba(30, 41, 59, 0.6) 100%
    );
    background-size: 200% 100%;
}

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

.skeleton-table-wrapper {
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.skeleton-cell {
    height: 14px;
    border-radius: 4px;
}

/* ==========================================================================
   4. Contextual Actionable Empty States
   ========================================================================== */
.modern-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-card, #ffffff);
    border-radius: 12px;
    border: 1px dashed var(--border-color, #cbd5e1);
    margin: 16px 0;
}

.empty-state-badge-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--primary, #6366f1);
    margin-bottom: 16px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.empty-state-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 6px 0;
    font-family: 'Outfit', sans-serif;
}

.empty-state-desc {
    font-size: 13.5px;
    color: var(--text-secondary, #64748b);
    max-width: 440px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.empty-state-cta-btn {
    background: var(--primary, #6366f1);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transition: transform 0.12s ease, background 0.15s ease;
}

.empty-state-cta-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

/* ==========================================================================
   5. Interactive Chevron Pipeline Stage Stepper
   ========================================================================== */
.chevron-pipeline-stepper {
    display: flex;
    align-items: center;
    width: 100%;
    overflow-x: auto;
    padding: 6px 2px;
    margin-bottom: 14px;
    gap: 4px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.chevron-step {
    flex: 1;
    min-width: 110px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    position: relative;
}

.chevron-step:hover {
    background: rgba(99, 102, 241, 0.06);
    color: var(--primary, #6366f1);
}

.chevron-step.completed {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.chevron-step.completed i {
    font-size: 11px;
    color: #10b981;
}

.chevron-step.active {
    background: var(--primary, #6366f1);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.chevron-step.active i {
    color: #ffffff;
}

/* ==========================================================================
   6. Pinned Favorites & Recents Quick Bar (Removed per user request)
   ========================================================================== */
.topbar-favorites-bar {
    display: none !important;
}

.topbar-favorites-bar::-webkit-scrollbar {
    display: none;
}

.fav-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-body, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.fav-pill:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary, #6366f1);
    border-color: rgba(99, 102, 241, 0.3);
}

.fav-pill i {
    font-size: 11px;
}

/* ==========================================================================
   7. Mobile Bottom Navigation Bar (< 768px)
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-card, #ffffff);
        border-top: 1px solid var(--border-color, #e2e8f0);
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
        align-items: center;
        justify-content: space-around;
        padding: 0 4px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--text-secondary, #64748b);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        min-width: 48px;
        height: 100%;
        cursor: pointer;
        user-select: none;
    }

    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--primary, #6366f1);
    }

    .mobile-nav-icon {
        font-size: 17px;
    }

    .mobile-nav-add-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--primary, #6366f1);
        color: #ffffff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
        margin-top: -16px;
        border: 3px solid var(--bg-card, #ffffff);
    }

    .mobile-nav-add-btn i {
        font-size: 18px;
    }
}
