/* Tối ưu trải nghiệm Mobile */
body {
    background-color: #f8fafc;
    color: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    touch-action: manipulation;
    /* Ngăn zoom */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* Tránh bôi đen văn bản khi bấm nhanh */
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Ô nhập liệu dạng DIV */
.grid-cell {
    width: 100%;
    height: 44px;
    /* Đã làm gọn chiều cao ô */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    cursor: pointer;
}

/* Hiện chữ "Bao 1", "Bao 2"... cực kỳ rõ ràng */
.grid-cell:empty {
    background-color: #f8fafc;
    border: 1.5px dashed #cbd5e1;
}

.grid-cell:empty::after {
    content: "Bao số " attr(data-index);
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Ô đang được chọn (Active) */
.cell-active {
    border-color: #3b82f6 !important;
    border-style: solid !important;
    background-color: #eff6ff !important;
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    position: relative;
    color: #2563eb;
}

.cell-active:empty::after {
    content: " ";
}

/* Box Giá & Trừ bao lúa khi được chọn */
.field-active {
    border-color: #2563eb !important;
    background-color: #f8faff !important;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15) !important;
    z-index: 20;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.btn-press:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Bàn phím số phong cách Native App */
.numpad-btn {
    height: 48px;
    border-radius: 10px;
    font-size: 1.35rem;
    font-weight: 600;
    background-color: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.05s;
}

.numpad-btn:active {
    background-color: #e2e8f0;
    transform: scale(0.95);
}

.numpad-del {
    background-color: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

.numpad-del:active {
    background-color: #fee2e2;
}

.numpad-next {
    background-color: #3b82f6;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.numpad-next:active {
    background-color: #1d4ed8;
}

/* Hiệu ứng ẩn hiện bàn phím */
.keyboard-wrapper {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease-in-out, margin-top 0.3s ease-in-out;
    overflow: hidden;
}

.keyboard-open {
    max-height: 230px;
    opacity: 1;
    margin-top: 0.5rem;
}

.keyboard-closed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* Home UI Enhancements */
.nav-item.active div {
    background-color: #eff6ff;
    color: #2563eb;
    transform: translateY(-2px);
}

.nav-item.active span {
    color: #2563eb;
}

.trip-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.trip-card:active {
    transform: scale(0.97) translateY(2px);
}

.trip-card .icon-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

#view-home {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Settings Enhancements */
#modal-settings-content button:active {
    transform: scale(0.95);
}

#modal-settings-content input:focus {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.settings-group-title {
    position: relative;
    padding-left: 12px;
}

.settings-group-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 12px;
    background-color: #3b82f6;
    border-radius: 2px;
}