/* === Base === */
body { background-color: #f5f6fa; font-size: 14px; }
.navbar-brand { font-weight: bold; }
.card { box-shadow: 0 2px 4px rgba(0,0,0,0.08); }

/* === Bottom Navigation (mobile) === */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
    display: flex; justify-content: space-around; align-items: center;
    background: #fff; border-top: 1px solid #dee2e6;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center;
    color: #6c757d; text-decoration: none; font-size: 10px;
    padding: 2px 10px; border-radius: 8px; transition: all 0.15s;
    min-width: 56px;
}
.bottom-nav-item i { font-size: 1.35rem; margin-bottom: 1px; }
.bottom-nav-item:active, .bottom-nav-item.active { color: #0d6efd; background: #e7f1ff; }

body.has-bottom-nav { padding-bottom: 72px; }
@media (min-width: 992px) {
    .bottom-nav { display: none !important; }
    body.has-bottom-nav { padding-bottom: 0; }
}

/* === Tables === */
.table th { white-space: nowrap; font-size: 13px; }
.table td { font-size: 13px; vertical-align: middle; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* === Mobile typography === */
@media (max-width: 767px) {
    .table th, .table td { font-size: 12px; padding: 0.4rem 0.5rem; }
    .btn-sm { font-size: 13px; padding: 0.35rem 0.65rem; }
    .form-control, .form-select { font-size: 16px; }
    h4 { font-size: 1.2rem; }
    .container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* === Components === */
.badge { font-size: 12px; }
.breadcrumb { font-size: 13px; }
.modal-body label { font-size: 13px; font-weight: 500; }
.btn-sm { font-size: 12px; }

/* === Touch targets === */
a, button, .btn, .nav-link, .dropdown-item { -webkit-tap-highlight-color: transparent; }
/* === Mobile Touch Targets === */
@media (max-width: 767px) {
    .btn, .btn-sm { min-height: 40px; min-width: 40px; }
    .nav-link, .dropdown-item { padding: 10px 14px; font-size: 15px; }
    a.btn, button.btn { padding: 8px 14px; }
    .pagination .page-link { min-width: 38px; min-height: 38px; line-height: 38px; text-align: center; padding: 0; }
}

/* === Navbar brand truncation on mobile === */
@media (max-width: 480px) {
    .navbar-brand { font-size: 15px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* === Fullscreen modals on mobile === */
@media (max-width: 767px) {
    .modal-dialog:not(.modal-sm):not(.modal-lg) { max-width: 100%; margin: 0; }
    .modal-content { border-radius: 0; min-height: 100vh; }
    .modal-header { padding: 10px 14px; }
    .modal-body { padding: 12px; }
    .modal-footer { padding: 10px 14px; }
}

/* === Mobile card view for tables === */
@media (max-width: 575px) {
    .mobile-card-table thead { display: none; }
    .mobile-card-table tbody tr {
        display: block; margin-bottom: 12px;
        border: 1px solid #dee2e6; border-radius: 8px;
        padding: 10px; background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    .mobile-card-table tbody td {
        display: flex; justify-content: space-between;
        padding: 4px 6px; border: none;
        font-size: 13px;
    }
    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 600; color: #495057;
        min-width: 80px; margin-right: 8px;
    }
    .mobile-card-table tbody td:last-child { justify-content: flex-end; }
    .mobile-card-table tbody td .btn-sm { margin: 2px; }
}

/* === Safe area for bottom nav === */
@media (max-width: 991px) {
    body.has-bottom-nav .container-fluid { padding-bottom: 60px; }
}

/* === Input sizing for mobile === */
@media (max-width: 767px) {
    .form-control, .form-select { font-size: 16px !important; }
    input[type="date"].form-control { min-height: 42px; }
    textarea.form-control { font-size: 16px !important; }
}
