/* ======== BENDRAS STILIUS ======== */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #333;
}

/* ======== HEADER ======== */
.site-header {
    background: #00695c;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.header-inner {
    max-width: 1700px;
    margin: auto;
    padding: 0 30px;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    column-gap: 28px;
    align-items: center;
}

.logo a {
    color: white;
    text-decoration: none;
    font-size: 22px;
    font-weight: bold;
    white-space: nowrap;
}
.site-logo-mark { width: 44px; height: 44px; object-fit: cover; vertical-align: middle; margin-right: 8px; clip-path: circle(44% at 50% 50%); perspective: 700px; transform-style: preserve-3d; animation: coin-spin 5s linear infinite; }
@keyframes coin-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
.header-extra-link { color: #fff; font-size: 22px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.admin-shortcuts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }
.settings-panel form { display: grid; gap: 10px; max-width: 760px; }
.settings-panel form h2 { margin: 20px 0 4px; color: #00695c; }
.settings-panel form input:not([type="checkbox"]):not([type="file"]) { display: block; width: 100%; box-sizing: border-box; padding: 9px; margin: 5px 0 12px; }
.settings-panel form label { display: block; }
.settings-logo-preview { width: 90px; height: 90px; object-fit: cover; clip-path: circle(44% at 50% 50%); vertical-align: middle; }
.success-message { padding: 10px 14px; background: #e5f5ef; color: #075f4c; border-radius: 6px; }

/* ======== NAVIGACIJA ======== */
.main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 15px;
    min-width: 0;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 15px;
    transition: opacity 0.2s;
}

.main-nav a:hover {
    opacity: 0.8;
}

/* ======== PAIEŠKA ======== */
.search-bar {
    background: #004d40;
    padding: 12px;
    text-align: center;
}

.search-input {
    width: 60%;
    padding: 8px;
    border-radius: 6px;
    border: none;
}

.search-btn {
    padding: 8px 12px;
    background: #00695c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.search-btn:hover {
    background: #004d40;
}

/* ======== KONTEINERIS ======== */
.container {
    width: 90%;
    margin: auto;
    padding: 30px 0;
}

/* ======== GRID ======== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

/* ======== KORTELĖ ======== */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

/* Pradinis puslapis: skelbimų sąrašas kairėje, reklamos dešinėje. */
.home-container { max-width: 1440px; }
.home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 28px;
    align-items: start;
}
.listing-column h1 { margin: 0 0 18px; font-size: 24px; }
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.card-image-link { display: block; }
.card-gallery { overflow: hidden; border-radius: 10px 10px 0 0; background: #edf1f0; }
.card-gallery { position: relative; }
.video-badge { position: absolute; right: 10px; bottom: 10px; z-index: 2; padding: 6px 9px; border-radius: 20px; color: #fff; background: rgba(0,0,0,.72); font-size: 12px; pointer-events: none; }
.card-gallery .gallery-frame { display: none; }
.card-gallery .gallery-frame.active { display: block; }
.card-image-link img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
}
.card-content h2 { margin: 0 0 8px; font-size: 18px; }
.card-content h2 a { color: #00695c; text-decoration: none; }
.ad-subcategory { color: #59615f; font-size: 13px; margin: 4px 0 8px; }
.subcategory-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.subcategory-filter select { min-width: 210px; padding: 8px; border: 1px solid #cbd5d2; border-radius: 6px; background: white; }
.card-content p { min-height: 2.8em; line-height: 1.4; }
.card-content .btn-green { display: inline-block; }
.sidebar {
    background: transparent;
    min-width: 0;
}
.sidebar > h2 { margin: 0 0 14px; color: #00695c; font-size: 21px; text-align: center; }
.banner-list { display: grid; gap: 12px; }
.banner-card {
    overflow: hidden;
    min-height: 105px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,.13);
    opacity: 1;
    transition: opacity .45s ease, transform .2s ease;
}
.banner-card:hover { transform: translateY(-2px); }
.banner-card.is-fading { opacity: 0; }
.banner-card a { display: block; }
.banner-card img { display: block; width: 100%; height: 140px; object-fit: cover; }
.banner-note { color: #68716f; font-size: 12px; text-align: center; }
.empty-state { padding: 18px; color: #59615f; background: white; border-radius: 8px; }

/* Shine efektas */
.card::before {
    content: "";
    position: absolute;
    top: -120%;
    left: -120%;
    width: 250%;
    height: 250%;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.0) 40%,
        rgba(255,255,255,0.25) 50%,
        rgba(255,255,255,0.0) 60%
    );
    transform: rotate(25deg);
    transition: opacity 0.4s;
    opacity: 0;
}

.card:hover::before {
    opacity: 1;
    animation: shine 0.9s ease;
}

@keyframes shine {
    from { transform: translateX(-200%) rotate(25deg); }
    to   { transform: translateX(200%) rotate(25deg); }
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

.card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.card .card-image-link img {
    height: auto;
    object-fit: contain;
}

.card-content {
    padding: 15px;
}

.card-content h3 {
    margin: 0;
    font-size: 18px;
    color: #00695c;
}

.card-content .price {
    font-weight: bold;
    color: #004d40;
    margin: 10px 0;
}

/* ======== SKELBIMO PERŽIŪRA ======== */
.ad-page {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.ad-container {
    display: flex;
    gap: 40px;
    max-width: 1100px;
    width: 100%;
}

.ad-details {
    flex: 3;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    padding: 25px;
}

.ad-details h2 {
    color: #00695c;
    margin-top: 0;
}

.ad-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}
.ad-gallery-frame { display: none; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.ad-gallery-frame.active { display: block; }
.ad-gallery-video { display: none; width: min(100%, 720px); }
.ad-gallery-video.active { display: block; }
.ad-gallery-video video { display: block; width: 100%; max-height: 520px; border-radius: 8px; background: #111; }

.ad-gallery img {
    width: 180px;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.ad-gallery video { width: min(100%, 360px); max-height: 280px; object-fit: contain; background: #111; border-radius: 6px; }

/* Skelbimo peržiūros puslapis */
.ad-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 28px;
    align-items: start;
}
.ad-details, .ad-sidebar, .edit-panel, .admin-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,.10);
    padding: 24px;
}
.ad-details h1, .ad-details h2 { color: #00695c; margin-top: 0; }
.ad-gallery img { width: min(100%, 360px); height: 280px; object-fit: contain; background: #f4f6f8; }
.ad-gallery-frame img { border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.image-lightbox { display: none; position: fixed; inset: 0; z-index: 10000; align-items: center; justify-content: center; padding: 55px 70px; background: rgba(0,0,0,.92); }
.image-lightbox.open { display: flex; }
.lightbox-image { display: block; max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lightbox-close,.lightbox-prev,.lightbox-next { position: absolute; border: 0; background: rgba(255,255,255,.16); color: white; cursor: pointer; border-radius: 50%; }
.lightbox-close { top: 16px; right: 22px; width: 44px; height: 44px; font-size: 34px; }
.lightbox-prev,.lightbox-next { top: 50%; width: 48px; height: 48px; font-size: 20px; transform: translateY(-50%); }
.lightbox-prev { left: 16px; }.lightbox-next { right: 16px; }
body.lightbox-open { overflow: hidden; }
.ad-sidebar { min-width: 0; }
.ad-sidebar .banner-card img { width: 100%; height: 140px; object-fit: cover; }

/* Administravimo lentelė ir formos */
.admin-panel { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid #e1e7e5; text-align: left; vertical-align: middle; }
.admin-table th { background: #e8f3f1; color: #004d40; }
.admin-table input { max-width: 220px; }
.edit-panel form label { display: block; margin: 14px 0; font-weight: 600; }
.edit-panel input:not([type="file"]), .edit-panel textarea { display: block; width: min(100%, 560px); margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.gallery-item { padding: 10px; background: #f4f6f8; border-radius: 8px; }
.gallery-img { width: 100%; height: 180px; object-fit: cover; border-radius: 6px; }
video.gallery-img { background: #111; object-fit: contain; }

.ad-description {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.ad-meta p {
    margin: 6px 0;
}

.ad-actions {
    margin-top: 20px;
}

.ad-sidebar {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    padding: 20px;
    height: fit-content;
}

.ad-sidebar h3 {
    text-align: center;
    color: #00695c;
}

/* ======== REKLAMŲ ROTACIJA ======== */
.single-banner-rotation .ad-item {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.single-banner-rotation .ad-item.active {
    opacity: 1;
}
.single-banner-rotation { position: relative; min-height: 140px; }
.single-banner-rotation .ad-item { display: none; }
.single-banner-rotation .ad-item.active { display: block; }

/* ======== MYGTUKAI ======== */
.btn-green {
    background: #00695c;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.btn-green:hover {
    background: #004d40;
}

.btn-red {
    background: #c62828;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.btn-red:hover {
    background: #a00000;
}

/* ======== MODAL ======== */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 320px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

/* Mokėjimo langas */
.payment-page {
    position: fixed;
    z-index: 20;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    margin: 0;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(20, 35, 32, .62);
}
.payment-modal {
    position: relative;
    width: min(100% - 32px, 520px);
    box-sizing: border-box;
    padding: 30px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 60px rgba(0,0,0,.24);
}
.payment-modal h1 { margin-top: 0; color: #00695c; }
.payment-close { position: absolute; top: 12px; right: 18px; color: #59615f; font-size: 28px; text-decoration: none; }
.payment-price { font-size: 18px; }
.payment-price span { color: #68716f; font-size: 14px; }
.payment-actions { display: flex; align-items: center; gap: 18px; margin-top: 24px; }
.payment-cancel { color: #59615f; }

/* Kontaktų kortelė ir poraštė */
.contact-panel { max-width: 760px; margin: 0 auto; padding: 28px; background: #fff; border-radius: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.10); }
.contact-panel h1, .contact-panel h2 { color: #00695c; }
footer { padding: 20px 16px; text-align: center; line-height: 1.8; }

/* ======== RESPONSIVE ======== */
@media (max-width: 900px) {
    .header-inner { display: flex; justify-content: center; }
    .ad-page-layout { grid-template-columns: 1fr; }
    .ad-page-layout .ad-sidebar { order: -1; }
    .ad-page-layout .ad-details { order: 1; }
    .ads-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .header-inner { flex-wrap: wrap; gap: 12px; }
    .main-nav { flex-wrap: wrap; }
    .home-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; }
    .ads-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ad-container {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .home-layout { grid-template-columns: 1fr; }
    .sidebar { order: 0; }
    .listing-column { order: 1; }
    .banner-list { grid-template-columns: 1fr; }
    .banner-card img { height: 120px; }
    .container { width: 94%; padding: 20px 0; }
    .header-inner {
        flex-direction: column;
        gap: 10px;
    }
    .logo a, .header-extra-link { white-space: normal; text-align: center; }
    .header-extra-link { margin-left: 0; }

    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .modal-content {
        width: 90%;
    }
    .image-lightbox { padding: 60px 55px; }
    .lightbox-prev { left: 6px; }.lightbox-next { right: 6px; }
}
