﻿/* ==========================================================
   Save Melk Page
   ----------------------------------------------------------
   استایل اصلی فرم ثبت ملک:
   ✔ چیدمان کلی صفحه
   ✔ فرم‌ها و Select2
   ✔ بخش‌های جزئیات ملک
   ✔ امکانات
   ✔ آپلود عکس
   ✔ نقشه
   ✔ Responsive
   ========================================================== */


/* ==========================================================
   1) Page Layout
   ----------------------------------------------------------
   بدنه اصلی صفحه، کارت فرم و هدر ثبت ملک
   ========================================================== */

.save-melk-page {
    padding: 28px 0 60px;
    background: #f5f7fb;
    direction: rtl;
}

.save-melk-card {
    max-width: 1180px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e5eaf2;
    border-radius: 18px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.save-melk-header {
    padding: 24px 30px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #ffffff;
}

    .save-melk-header h1 {
        font-size: 22px;
        margin: 0 0 6px;
        color: #ffffff;
    }

    .save-melk-header p {
        margin: 0;
        font-size: 14px;
        opacity: .9;
    }


/* ==========================================================
   2) Main Sections
   ----------------------------------------------------------
   بخش‌های اصلی فرم مثل اطلاعات مالک، جزئیات، عکس، نقشه و امکانات
   ========================================================== */

.save-section {
    padding: 24px 30px;
    border-bottom: 1px solid #eef2f7;
}

.save-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

    .save-section-title span {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: #2563eb;
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 700;
    }

    .save-section-title h2 {
        font-size: 17px;
        margin: 0;
        color: #0f172a;
    }

.save-section .row {
    row-gap: 4px;
}


/* ==========================================================
   3) Form Controls
   ----------------------------------------------------------
   استایل مشترک input، textarea، select و validation
   ========================================================== */

.save-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.save-section input[type="text"],
.save-section input[type="email"],
.save-section input[type="password"],
.save-section input[type="number"],
.save-section select,
.save-section textarea,
.save-section .form-control {
    width: 100%;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 9px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 13px !important;
    padding: 8px 12px !important;
    margin-bottom: 12px !important;
    box-shadow: none !important;
}

    .save-section textarea,
    .save-section textarea.form-control {
        height: auto !important;
        min-height: 95px !important;
        resize: vertical;
    }

        .save-section .form-control:focus,
        .save-section input:focus,
        .save-section textarea:focus,
        .save-section select:focus {
            border-color: #2563eb !important;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, .10) !important;
            outline: none !important;
        }

.text-danger {
    font-size: 12px;
    margin-top: -7px;
    margin-bottom: 9px;
    display: block;
}


/* ==========================================================
   4) Select2 Override
   ----------------------------------------------------------
   اصلاح ظاهر Select2 و جلوگیری از عرض ثابت 348px
   ========================================================== */

.save-section .select2-container {
    width: 100% !important;
    display: block !important;
    margin-bottom: 12px;
}

.save-section .select2-container--default .select2-selection--single {
    height: 42px !important;
    border-radius: 9px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
}

    .save-section .select2-container--default .select2-selection--single .select2-selection__rendered {
        height: 42px !important;
        padding-right: 12px !important;
        padding-left: 32px !important;
        text-align: right !important;
        color: #0f172a !important;
        font-size: 13px !important;
    }

    .save-section .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color: #64748b !important;
    }

    .save-section .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 42px !important;
        left: 8px !important;
        right: auto !important;
    }

.save-section .select2-dropdown {
    border-color: #cbd5e1 !important;
    border-radius: 10px !important;
}

.save-section .select2-results__option {
    font-size: 13px !important;
    padding: 8px 12px !important;
    text-align: right !important;
}

.save-section .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10) !important;
    outline: none !important;
}

.select2-search__field::placeholder {
    color: #5C727D !important;
}


/* ==========================================================
   5) Detail Sub Sections
   ----------------------------------------------------------
   کارت‌های داخلی جزئیات ملک مثل مشخصات اصلی، ساختمان، فروش و اجاره
   ========================================================== */

.melk-detail-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.melk-sub-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 18px 10px;
}

    .melk-sub-section h3 {
        font-size: 16px;
        font-weight: 800;
        color: #0f172a;
        margin: 0 0 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid #e5e7eb;
    }

.melk-section-divider {
    height: 1px;
    background: linear-gradient(to left, transparent, #cbd5e1, transparent);
    margin: 18px 0;
}

.price-word {
    min-height: 20px;
    color: #2563eb;
    font-size: 12px;
    margin-top: -6px;
    margin-bottom: 10px;
    font-weight: 600;
}

.d-none {
    display: none !important;
}


/* ==========================================================
   6) Features Grid
   ----------------------------------------------------------
   امکانات ملک مثل آسانسور، پارکینگ، انباری و...
   ========================================================== */

.features-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.feature-item {
    position: relative;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 11px 38px 10px 10px;
    background: #ffffff;
    cursor: pointer;
    color: #334155;
    font-size: 13px;
    transition: .2s ease;
    margin: 0;
}

    .feature-item input {
        display: none;
    }

    .feature-item span {
        position: absolute;
        right: 12px;
        top: 50%;
        width: 17px;
        height: 17px;
        border-radius: 5px;
        border: 2px solid #94a3b8;
        transform: translateY(-50%);
    }

    .feature-item input:checked + span {
        background: #2563eb;
        border-color: #2563eb;
    }

        .feature-item input:checked + span::after {
            content: "✓";
            color: #ffffff;
            font-size: 12px;
            position: absolute;
            top: -4px;
            right: 2px;
        }

    .feature-item:has(input:checked) {
        border-color: #2563eb;
        background: #eff6ff;
        color: #1d4ed8;
    }


/* ==========================================================
   7) Upload Section
   ----------------------------------------------------------
   آپلود عکس اصلی و گالری تصاویر ملک
   ========================================================== */

.save-upload-area {
    row-gap: 20px;
}

.save-upload-box {
    height: 100%;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    padding: 22px;
    transition: .2s ease;
}

    .save-upload-box:hover {
        border-color: #2563eb;
        background: #eff6ff;
    }

.save-upload-content {
    text-align: center;
}

.save-upload-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: #dbeafe;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 24px;
}

.save-upload-content h3 {
    font-size: 17px;
    color: #0f172a;
    margin: 0 0 8px;
}

.save-upload-content p {
    font-size: 13px;
    line-height: 1.9;
    color: #64748b;
    margin: 0 0 18px;
}

.save-upload-input {
    display: none !important;
}

.save-upload-btn {
    min-width: 170px;
    height: 44px;
    border-radius: 12px;
    background: #2563eb;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    transition: .2s ease;
}

    .save-upload-btn:hover {
        background: #1d4ed8;
    }

.save-upload-preview {
    margin-top: 18px;
}

.save-upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.save-upload-item {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

    .save-upload-item img {
        width: 100%;
        height: 130px;
        object-fit: cover;
        display: block;
    }

.save-upload-item-main img {
    height: 230px;
}

.save-upload-remove {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 10px;
    background: rgba(15, 23, 42, .78);
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    line-height: 30px;
}

.save-upload-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}


/* ==========================================================
   8) Map Section
   ----------------------------------------------------------
   نقشه ثبت ملک:
   ✔ باکس اصلی نقشه
   ✔ توضیحات
   ✔ دکمه موقعیت فعلی
   ✔ نمایش مختصات انتخاب شده
   ========================================================== */

.save-map-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
}

.save-map-info {
    margin-bottom: 16px;
}

    .save-map-info h3 {
        font-size: 16px;
        font-weight: 800;
        color: #0f172a;
        margin: 0 0 8px;
    }

    .save-map-info p {
        font-size: 13px;
        color: #64748b;
        margin: 0;
        line-height: 1.9;
    }

.save-map-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
}

.save-map {
    width: 100%;
    height: 420px;
}

.save-map-locate {
    position: absolute;
    top: 10px;
    left: 50px;
    z-index: 1001;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .save-map-locate img {
        width: 18px;
        height: 18px;
    }

.save-map-selected {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

    .save-map-selected div {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px 14px;
    }

    .save-map-selected span {
        display: block;
        color: #64748b;
        font-size: 12px;
        margin-bottom: 5px;
    }

    .save-map-selected strong {
        color: #0f172a;
        font-size: 13px;
        direction: ltr;
        display: block;
    }


/* ==========================================================
   9) Leaflet Controls
   ----------------------------------------------------------
   اصلاح ظاهر کنترل‌های نقشه Leaflet
   ========================================================== */

.save-map-wrapper .leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .15);
    overflow: hidden;
    border-radius: 12px;
}

    .save-map-wrapper .leaflet-control-zoom a {
        border: 0 !important;
        width: 34px !important;
        height: 34px !important;
        line-height: 34px !important;
    }


/* ==========================================================
   10) Leaflet Search
   ----------------------------------------------------------
   جستجوی آدرس روی نقشه:
   ✔ Override ظاهر پیش‌فرض پلاگین
   ✔ قرارگیری صحیح آیکون سرچ
   ✔ جلوگیری از شکستن layout در موبایل
   ========================================================== */

.save-map-wrapper .leaflet-top.leaflet-right {
    top: 14px !important;
    right: 14px !important;
    left: auto !important;
    width: calc(100% - 90px) !important;
    max-width: 620px;
    z-index: 1000;
}

.save-map-wrapper .geo-search.leaflet-control {
    width: 100% !important;
    height: 42px !important;
    margin: 0 !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    background: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .15);
    overflow: hidden;
}

.save-map-wrapper .geo-search input,
.save-map-wrapper input[type="text"][list="map_dl"] {
    width: 100% !important;
    max-width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 13px !important;
    padding: 8px 14px 8px 52px !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

    .save-map-wrapper .geo-search input:focus,
    .save-map-wrapper input[type="text"][list="map_dl"]:focus {
        border: 0 !important;
        box-shadow: none !important;
        outline: none !important;
    }

.save-map-wrapper .geo-search button {
    position: absolute !important;
    left: 6px !important;
    top: 6px !important;
    right: auto !important;
    width: 30px !important;
    height: 30px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    z-index: 2;
}

    .save-map-wrapper .geo-search button svg {
        width: 13px !important;
        height: 13px !important;
        fill: #ffffff !important;
    }

.save-map-wrapper .geo-search datalist {
    width: 100% !important;
}


/* ==========================================================
   11) Actions
   ----------------------------------------------------------
   دکمه ثبت نهایی و بخش خطاهای فرم
   ========================================================== */

.save-actions {
    padding: 24px 30px 30px;
}

.btn-save-melk {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

    .btn-save-melk:hover {
        box-shadow: 0 12px 24px rgba(34, 197, 94, .22);
    }

.validation-summary {
    margin-top: 16px;
}


/* ==========================================================
   12) Responsive
   ----------------------------------------------------------
   اصلاح ظاهر در تبلت و موبایل
   ========================================================== */

@media (max-width: 992px) {
    .save-melk-card {
        max-width: 100%;
    }

    .features-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .save-map {
        height: 330px;
    }

    .save-map-selected {
        grid-template-columns: 1fr;
    }

    .save-map-wrapper .leaflet-top.leaflet-right {
        width: calc(100% - 78px) !important;
        right: 12px !important;
        top: 12px !important;
    }

    .save-map-locate {
        top: 12px;
        left: 12px;
        width: 38px;
        height: 38px;
    }

    .save-map-wrapper .geo-search.leaflet-control {
        height: 38px !important;
        border-radius: 12px !important;
    }

    .save-map-wrapper .geo-search input,
    .save-map-wrapper input[type="text"][list="map_dl"] {
        height: 38px !important;
        min-height: 38px !important;
        padding-left: 48px !important;
    }

    .save-map-wrapper .geo-search button {
        width: 28px !important;
        height: 28px !important;
        top: 5px !important;
        left: 5px !important;
    }
}

@media (max-width: 576px) {
    .save-melk-page {
        padding: 16px 0 40px;
    }

    .save-melk-header,
    .save-section,
    .save-actions {
        padding: 20px 15px;
    }

    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .save-upload-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .save-upload-item img,
    .save-upload-item-main img {
        height: 150px;
    }
}

/* ==========================================================
   Melk Type Selection Page
   ----------------------------------------------------------
   صفحه انتخاب نوع ملک قبل از ورود به فرم ثبت ملک
   ========================================================== */

.melk-type-page {
    padding: 70px 0 90px;
    background: #f4f8fb;
    direction: rtl;
}

.melk-type-header {
    text-align: center;
    margin-bottom: 42px;
}

    .melk-type-header span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 110px;
        height: 32px;
        padding: 0 16px;
        border-radius: 999px;
        background: #fff0ed;
        color: #ff5a3c;
        font-size: 13px;
        font-weight: 800;
        margin-bottom: 14px;
    }

    .melk-type-header h1 {
        font-size: 30px;
        font-weight: 900;
        color: #071c1f;
        margin: 0 0 12px;
    }

    .melk-type-header p {
        font-size: 14px;
        color: #64748b;
        margin: 0;
    }

.melk-type-grid {
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

.melk-type-card {
    position: relative;
    min-height: 190px;
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 20px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .07);
    padding: 28px 18px 20px;
    text-align: center;
    text-decoration: none !important;
    overflow: hidden;
    transition: .25s ease;
}

    .melk-type-card::after {
        content: "";
        position: absolute;
        right: 20px;
        left: 20px;
        bottom: 0;
        height: 4px;
        border-radius: 999px 999px 0 0;
        background: #ff5a3c;
        transform: scaleX(0);
        transform-origin: center;
        transition: .25s ease;
    }

    .melk-type-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 24px 48px rgba(15, 23, 42, .11);
        border-color: rgba(255, 90, 60, .35);
    }

        .melk-type-card:hover::after {
            transform: scaleX(1);
        }

.melk-type-icon {
    width: 66px;
    height: 66px;
    margin: 0 auto 22px;
    border-radius: 20px;
    background: #fff3f0;
    color: #ff5a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
}

.melk-type-card h3 {
    font-size: 18px;
    font-weight: 900;
    color: #071c1f;
    margin: 0;
}

.melk-type-arrow {
    margin-top: 18px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    transition: .25s ease;
}

.melk-type-card:hover .melk-type-arrow {
    opacity: 1;
    transform: translateY(0);
}

.melk-type-arrow i {
    margin-right: 6px;
}

@media (max-width: 992px) {
    .melk-type-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .melk-type-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .melk-type-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .melk-type-grid {
        grid-template-columns: 1fr;
    }

    .melk-type-card {
        min-height: 160px;
    }
}