/**
 * Global responsive layer — Bootstrap 4 + Elisyam üzerine, tüm sayfalar.
 * Yeni kurallar mümkün olduğunca burada toplanır.
 */

/* ——— Shell & overflow ——— */
.content-inner,
.content-inner .container-fluid,
.page-content {
    max-width: 100%;
}

@media (max-width: 1199.98px) {
    .content-inner.compact {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .content-inner .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .content-inner.compact {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }
}

/* col-xl-* only (no sm/md/lg/12): below xl stack full width */
@media (max-width: 1199.98px) {
    .row > [class*="col-xl-"]:not([class*="col-lg-"]):not([class*="col-md-"]):not([class*="col-sm-"]):not([class*="col-12"]) {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

img,
video,
svg:not(.loader-logo) {
    max-width: 100%;
    height: auto;
}

iframe,
embed,
object {
    max-width: 100%;
}

/* ——— Page toolbar ——— */
@media (max-width: 767.98px) {
    /* Mobilde de tek satır: solda geri ikonu, ortada başlık, sağda aksiyon butonu.
       Önceki kurallar toolbar'ı satır satır sarıp butonu ortalıyor, mutlak konumlu
       başlık da üstüne biniyordu. Burada start/end eşit esner, başlık akışta gerçek
       ortalanır (mutlak konum kaldırılır) ve çakışma olmaz. */
    .page-toolbar {
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .page-toolbar__start,
    .page-toolbar__end {
        flex: 1 1 0;
        min-width: 0;
    }

    .page-toolbar__end {
        justify-content: flex-end;
    }

    .page-toolbar__center {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        flex: 0 1 auto;
        width: auto;
        max-width: 100%;
    }

    .page-toolbar__title {
        font-size: 1rem;
        line-height: 1.35;
    }

    .page-toolbar__actions {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .page-toolbar__actions .btn {
        margin-bottom: 0;
        white-space: nowrap;
    }
}

/* ——— Widgets & cards ——— */
@media (max-width: 767.98px) {
    .widget-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .widget-header h2,
    .widget-header h4 {
        font-size: 1rem;
        line-height: 1.35;
    }

    .has-shadow {
        border-radius: 0.5rem;
    }
}

/* ——— Modals ——— */
.modal .modal-header .close,
.modal .close.crm-modal-close {
    opacity: 1 !important;
    color: #334155 !important;
    font-weight: 700;
    line-height: 1;
    padding: 0.25rem 0.45rem;
    margin: -0.25rem -0.15rem -0.25rem auto;
    text-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal .close.crm-modal-close .la-times {
    font-size: 1.4rem;
    line-height: 1;
}

.modal .modal-header.crm-modal-header-bar {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    padding: 0.5rem 0.75rem;
    min-height: 2.75rem;
}

.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
}

@media (max-width: 991.98px) {
    .modal-dialog {
        margin: 0.5rem auto;
        max-width: calc(100vw - 1rem);
    }

    .modal-lg,
    .modal-xl {
        max-width: calc(100vw - 1rem);
    }

    .modal-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.35rem auto;
        max-width: calc(100vw - 0.7rem);
    }

    .modal .modal-header .close,
    .modal .close.crm-modal-close {
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        margin-right: -0.15rem;
    }

    .modal .close.crm-modal-close .la-times {
        font-size: 1.65rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0.2rem 0 !important;
    }

    .modal-footer.justify-content-between {
        justify-content: center !important;
    }
}

/* Hizmet sihirbazı modalı */
@media (max-width: 767.98px) {
    #modal-service .modal-dialog {
        max-width: 100%;
        margin: 0;
        min-height: 100%;
    }

    #modal-service .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    #modal-service #rootwizard .step-wizard {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
}

/* ——— DataTables ——— */
.crm-dt-responsive,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.dataTables_wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    div.dataTables_wrapper div.dataTables_filter,
    div.dataTables_wrapper div.dataTables_length {
        text-align: left;
        float: none;
    }

    div.dataTables_wrapper div.dataTables_filter input,
    div.dataTables_wrapper div.dataTables_filter label {
        width: 100%;
        max-width: 100%;
    }

    div.dataTables_wrapper div.dataTables_filter input {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    div.dataTables_wrapper > .row:first-child > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .dataTables_wrapper .datatable-toolbar-row,
    .dataTables_wrapper .datatable-toolbar-filters-row,
    .dataTables_wrapper .datatable-toolbar-controls-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        float: none;
        width: 100%;
        margin-top: 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    table.dataTable thead th,
    table.dataTable tbody td {
        font-size: 0.8125rem;
        padding: 0.45rem 0.35rem;
        white-space: nowrap;
    }
}

/* Widget içi tablolar (DataTables öncesi) */
.widget-body--approaching-dt,
.widget-body.widget-scroll,
.definitions-user-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.dash-summary-card .widget-body,
.dash-summary-feed {
    overflow: visible;
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .definitions-user-scroll {
        max-height: none !important;
    }
}

/* ——— Liste filtreleri ——— */
@media (max-width: 767.98px) {
    .list-page-filters .form-group {
        margin-bottom: 0.5rem;
    }

    .list-page-filters [class*="col-md-"],
    .list-page-filters [class*="col-lg-"],
    .list-page-filters [class*="col-xl-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

}

/* ——— Formlar ——— */
@media (max-width: 575.98px) {
    .form-row > [class*="col-"] {
        margin-bottom: 0.25rem;
    }

    .customer-form-page__footer .btn,
    .svc-detail__actions .btn {
        width: 100%;
        margin-bottom: 0.35rem;
    }

    .input-group-append,
    .input-group-prepend {
        flex-wrap: wrap;
    }
}

/* ——— Dashboard ——— */
@media (max-width: 767.98px) {
    .dash-home__hero .dash-home__col,
    .dash-home__body [class*="col-"] {
        margin-bottom: 0.75rem;
    }

    .dash-home {
        margin-top: 0;
    }

    /* Üst bar: build no gizle, avatar sıkışmasın */
    .header .nav-item.dropdown .text-muted {
        display: none !important;
    }

    .header .navbar-brand .logo-big,
    .header .navbar-brand .logo-small {
        max-height: 1.65rem;
        width: auto;
    }

    /* Profil istatistikleri: 3 eşit sütun (2+1 kırılmasın) */
    .dash-profile-spotlight__stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 0.55rem 0.65rem 0.85rem;
    }

    .dash-profile-spotlight__stat {
        flex: none;
        min-width: 0;
        width: auto;
        padding: 0.55rem 0.25rem 0.5rem;
    }

    .dash-profile-spotlight__stat-icon {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }

    .dash-profile-spotlight__stat-value {
        font-size: 0.95rem;
    }

    .dash-profile-spotlight__stat-label {
        font-size: 0.58rem;
        letter-spacing: 0.02em;
        line-height: 1.2;
    }

    .dash-profile-spotlight__name {
        font-size: 1.05rem;
    }

    .dash-quick-actions-item--jumbo {
        padding: 0.85rem 0.9rem;
    }

    .prospect-cards {
        grid-template-columns: 1fr;
    }

    .prospect-view-toggle {
        width: 100%;
        display: flex;
    }

    .prospect-view-toggle .btn {
        flex: 1 1 50%;
    }
}

@media (max-width: 380px) {
    .dash-profile-spotlight__stats {
        grid-template-columns: 1fr;
    }

    .dash-profile-spotlight__stat {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.65rem;
        text-align: left;
        padding: 0.65rem 0.75rem;
    }

    .dash-profile-spotlight__stat-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .dash-profile-spotlight__stat-value,
    .dash-profile-spotlight__stat-label {
        text-align: left;
    }
}

/* ——— Tanımlar / profil ——— */
@media (max-width: 991.98px) {
    #definition-spa-pane .table-responsive,
    #definition-spa-pane .definition-content-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

/* ——— Müşteri detay / hizmet ——— */
.customer-panel__table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

@media (max-width: 991.98px) {
    .svc-detail__layout > [class*="col-"] {
        margin-bottom: 1rem;
    }

    .customer-detail__hero-actions {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
}

/* ——— Raporlar ——— */
@media (max-width: 991.98px) {
    .report-chart-wrap,
    .report-chart-wrap canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ——— Auth (giriş / şifre sıfırlama) ——— */
@media (max-width: 991.98px) {
    body.auth-page .auth-page__shell {
        height: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
    }

    body.auth-page .auth-page__layout {
        flex-direction: column-reverse !important;
        height: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
    }

    body.auth-page .auth-page__form-col {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        flex: 0 0 auto;
        order: 1;
    }

    body.auth-page .auth-page__visual {
        flex: 0 0 auto;
        order: 2;
    }

    body.auth-page .auth-page__visual .elisyam-bg {
        height: 32vh;
        min-height: 10rem;
        max-height: 16rem;
    }

    body.auth-page .auth-page__form-col .authentication-form {
        width: 100%;
        max-width: 22rem;
        padding: 1.25rem 1.25rem 1.75rem;
        margin-left: auto;
        margin-right: auto;
    }

    body.auth-page .auth-page__form-col .logo-centered {
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    body.auth-page .authentication-form .form-group,
    body.auth-page .authentication-form .btn {
        width: 100%;
    }

    body.auth-page .auth-page__form-col .authentication-form {
        padding: 1rem 1rem 1.5rem;
    }
}

/* ——— Go top / footer ——— */
@media (max-width: 575.98px) {
    .go-top {
        right: 0.65rem;
        bottom: 3.5rem;
        width: 2.25rem;
        height: 2.25rem;
    }
}

/* Touch: daha geniş tıklama alanı */
@media (hover: none) and (pointer: coarse) {
    .td-actions a,
    .def-td-action,
    .page-toolbar__back {
        min-width: 2.25rem;
        min-height: 2.25rem;
    }
}

