/**
 * 🎯 Smart Timeline Filters
 * Beautiful, tap-friendly, intelligent filtering system
 */

/* ========================================
   FILTER PILLS - STICKY BAR
   ======================================== */
.sh-smart-filters {
   margin: 10px 10px;
}

.sh-filter-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.sh-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.sh-filter-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.sh-filter-pill.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.sh-filter-pill.active .sh-pill-count {
    background: linear-gradient(135deg, #4A90E2 0%, #5BA3F5 100%);
    color: white;
}

.sh-filter-pill svg {
    width: 18px;
    height: 18px;
}

.sh-pill-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.sh-filter-pill.active .sh-pill-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   SELECTED CHIPS BAR
   ======================================== */
.sh-selected-chips {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(74, 144, 226, 0.08);
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 10px;
    animation: slideDown 0.3s ease;
}

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

.sh-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.sh-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(74, 144, 226, 0.15);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    color: #5BA3F5;
    font-size: 13px;
    font-weight: 600;
    animation: chipIn 0.2s ease;
}

@keyframes chipIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sh-chip-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.sh-chip-remove:hover {
    transform: scale(1.2);
}

.sh-chip-remove svg {
    width: 14px;
    height: 14px;
}

.sh-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.sh-clear-all:hover {
    background: rgba(74, 144, 226, 0.1);
    border-color: rgba(74, 144, 226, 0.3);
    color: #5BA3F5;
}

.sh-clear-all svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   FILTER MODALS
   ======================================== */
.sh-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sh-filter-modal.active {
    display: flex;
}

.sh-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.2s ease;
}

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

.sh-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 70vh;
    max-height: 600px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.sh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sh-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.sh-modal-header h3 svg {
    width: 24px;
    height: 24px;
    color: #4A90E2;
}

.sh-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.7);
}

.sh-modal-close:hover {
    background: rgba(230, 57, 70, 0.1);
    border-color: rgba(230, 57, 70, 0.3);
    color: #ff6b6b;
}

.sh-modal-close svg {
    width: 20px;
    height: 20px;
}

.sh-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.sh-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sh-modal-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 30%;
    min-width: 120px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #f87171;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sh-modal-clear:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-2px);
}

.sh-modal-clear:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.sh-modal-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-width: 180px;
    padding: 12px 24px;
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    border-radius: 12px;
    color: #4ade80;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sh-modal-apply:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
    transform: translateY(-2px);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .sh-modal-footer {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .sh-modal-clear,
    .sh-modal-apply {
        flex: 1 1 100%;
        min-width: unset;
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .sh-modal-clear {
        order: 2;
    }
    
    .sh-modal-apply {
        order: 1;
    }
}

/* ========================================
   SEARCH BAR - STICKY
   ======================================== */
.sh-search-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, #1a1a1a 0%, rgba(26, 26, 26, 0.98) 100%);
    padding: 20px 24px;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sh-search-bar svg {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.sh-search-bar input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}

.sh-search-bar input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: #4A90E2;
}

.sh-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ========================================
   TYPE GRID
   ======================================== */
.sh-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sh-type-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    max-height: 160px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sh-type-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.sh-type-item.selected {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.sh-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.sh-type-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   ACTIVITY GRID
   ======================================== */
.sh-activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sh-activity-item {
    display: flex;
  align-items: center;
  justify-content: center;
  max-height: 160px;
  min-height: 160px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.sh-activity-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.sh-activity-item.selected {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* ========================================
   COMPANY & REGION GRIDS
   ======================================== */
.sh-company-grid,
.sh-region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sh-company-item,
.sh-region-item {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 160px;
    min-height: 160px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    word-wrap: break-word;
    line-height: 1.4;
}

/* Hidden state for filtering */
.sh-activity-item.sh-hidden,
.sh-company-item.sh-hidden,
.sh-region-item.sh-hidden {
    display: none;
}

.sh-company-item:hover,
.sh-region-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.sh-company-item.selected,
.sh-region-item.selected {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.sh-search-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

/* ========================================
   LOADING STATE
   ======================================== */
.sh-loading {
    text-align: center;
    padding: 40px 20px;
}

.sh-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4A90E2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.sh-loading p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

/* ========================================
   TIMELINE FEED TRANSITIONS
   ======================================== */
#timeline-feed {
    transition: opacity 0.3s ease;
}

#timeline-feed.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sh-activity-item {

  max-height: 140px;
  min-height: 80px;

    }
    .sh-smart-filters {
        margin: 0 0 20px 0;
        padding: 12px 16px;
    }
    
    .sh-filter-pills {
        gap: 8px;
    }
    
    .sh-chips-container {
        padding: 0 4px;
    }
    
    .sh-filter-pill {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .sh-filter-pill svg {
        width: 16px;
        height: 16px;
    }
    
    .sh-modal-content {
        max-width: 100%;
        height: 96vh;
        max-height: none;
        border-radius: 16px;
    }
    
    .sh-modal-header {
        padding: 20px;
    }
    
    .sh-modal-header h3 {
        font-size: 18px;
    }
    
    .sh-search-bar {
        padding: 16px 20px;
    }
    
    .sh-type-grid,
    .sh-activity-grid,
    .sh-company-grid,
    .sh-region-grid {
        padding: 20px;
    }
    
    .sh-type-grid {
      /*  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;*/
    }
    
    .sh-activity-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .sh-company-grid,
    .sh-region-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .sh-company-item,
    .sh-region-item {
        min-height: 80px;
    }
    
    .sh-selected-chips {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sh-clear-all {
        width: 100%;
        justify-content: center;
    }
}
