/* --- Custom layout for homepage with sidebars and responsive grid --- */
.page-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: center; /* bütün blokları ortalayır */
    width: 100%;
    gap: 0; /* default gap, can be adjusted */
}

.sidebar-left {
    width: 200px;
    min-width: 200px;
    margin-right: 32px;
    position: sticky;
    top: 24px;
    align-self: flex-start;
    height: fit-content;
    z-index: 2;
}
.sidebar-right {
    width: 200px;
    min-width: 200px;
    margin-left: 32px;
    position: sticky;
    top: 24px;
    align-self: flex-start;
    height: fit-content;
    z-index: 2;
}
@media (max-width: 960px) {
    .sidebar-left,
    .sidebar-right {
        position: static !important;
        top: unset !important;
        height: auto !important;
    }
}

.sidebar-left, .sidebar-right {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.sidebar-left, .sidebar-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.sidebar-left:empty, .sidebar-right:empty {
    display: none !important;
}
.main-content {
    width: 800px;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
/* Hero section always consistent size */
.main-content .hero {
    max-width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}
/* Listings grid responsive columns */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
@media (max-width: 1200px) {
    .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}
@media (max-width: 960px) {
    .sidebar-left, .sidebar-right {
        display: none !important;
    }
    .main-content {
        width: 100%;
    }
    .listings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .listings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 400px) {
    .listings-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
:root {
    --red-900: #4a0808;
    --red-800: #6e0f0f;
    --red-700: #921515;
    --red-600: #b01c1c;
    --red-500: #cc2a2a;
    --dark-900: #111111;
    --dark-800: #1c1c1c;
    --dark-700: #2a2a2a;
    --dark-600: #3a3a3a;
    --light: #f7f2f2;
    --line: #e0cece;
    --text: #1a1010;
    --white: #ffffff;
    --danger: #cc2a2a;
    --success: #1f9d61;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 90% 10%, rgba(176, 28, 28, 0.10), transparent 30%),
        radial-gradient(circle at 10% 30%, rgba(110, 15, 15, 0.08), transparent 28%),
        linear-gradient(180deg, #faf5f5 0%, #f2e8e8 100%);
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(17, 17, 17, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(204, 42, 42, 0.35);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    height: 52px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 6px rgba(204, 42, 42, 0.4));
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-nav a {
    color: #f0e0e0;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--red-500), var(--red-700));
    color: var(--white);
    border: 0;
    border-radius: 10px;
    text-decoration: none;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
}

.main-content {
    padding-block: 24px 50px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.hero {
    background: linear-gradient(135deg, var(--dark-800), var(--red-800));
    color: var(--white);
    border-radius: 18px;
    padding: 30px;
    margin-bottom: 20px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(26px, 3vw, 40px);
}

.filter-panel,
.auth-card,
.form-card,
.description-card,
.table-wrap,
.detail-panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(100, 10, 10, 0.08);
}

.filters,
.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

.checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.checkbox input {
    width: auto;
}

.section-head {
    margin: 18px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-with-ads {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
    width: 100%;
}

.page-with-ads.has-left-ads {
    grid-template-columns: 200px 1fr;
}

.page-with-ads.has-right-ads {
    grid-template-columns: 1fr 200px;
}

.page-with-ads.has-both-ads {
    grid-template-columns: 200px 1fr 200px;
}

.ads-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 88px;
    align-content: start;
}

.page-main-col {
    min-width: 0;
}

.listing-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.listing-grid .card,
.listing-grid .listing-card {
    min-width: 0;
}

.featured-grid .card {
    border: 2px solid var(--red-600);
}

.card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    width: 100%;
    max-width: 220px;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.card-img-link {
    display: block;
    position: relative;
    text-decoration: none;
    overflow: hidden;
    flex-shrink: 0;
}

.card-img-wrap {
    width: 100%;
    aspect-ratio: 3 / 2;
    max-height: 110px;
    overflow: hidden;
    background: #f0e8e8;
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    max-height: 110px;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.card-img-link:hover .card-img-wrap img {
    transform: scale(1.04);
}

.card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(146, 21, 21, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.3px;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(2px);
}

.ad-card {
    border-left: 4px solid var(--red-600);
}

.floating-ads {
    display: none;
}

.ad-slot-item {
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f4;
    border: 2px solid #e0e0e0;
    min-height: 160px;
}

.ad-slot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-slot-link {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 160px;
    text-decoration: none;
    color: inherit;
}

.ad-slot-fallback {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 160px;
    padding: 12px;
    text-align: center;
    gap: 6px;
}

.ad-slot-fallback h3,
.ad-slot-fallback p {
    margin: 0;
}

.listing-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.listing-gallery-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.image-preview-grid img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.card-body {
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card h3 {
    font-size: 11px;
    font-weight: 600;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    color: var(--text);
    min-height: calc(11px * 1.3 * 2);
}

.price {
    color: var(--red-800);
    font-weight: 800;
    font-size: 13px;
    margin: 2px 0;
}

.price.large {
    font-size: 28px;
}

.card-meta {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    font-size: 9px;
    color: #777;
    margin-top: auto;
    padding-top: 3px;
}

.card-meta span:not(:last-child)::after {
    content: '·';
    margin-left: 4px;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.detail-image {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    min-width: 120px;
    padding: 6px 8px;
}

.text-btn {
    border: 0;
    background: transparent;
    color: var(--red-700);
    cursor: pointer;
    font-weight: 700;
}

.text-btn.ok {
    color: var(--success);
}

.text-btn.warn {
    color: #b38300;
}

.text-btn.danger {
    color: var(--danger);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.admin-stats article {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
}

.admin-stats p {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 94px;
    background: #171717;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 14px;
    display: grid;
    gap: 8px;
}

.admin-sidebar h2 {
    margin: 0 0 4px;
    color: #f1dada;
    font-size: 18px;
}

.admin-nav-btn {
    text-align: left;
    border: 1px solid #3a3a3a;
    background: #222;
    color: #f4ecec;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.admin-nav-btn.active {
    background: linear-gradient(135deg, var(--red-600), var(--red-800));
    border-color: transparent;
}

.admin-content {
    min-width: 0;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.alert {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 10px;
}

.alert.success {
    background: #e8fbf1;
    border: 1px solid #b6ebcf;
}

.alert.error {
    background: #ffeded;
    border: 1px solid #ffc6c6;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: #f5eeee;
}

.footer-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.empty {
    margin-top: 12px;
    color: #8a6464;
}

@media (max-width: 960px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .main-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    .nav-wrap {
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        padding: 10px 0;
    }

    .main-nav {
        justify-content: center;
    }

    .footer-wrap {
        flex-direction: column;
        justify-content: center;
        padding: 10px 0;
    }

    table {
        min-width: 560px;
    }
}

@media (max-width: 1100px) {
    .page-with-ads {
        grid-template-columns: 1fr !important;
    }
    .ads-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        display: flex !important;
    }
    .ad-slot-item {
        width: 180px;
        min-height: 130px;
    }
    .ads-sidebar.ads-left {
        order: -1;
    }
    .ads-sidebar.ads-right {
        order: 1;
    }
    .page-main-col {
        order: 0;
    }
    .listing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }
}

@media (max-width: 600px) {
    .ads-sidebar {
        display: none !important;
    }
    .listing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }
    .listing-grid .card,
    .listing-grid .listing-card {
        min-width: 0;
        margin: 0;
    }
    .card-body,
    .listing-card-content {
        padding: 8px;
    }
    .card h3,
    .card-title,
    .listing-card-title {
        font-size: 12px;
        min-height: calc(12px * 1.4 * 2);
    }
    .price,
    .listing-card-price {
        font-size: 15px;
    }
    .card-meta,
    .listing-card-meta {
        font-size: 11px;
    }
}

/* ─── Catalog listing-card — mirrors .card design ─── */
.listing-card {
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}

.listing-card:hover {
    box-shadow: 0 4px 16px rgba(100, 10, 10, 0.12);
}

.listing-card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #f0e8e8;
    flex-shrink: 0;
}

.listing-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.listing-card:hover .listing-card-image {
    transform: scale(1.04);
}

.listing-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(146, 21, 21, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.3px;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(2px);
}

.listing-card-content {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.listing-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    color: var(--text);
    min-height: calc(14px * 1.4 * 2);
}

.listing-card-price {
    color: var(--red-800);
    font-weight: 800;
    font-size: 18px;
    margin: 4px 0;
}

.listing-card-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #777;
    margin-top: auto;
    padding-top: 6px;
}

.listing-card-meta span:not(:last-child)::after {
    content: '·';
    margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   OTP DOĞRULAMA SƏHİFƏSİ
   ═══════════════════════════════════════════════════════════════════════════ */

.otp-card {
    max-width: 480px;
    margin: 40px auto;
    text-align: center;
}

.otp-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.otp-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    color: var(--red-700);
}

.otp-hint {
    color: #555;
    font-size: 15px;
    margin: 0 0 28px;
    line-height: 1.6;
}

.otp-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.otp-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--light);
    color: var(--dark-800);
    transition: border-color 0.2s;
    padding: 0;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--red-500);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(204, 42, 42, 0.15);
}

.otp-submit {
    width: 100%;
    max-width: 260px;
    padding: 12px;
    font-size: 16px;
}

.otp-footer {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.otp-timer {
    margin: 0;
    font-size: 14px;
    color: #777;
}

.otp-countdown {
    font-weight: 700;
    color: var(--red-600);
}

.otp-resend-btn {
    background: none;
    border: none;
    color: var(--red-600);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.otp-resend-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN — MAİL ŞABLONLARI TAB
   ═══════════════════════════════════════════════════════════════════════════ */

.admin-section-desc {
    color: #555;
    font-size: 14px;
    margin: -6px 0 18px;
    line-height: 1.6;
}

.mail-template-card {
    margin-bottom: 24px;
}

.mail-template-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.mail-template-head strong {
    font-size: 16px;
    color: var(--dark-800);
}

.mail-template-key {
    display: inline-block;
    margin-left: 10px;
    background: var(--light);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-family: monospace;
    color: var(--red-700);
}

.mail-template-desc {
    color: #888;
    font-size: 12px;
    max-width: 420px;
    text-align: right;
}

.mail-template-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mail-template-editor {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.mail-template-actions {
    display: flex;
    justify-content: flex-end;
}

.mail-test-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.mail-test-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mail-test-row input[type="email"] {
    flex: 1;
}

@media (max-width: 600px) {
    .otp-digit {
        width: 42px;
        height: 52px;
        font-size: 22px;
    }

    .mail-test-row {
        flex-direction: column;
        align-items: stretch;
    }

    .mail-template-head {
        flex-direction: column;
    }

    .mail-template-desc {
        text-align: left;
    }
}
