/* Активни Потребители - Main Stylesheet */

:root {
    --ap-primary: #ed1c24;
    --ap-primary-dark: #c41219;
    --ap-primary-light: #fce4e5;
    --ap-dark: #2d2d2d;
    --ap-yellow: #ffc107;
    --ap-orange: #fd7e14;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
}

/* Navbar */
.navbar-ap {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.navbar-ap .navbar-brand img {
    height: 49px;
    width: auto;
}
.navbar-ap .nav-link { color: var(--ap-dark); font-weight: 500; }
.navbar-ap .nav-link:hover { color: var(--ap-primary); }
.navbar-ap .btn-ap {
    background: var(--ap-primary);
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 8px;
}
.navbar-ap .btn-ap:hover { background: var(--ap-primary-dark); color: #fff; }
.navbar-search .form-control {
    border-radius: 8px 0 0 8px;
    border: 2px solid #e0e0e0;
    border-right: none;
}
.navbar-search .form-control:focus {
    border-color: var(--ap-primary);
    box-shadow: none;
}
.navbar-search .btn {
    background: var(--ap-primary);
    color: #fff;
    border: 2px solid var(--ap-primary);
    border-radius: 0 8px 8px 0;
}
.navbar-search .btn:hover { background: var(--ap-primary-dark); border-color: var(--ap-primary-dark); }

/* Hero / Search Section */
.hero-search {
    background: linear-gradient(135deg, var(--ap-primary) 0%, var(--ap-primary-dark) 100%);
    color: white;
    padding: 3rem 0;
    margin: -1.5rem -0.75rem 2rem;
    text-align: center;
}
.hero-search h1 { font-size: 2rem; font-weight: 700; }
.hero-search .form-control {
    font-size: 1.2rem;
    padding: 0.8rem 1.2rem;
    border-radius: 50px 0 0 50px;
    border: none;
}
.hero-search .btn {
    border-radius: 0 50px 50px 0;
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    background: var(--ap-dark);
    border: none;
    color: #fff;
}
.hero-search .btn:hover { background: #444; }

/* Category Cards */
.category-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}
.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(237,28,36,0.15);
}
.category-card .card-body { text-align: center; padding: 1.5rem 1rem; }
.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--ap-primary);
}

/* Product Cards */
.product-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    transition: box-shadow 0.2s;
}
.product-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.price-tag {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ap-primary);
}
.price-promo {
    color: var(--ap-primary);
    font-weight: 700;
}
.price-bgn {
    color: #888;
    font-size: 0.78em;
    font-weight: 400;
}
.price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
}
.badge-promo {
    background: var(--ap-primary);
    color: white;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 20px;
}

/* Buttons */
.btn-primary-ap {
    background: var(--ap-primary);
    border-color: var(--ap-primary);
    color: #fff;
}
.btn-primary-ap:hover {
    background: var(--ap-primary-dark);
    border-color: var(--ap-primary-dark);
    color: #fff;
}
.btn-outline-primary-ap {
    color: var(--ap-primary);
    border-color: var(--ap-primary);
    background: transparent;
}
.btn-outline-primary-ap:hover {
    background: var(--ap-primary);
    border-color: var(--ap-primary);
    color: #fff;
}

/* Chain logos / badges */
.chain-badge {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #555;
}

/* Comparison Table */
.comparison-table th { background: var(--ap-primary-light); }
.comparison-table .cheapest { background: #d1e7dd; font-weight: 700; }
.comparison-table .missing { background: #f8d7da; color: #842029; }
.comparison-table .substituted { background: #fff3cd; color: #664d03; }

/* Cart */
.cart-item { border-bottom: 1px solid #eee; padding: 1rem 0; }
.cart-item:last-child { border-bottom: none; }

/* Stats counters */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}
.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ap-primary);
}
.stat-card .label {
    color: #666;
    font-size: 0.9rem;
}

/* Search results */
.search-highlight { background: #fff3cd; padding: 0 2px; border-radius: 2px; }

/* Autosuggest Dropdown */
.autosuggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    /* Decoupled from the (often narrow) input width so suggestions stay
       readable even when the navbar search box is small. */
    width: max(100%, 440px);
    max-width: 92vw;
    max-height: min(70vh, 540px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 1050;
    display: none;
}
.autosuggest-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
    gap: 12px;
}
.autosuggest-item:last-of-type { border-bottom: none; }
.autosuggest-item:hover,
.autosuggest-item.as-active {
    background: var(--ap-primary-light);
    color: #333;
    text-decoration: none;
}
.as-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f5f5f5;
    font-size: 1.1rem;
}
.autosuggest-item:hover .as-icon,
.autosuggest-item.as-active .as-icon {
    background: #fff;
}
.as-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}
.as-name {
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.as-name mark {
    background: #fff3cd;
    padding: 0 1px;
    border-radius: 2px;
}
.as-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.78rem;
    color: #999;
}
.as-chain { color: #888; }
.as-cat {
    color: #aaa;
}
.as-cat::before {
    content: '\00b7';
    margin-right: 6px;
}
.as-right { flex-shrink: 0; text-align: right; margin-left: auto; }
.as-price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ap-primary);
    white-space: nowrap;
}
.as-price.as-promo { color: var(--ap-primary); }
.autosuggest-all {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: #f8f9fa;
    color: var(--ap-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #dee2e6;
}
.autosuggest-all:hover {
    background: var(--ap-primary-light);
    color: var(--ap-primary-dark);
    text-decoration: none;
}

/* On phones the suggestions become a near-fullscreen panel pinned below the
   sticky navbar, with large touch targets and wrapping names — readable on
   every screen instead of cramped under a tiny search box. */
@media (max-width: 575.98px) {
    .autosuggest-dropdown {
        position: fixed;
        top: 60px;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 72px);
        border-radius: 12px;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 14px 44px rgba(0,0,0,0.30);
    }
    .autosuggest-item { padding: 14px 16px; }
    .as-name { font-size: 1rem; white-space: normal; }
    .as-meta { font-size: 0.82rem; }
    .as-icon { width: 40px; height: 40px; font-size: 1.25rem; }
    .as-price { font-size: 1.05rem; }
    .autosuggest-all { padding: 15px 16px; font-size: 0.95rem; }
}

/* Make hero search input group stay above dropdown */
.hero-search .input-group { position: relative; }

/* Footer */
.footer-ap {
    background: var(--ap-dark);
}
.footer-ap a { color: #adb5bd; }
.footer-ap a:hover { color: var(--ap-primary); }

/* Responsive */
@media (max-width: 768px) {
    .hero-search h1 { font-size: 1.5rem; }
    .hero-search .form-control { font-size: 1rem; padding: 0.6rem 1rem; }
    .navbar-ap .navbar-brand img { height: 38px; }
}

/* "Как работи" navigation button — leko pulsing to draw attention */
.how-it-works-btn {
    background: linear-gradient(135deg, var(--ap-primary), #b91c1c);
    color: #fff;
    border: none;
    animation: howItWorksPulse 2.4s ease-in-out infinite;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.how-it-works-btn:hover,
.how-it-works-btn:focus {
    color: #fff;
    transform: translateY(-1px);
    animation-play-state: paused;
    box-shadow: 0 6px 18px rgba(237, 28, 36, 0.35);
}
@keyframes howItWorksPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(237, 28, 36, 0.55); }
    50%      { box-shadow: 0 0 0 10px rgba(237, 28, 36, 0); }
}
/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
    .how-it-works-btn { animation: none; }
}

/* Hero step-by-step explainer */
.hero-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}
.hero-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;       /* позволява на flex children да се свиват */
    max-width: 220px;
    text-align: center;
}
.hero-step-icon {
    position: relative;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ffc107;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    color: var(--ap-primary);
    box-shadow: 0 8px 22px rgba(0,0,0,0.30), inset 0 -3px 0 rgba(0,0,0,0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.hero-step:hover .hero-step-icon {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 12px 28px rgba(0,0,0,0.40), inset 0 -3px 0 rgba(0,0,0,0.05);
}
.hero-step-num {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ffc107;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.30);
}
.hero-step-label {
    color: #fff;
    font-size: 0.92rem;
    line-height: 1.28;
    font-weight: 600;
    min-height: 2.4em;     /* 2 реда винаги — еднаква височина за всичките 4 */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.hero-step-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.85);
    font-size: 1.4rem;
    height: 78px;            /* подравнено с иконките */
    flex: 0 0 auto;
    padding: 0 2px;
}
@media (max-width: 767px) {
    .hero-steps { gap: 4px; }
    .hero-step { gap: 8px; }
    .hero-step-icon { width: 62px; height: 62px; font-size: 1.6rem; border-width: 2px; }
    .hero-step-num { width: 24px; height: 24px; font-size: 0.8rem; top: -6px; right: -6px; }
    .hero-step-label { font-size: 0.78rem; min-height: 2.6em; }
    .hero-step-arrow { font-size: 1rem; height: 62px; }
}
/* Много малки екрани — стрелките стават надолу, стъпките вертикално */
@media (max-width: 479px) {
    .hero-steps { flex-direction: column; align-items: center; gap: 2px; }
    .hero-step { flex-direction: row; max-width: 320px; gap: 14px; width: 100%; }
    .hero-step-label { min-height: 0; text-align: left; justify-content: flex-start; font-size: 0.95rem; flex: 1; }
    .hero-step-icon { flex: 0 0 auto; }
    .hero-step-arrow { transform: rotate(90deg); height: auto; padding: 2px 0; }
}

/* Четлив оранжев цвят за „цена от вчера". Bootstrap text-warning беше
   твърде светложълто върху бял фон — потребителят не го виждаше. */
.text-orange-bold { color: #d97706 !important; font-weight: 600; }
