/* ============================================
   WAY DESIGN SYSTEM — Reusable Components
   ============================================
   Стандарты: .way-stat-card, .way-metrics-grid, .way-filter-bar
   Применимость: менеджер, прораб, руководитель
   ============================================ */

/* ========== WAY STAT CARD ========== */
.way-stat-card {
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.95), rgba(22, 22, 42, 0.95));
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.way-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 16px 16px 0 0;
}

.way-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Color variants */
.way-stat-card.green { border-color: rgba(16, 185, 129, 0.2); }
.way-stat-card.green::before { background: linear-gradient(90deg, #10b981, #059669); }
.way-stat-card.blue { border-color: rgba(59, 130, 246, 0.2); }
.way-stat-card.blue::before { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.way-stat-card.purple { border-color: rgba(139, 92, 246, 0.2); }
.way-stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.way-stat-card.orange { border-color: rgba(245, 158, 11, 0.2); }
.way-stat-card.orange::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.way-stat-card.red { border-color: rgba(239, 68, 68, 0.2); }
.way-stat-card.red::before { background: linear-gradient(90deg, #ef4444, #dc2626); }

.way-stat-icon {
    width: 44px; height: 44px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px; font-size: 1.3rem;
}

.way-stat-card.green .way-stat-icon { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.way-stat-card.blue .way-stat-icon { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.way-stat-card.purple .way-stat-icon { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.way-stat-card.orange .way-stat-icon { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.way-stat-card.red .way-stat-icon { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.way-stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.way-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
}

.way-stat-card.green .way-stat-value { color: #10b981; }
.way-stat-card.blue .way-stat-value { color: #3b82f6; }
.way-stat-card.orange .way-stat-value { color: #f59e0b; }
.way-stat-card.red .way-stat-value { color: #ef4444; }

/* ========== WAY METRICS GRID ========== */
.way-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 767px) {
    .way-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 380px) {
    .way-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== WAY FILTER BAR ========== */
.way-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    padding: 6px;
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.6), rgba(22, 22, 42, 0.6));
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    margin-bottom: 16px;
}

.way-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(107, 114, 128, 0.15);
    background: rgba(107, 114, 128, 0.08);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.way-filter-pill:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.2);
}

.way-filter-pill.active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.25);
}

.way-filter-pill .badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 2px;
}

.way-filter-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px;
    flex-shrink: 0;
}

.way-filter-select {
    width: auto;
    min-width: 110px;
    padding: 8px 12px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 10px;
    color: #ccc;
    outline: none;
    transition: border-color 0.2s;
}

.way-filter-select:focus {
    border-color: rgba(99, 102, 241, 0.3);
}

.way-filter-search {
    width: auto;
    min-width: 130px;
    padding: 8px 12px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 10px;
    color: #ccc;
    outline: none;
    transition: border-color 0.2s;
}

.way-filter-search:focus {
    border-color: rgba(99, 102, 241, 0.3);
}

.way-filter-search::placeholder {
    color: #666;
}

@media (max-width: 767px) {
    .way-filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }
    .way-filter-bar::-webkit-scrollbar { display: none; }
    
    .way-filter-pill {
        flex-shrink: 0;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    .way-filter-select,
    .way-filter-search {
        flex-shrink: 0;
        min-width: 100px;
        font-size: 0.75rem;
    }
}

/* ========== WAY HERO SECTION ========== */
.way-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    padding: 36px 32px;
    border-radius: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.way-hero::before {
    content: '';
    position: absolute;
    top: -80px; right: -40px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.way-hero::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -30px;
    width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.way-hero-content {
    position: relative;
    z-index: 1;
}

.way-hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.way-hero-title i { color: #818cf8; font-size: 1.8rem; }

.way-hero-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    margin: 0;
}

/* ========== WAY PILL TABS ========== */
.way-pill-tabs {
    display: flex;
    gap: 0;
    padding: 5px;
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.8), rgba(22, 22, 42, 0.8));
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 24px;
}

.way-pill-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border-radius: 14px;
    background: transparent;
    color: #888;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.way-pill-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.way-pill-tab .badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
}

.way-pill-tab.active .badge {
    background: rgba(255, 255, 255, 0.25);
}

.way-pill-tab:not(.active) .badge {
    background: rgba(255, 255, 255, 0.1);
}

/* ========== WAY CARD (Section) ========== */
.way-section-card {
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.95), rgba(22, 22, 42, 0.95));
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* ========== GLOBAL DATA-HREF CLICK HANDLER ========== */
/* Подключён в base.html — document.addEventListener('click', ...) для [data-href] */

/* ========== WAY VIEW TOGGLE ========== */
.way-view-toggle {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 3px;
    flex-shrink: 0;
}

.way-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
}

.way-view-btn:hover { color: #a5b4fc; background: rgba(99, 102, 241, 0.1); }
.way-view-btn.active { background: rgba(99, 102, 241, 0.25); color: #818cf8; }
