/**
 * Odera ERP — responsive UI layer (menü, modül hub, tablolar, formlar)
 * Mobil ≤992px | Tablet ≤768px | Dar telefon ≤576px
 */

/* —— Mobil nav select (modül çubuğu + hub) —— */
.od-module-mobile-wrap,
.od-hub-nav-mobile-wrap {
    display: none;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.od-module-mobile-label,
.od-hub-nav-mobile-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--od-text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.od-module-mobile,
.od-hub-nav-mobile {
    width: 100%;
    min-height: 46px;
    padding: 0.6rem 0.9rem;
    color: var(--od-text);
    background: var(--od-surface-soft);
    border: 1px solid var(--od-border);
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: none;
    appearance: auto;
}

.od-module-mobile:focus,
.od-hub-nav-mobile:focus {
    border-color: color-mix(in srgb, var(--od-primary) 45%, var(--od-border));
    box-shadow: 0 0 0 3px var(--od-primary-soft);
}

/* —— Hub layout genel —— */
.od-fin-layout,
.od-knt-hub .row,
.od-belge-hub,
.od-personel-hub,
.od-rap-hub {
    min-width: 0;
}

.od-fin-sidebar,
.od-fin-content,
.od-knt-sidebar {
    min-width: 0;
}

/* —— Tablolar: yatay kaydırma ipucu —— */
.od-table-scroll-hint {
    display: none;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.75rem;
    color: var(--od-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--od-surface-soft);
    border: 1px dashed var(--od-border);
    border-radius: 10px;
}

.od-table-scroll-hint i {
    margin-right: 0.35rem;
    opacity: 0.7;
}

/* —— Filtre / form satırları —— */
.od-filter-row .col-md-auto,
.od-filter-row .col-lg-auto {
    min-width: 0;
}

/* —— Modal tam genişlik mobil —— */
@media (max-width: 992px) {
    .od-module-mobile-wrap,
    .od-hub-nav-mobile-wrap {
        display: block;
    }

    .od-module-links.od-module-links--enhanced,
    nav.od-hub-nav-enhanced,
    .od-fin-nav.od-hub-nav-enhanced,
    .od-knt-nav.od-hub-nav-enhanced,
    .od-hak-nav.od-hub-nav-enhanced,
    .od-filo-nav.od-hub-nav-enhanced,
    .nav-pills.od-pills-mobile-enhanced {
        display: none !important;
    }

    .od-module-bar {
        gap: 0.65rem;
    }

    .od-table-scroll-hint {
        display: block;
    }

    .od-page-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .od-page-actions .btn-group {
        width: 100%;
        display: flex;
    }

    .od-page-actions .btn-group .btn {
        flex: 1 1 auto;
    }

    /* Hub KPI — 2 sütun tablet */
    .od-hub-kpi-grid > [class*="col-md-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .od-fin-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .od-fin-layout {
        grid-template-columns: 1fr !important;
        gap: 0.85rem;
    }

    .od-fin-sidebar {
        position: static !important;
    }

    /* DataTables üst araç çubuğu */
    .dataTables_wrapper .row:first-child {
        flex-direction: column;
        gap: 0.5rem;
    }

    .dataTables_length,
    .dataTables_filter {
        width: 100% !important;
        text-align: left !important;
    }

    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        min-height: 44px;
    }

    /* Select2 mobil */
    .select2-container {
        width: 100% !important;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .od-hub-kpi-grid > [class*="col-md-3"],
    .od-hub-kpi-grid > [class*="col-sm-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .od-fin-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* Genel tablolar — kart görünümü */
    .table.od-mobile-stack thead,
    .table-responsive .table.od-mobile-stack thead {
        display: none;
    }

    .table.od-mobile-stack,
    .table.od-mobile-stack tbody,
    .table.od-mobile-stack tr,
    .table.od-mobile-stack td {
        display: block;
        width: 100%;
    }

    .table.od-mobile-stack tbody tr {
        margin: 0 0 0.75rem;
        padding: 0;
        background: var(--od-surface);
        border: 1px solid var(--od-border);
        border-radius: var(--od-radius-md);
        box-shadow: var(--od-shadow-xs);
    }

    .table.od-mobile-stack td {
        display: flex !important;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 40px;
        padding: 0.55rem 0.85rem !important;
        text-align: right;
        border-bottom: 1px solid var(--od-border) !important;
    }

    .table.od-mobile-stack td::before {
        flex: 0 0 42%;
        max-width: 48%;
        color: var(--od-text-muted);
        content: attr(data-label);
        font-size: 0.66rem;
        font-weight: 900;
        letter-spacing: 0.06em;
        text-align: left;
        text-transform: uppercase;
    }

    .table.od-mobile-stack td:empty {
        display: none !important;
    }

    .table.od-mobile-stack td[data-label=""]::before,
    .table.od-mobile-stack td:not([data-label])::before {
        content: none;
    }

    /* İki sütunlu form satırları tek sütun */
    .row.g-2 > [class*="col-md-"],
    .row.g-3 > [class*="col-md-"],
    .row.g-4 > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .od-stat-value {
        font-size: clamp(1.35rem, 5vw, 1.75rem);
    }

    .dropdown-menu {
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 576px) {
    /* Modül çubuğu: yatay linkler gizli — select kullanılır */
    .od-module-links.od-module-links--enhanced {
        display: none !important;
    }

    .od-module-links:not(.od-module-links--enhanced) a span {
        display: inline;
    }

    .od-command-modal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .od-settings-quick-grid {
        grid-template-columns: 1fr !important;
    }

    .btn-group.w-100 {
        flex-direction: column;
    }

    .btn-group.w-100 > .btn {
        border-radius: var(--od-radius-sm) !important;
        width: 100%;
    }
}

@media (min-width: 993px) {
    .od-module-mobile-wrap,
    .od-hub-nav-mobile-wrap {
        display: none !important;
    }
}

/* Dokunmatik kaydırma */
.od-module-links,
.od-settings-nav,
.od-settings-hub-links,
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--od-primary) 35%, transparent) transparent;
}

.od-module-links::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    height: 5px;
}

.od-module-links::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--od-primary) 40%, transparent);
    border-radius: 999px;
}
