/* ============================================================
   OAP Frontend — Banners + News
   Подключается на фронте сайта
   ============================================================ */

/* ─── Banners ─── */
.oap-banner {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.oap-banner img {
    transition: opacity 0.2s;
}

.oap-banner a:hover img {
    opacity: 0.92;
}

.oap-banners {
    margin-bottom: 20px;
}

/* ─── Banner Slider ─── */
.oap-slider {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
}

.oap-slider-track {
    position: relative;
}

.oap-slider-slide {
    display: none;
    animation: oapFadeIn 0.4s ease;
}

.oap-slider-slide.active {
    display: block;
}

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

.oap-slider-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.oap-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid rgba(0,0,0,0.1);
}

.oap-slider-dot.active,
.oap-slider-dot:hover {
    background: #fff;
}

.oap-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.oap-slider-arrow:hover {
    background: rgba(0,0,0,0.6);
}

.oap-slider-prev { left: 10px; }
.oap-slider-next { right: 10px; }

/* ─── News Block (homepage) ─── */
.oap-news-block {
    padding: 24px 0;
}

.oap-news-block-title {
    font-size: 18px;
    color: #212121;
    margin-bottom: 16px;
}

.oap-news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .oap-news-grid {
        grid-template-columns: 1fr;
    }
}

.oap-news-card {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px rgba(0,0,0,0.16);
    transition: box-shadow 0.2s, background-color 0.2s;
    display: block;
}

.oap-news-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background-color: #f0f6ff;
    text-decoration: none;
    color: inherit;
}

.oap-news-card-img {
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
}

.oap-news-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oap-news-card-body {
    padding: 14px 16px;
}

.oap-news-card-date {
    font-size: 12px;
    color: #757575;
    margin-bottom: 4px;
}

.oap-news-card-title {
    font-size: 14px;
    color: #212121;
    line-height: 1.3;
    margin-bottom: 6px;
}

.oap-news-card-text {
    font-size: 13px;
    color: #616161;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.oap-news-more {
    display: inline-block;
    color: #1b6bb1;
    font-size: 14px;
    text-decoration: none;
}

.oap-news-more:hover {
    text-decoration: underline;
    color: #155a96;
}

/* ─── News List Page ─── */
.oap-news-page {
    max-width: 100%;
    padding: 0;
}

/* News Grid — 2-column tile layout */
.oap-nl-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.oap-nl-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.16);
    transition: box-shadow 0.2s, background-color 0.2s;
}

.oap-nl-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background-color: #f0f6ff;
}

.oap-nl-card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
    display: block;
}

.oap-nl-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.oap-nl-card:hover .oap-nl-card-img img {
    transform: scale(1.05);
}

.oap-nl-card-body {
    padding: 16px;
}

.oap-nl-card-meta {
    font-size: 12px;
    color: #757575;
    margin-bottom: 6px;
}

.oap-nl-card-title {
    font-size: 16px;
    line-height: 1.35;
    margin: 0 0 8px;
}

.oap-nl-card-title a {
    color: #212121;
    text-decoration: none;
    transition: color 0.15s;
}

.oap-nl-card-title a:hover { color: #1b6bb1; }

.oap-nl-card-text {
    font-size: 13px;
    color: #616161;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

.oap-nl-card-more {
    font-size: 13px;
    color: #1b6bb1;
    text-decoration: none;
}

.oap-nl-card-more:hover {
    text-decoration: underline;
    color: #155a96;
}

/* Pagination */
.oap-nl-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px 0 8px;
}

.oap-nl-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    color: #616161;
    text-decoration: none;
    transition: all 0.15s;
    background: #fff;
}

.oap-nl-pag-btn:hover {
    background: #e3f2fd;
    border-color: #1b6bb1;
    text-decoration: none;
    color: #212121;
}

.oap-nl-pag-btn.active {
    background: #1b6bb1;
    color: #fff;
    border-color: #1b6bb1;
}

.oap-nl-pag-dots {
    padding: 0 4px;
    color: #757575;
}

/* Mobile — 1 column */
@media (max-width: 768px) {
    .oap-nl-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Single News Article ─── */
.oap-ns-article {
    max-width: 100%;
    padding: 0;
}

.oap-ns-back {
    display: inline-block;
    margin-bottom: 16px;
    color: #1b6bb1;
    text-decoration: none;
    font-size: 14px;
}

.oap-ns-back:hover { text-decoration: underline; color: #155a96; }

.oap-ns-header { margin-bottom: 20px; }

.oap-ns-title {
    font-size: 24px;
    color: #212121;
    line-height: 1.3;
    margin: 0 0 8px;
}

.oap-ns-meta {
    font-size: 13px;
    color: #757575;
}

.oap-ns-hero {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
}

.oap-ns-hero img {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: cover;
}

.oap-ns-body {
    font-size: 15px;
    line-height: 1.75;
    color: #212121;
}

.oap-ns-body p { margin-bottom: 16px; }
.oap-ns-body h2 { font-size: 20px; margin: 28px 0 12px; color: #212121; }
.oap-ns-body h3 { font-size: 17px; margin: 22px 0 10px; color: #212121; }
.oap-ns-body ul, .oap-ns-body ol { padding-left: 24px; margin-bottom: 16px; }
.oap-ns-body li { margin-bottom: 6px; }
.oap-ns-body img { max-width: 100%; border-radius: 8px; margin: 16px 0; }
.oap-ns-body a { color: #1b6bb1; }
.oap-ns-body a:hover { text-decoration: underline; }
.oap-ns-body blockquote {
    border-left: 3px solid #1b6bb1;
    padding: 12px 20px;
    margin: 16px 0;
    background: #f5f5f5;
    color: #616161;
    border-radius: 0 6px 6px 0;
}
.oap-ns-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.oap-ns-body th, .oap-ns-body td {
    padding: 10px 14px;
    border: 1px solid #ebebeb;
    text-align: left;
    font-size: 14px;
}
.oap-ns-body th { background: #f5f5f5; }

.oap-ns-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #ebebeb;
}

@media (max-width: 640px) {
    .oap-ns-title { font-size: 20px; }
    .oap-ns-hero img { max-height: 250px; }
}


/* ============================================================
   Homepage Redesign — Blocks
   ============================================================ */

/* ─── Common ─── */
.oap-hp-section {
    margin-bottom: 32px;
}

.oap-hp-section-title {
    font-size: 18px;
    color: #212121;
    margin: 0 0 16px;
    line-height: 1.3;
}

.oap-hp-viewall {
    text-align: center;
    margin-top: 16px;
}

.oap-hp-viewall a {
    color: #1b6bb1;
    font-size: 14px;
    text-decoration: none;
}

.oap-hp-viewall a:hover {
    text-decoration: underline;
    color: #155a96;
}

/* ─── Banner Templates ─── */

/* Overlay: image + text on top */
.oap-banner-overlay {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.oap-banner-overlay img {
    width: 100%;
    display: block;
}

.oap-banner-overlay-bg {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0.35;
}

.oap-banner-overlay-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 32px;
    z-index: 1;
}

/* Gradient: bg + text, no image */
.oap-banner-gradient {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/1;
}

.oap-banner-gradient-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 32px;
}

/* Text positioning */
.oap-text-left { align-items: flex-start; text-align: left; }
.oap-text-center { align-items: center; text-align: center; }
.oap-text-right { align-items: flex-end; text-align: right; }

.oap-banner-title {
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 6px;
}

.oap-banner-subtitle {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 14px;
    opacity: 0.9;
}

.oap-banner-cta {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 6px;
    background: #1b6bb1;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.oap-banner-cta:hover {
    background: #155a96;
    color: #fff;
    text-decoration: none;
}

@media (max-width: 768px) {
    .oap-banner-overlay-content,
    .oap-banner-gradient-content {
        padding: 16px 20px;
    }
    .oap-banner-title { font-size: 16px; }
    .oap-banner-subtitle { font-size: 12px; margin-bottom: 10px; }
    .oap-banner-cta { padding: 8px 16px; font-size: 12px; }
    .oap-banner-gradient { aspect-ratio: 4/1; }
}

/* ─── Banner in Cart ─── */
.oap-cart-banner {
    margin: 20px 0;
}

.oap-cart-banner .oap-banner {
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
}

.oap-cart-banner .oap-banner img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* ─── Banner on Homepage ─── */
.oap-hp-banner {
    margin: 16px 0 24px 0;
}

.oap-hp-banner .oap-banner {
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
}

.oap-hp-banner .oap-banner img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.oap-hp-banner .oap-slider {
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
}

.oap-hp-banner .oap-slider img {
    width: 100%;
    height: auto;
    display: block;
}

.oap-hp-banner .oap-slider-dot.active,
.oap-hp-banner .oap-slider-dot:hover {
    background: #1b6bb1;
}

.oap-hp-banner .oap-slider-arrow {
    background: rgba(27,107,177,0.7);
}

.oap-hp-banner .oap-slider-arrow:hover {
    background: rgba(27,107,177,0.9);
}

/* ─── Top Categories ─── */
.oap-hp-cats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.oap-hp-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 20px 12px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.16);
    transition: box-shadow 0.2s, background-color 0.2s;
    text-align: center;
}

.oap-hp-cat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-decoration: none;
}

.oap-hp-cat-card:hover .oap-hp-cat-img img {
    transform: scale(1.08);
}

.oap-hp-cat-img img {
    transition: transform 0.3s;
}

.oap-hp-cat-img {
    width: 100%;
    height: 100px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oap-hp-cat-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.oap-hp-cat-name {
    font-size: 14px;
    color: #212121;
    line-height: 1.3;
}

/* ─── Homepage Mobile ─── */
@media (max-width: 768px) {
    .oap-hp-cats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .oap-hp-cats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .oap-hp-cat-card {
        padding: 10px 6px;
    }
    .oap-hp-cat-img {
        height: 60px;
    }
    .oap-hp-cat-name {
        font-size: 11px;
    }
}
