html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ===== الحاوية والاتجاه ===== */
#dynamic-table_wrapper {
    direction: ltr;
}

    #dynamic-table_wrapper table {
        direction: rtl;
    }

/* ===== تصغير وتجميل الجدول ===== */
#dynamic-table {
    font-size: 0.82rem;
    border-collapse: separate;
    border-spacing: 0;
}

    #dynamic-table thead th {
        background: linear-gradient(180deg, #1e4d8b 0%, #163d6f 100%);
        color: #fff;
        font-weight: 600;
        font-size: 0.78rem;
        white-space: nowrap;
        vertical-align: middle;
        border-color: #16365c !important;
        padding: 0.5rem 0.4rem;
    }

    /* صف فلاتر البحث */
    #dynamic-table thead tr:nth-child(2) th {
        background: #eef3f9;
        padding: 0.3rem;
    }

    #dynamic-table thead tr:nth-child(2) input {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    #dynamic-table tbody td {
        vertical-align: middle;
        padding: 0.35rem 0.4rem;
        white-space: nowrap;
    }

    /* تأثير hover ناعم على الصفوف */
    #dynamic-table tbody tr {
        transition: background-color 0.15s ease;
    }

        #dynamic-table tbody tr:hover {
            background-color: #f1f7ff !important;
        }

    /* ===== تصغير عناصر الإدخال ===== */
    #dynamic-table .form-control-sm,
    #dynamic-table .form-select-sm {
        font-size: 0.78rem;
        padding: 0.2rem 0.45rem;
        min-height: calc(1.4em + 0.4rem);
    }

    /* عرض موحّد ومنطقي للحقول */
    #dynamic-table .leave-input,
    #dynamic-table .overtime-before-input,
    #dynamic-table .overtime-after-input {
        width: 70px;
    }

    #dynamic-table .phone-input {
        min-width: 110px;
    }

    #dynamic-table .branch-select,
    #dynamic-table .dept-select,
    #dynamic-table .section-select,
    #dynamic-table .role-select {
        min-width: 120px;
    }

    /* ===== الأزرار أصغر وأنعم ===== */
    #dynamic-table .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }

/* ===== Scroll أفقي ناعم للموبايل والشاشات الصغيرة ===== */
.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
    /* شريط تمرير أنحف وأجمل */
    .table-scroll-wrap::-webkit-scrollbar {
        height: 8px;
    }

    .table-scroll-wrap::-webkit-scrollbar-thumb {
        background: #b8c4d4;
        border-radius: 8px;
    }

    .table-scroll-wrap::-webkit-scrollbar-track {
        background: #f0f0f0;
    }

/* ===== تجميد عمود الاسم (أول عمود) ===== */
#dynamic-table thead th:first-child,
#dynamic-table tbody td:first-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: -2px 0 4px rgba(0,0,0,0.04);
}

#dynamic-table thead th:first-child {
    z-index: 3;
    background: #1b478099;
    background: linear-gradient(180deg, #1e4d8b 0%, #163d6f 100%);
}

#dynamic-table thead tr:nth-child(2) th:first-child {
    background: #eef3f9;
}

#dynamic-table tbody tr:hover td:first-child {
    background: #f1f7ff;
}

/* ===== تحسينات للموبايل ===== */
@media (max-width: 768px) {
    #dynamic-table {
        font-size: 0.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .scroll-hint {
        display: block;
        font-size: 0.75rem;
        color: #6c757d;
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

@media (min-width: 769px) {
    .scroll-hint {
        display: none;
    }
}
