body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

main {
    flex: 1;
}

body.has-mobile-nav main {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.card {
    transition: box-shadow 0.2s ease;
}

@media (hover: hover) {
    .card:hover {
        box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    }
}

.status-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.qr-code-img {
    max-width: 200px;
    height: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background: white;
}

.equipment-detail-header {
    border-left: 4px solid #0d6efd;
    padding-left: 1rem;
}

.stat-card {
    border-left: 4px solid;
}

.stat-card.available { border-left-color: #198754; }
.stat-card.checked-out { border-left-color: #ffc107; }
.stat-card.maintenance { border-left-color: #dc3545; }
.stat-card.total { border-left-color: #0d6efd; }

.table th {
    white-space: nowrap;
}

#qr-reader {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

#qr-reader video {
    border-radius: 0.375rem;
    width: 100% !important;
    max-height: 60vh;
    object-fit: cover;
}

.login-container {
    max-width: 420px;
    margin: 2rem auto;
}

.brand-header {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-header i {
    font-size: 3rem;
    color: #0d6efd;
}

/* Touch-friendly controls */
.touch-action-btn,
.btn-mobile-lg {
    min-height: 3rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    font-size: 1.05rem;
}

.btn-mobile-back {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-title {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    line-height: 1.2;
}

.page-header {
    gap: 0.5rem;
}

.min-w-0 {
    min-width: 0;
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    background: #212529;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav .nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 3.75rem;
    padding: 0.5rem 0.25rem;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
    text-decoration: none;
    text-align: center;
}

.mobile-bottom-nav .nav-link i {
    font-size: 1.35rem;
}

.mobile-bottom-nav .nav-link.active,
.mobile-bottom-nav .nav-link:focus,
.mobile-bottom-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.mobile-bottom-nav .nav-link.nav-link-primary {
    color: #6ea8fe;
}

.mobile-bottom-nav .nav-link.nav-link-primary.active {
    color: #9ec5fe;
}

/* Mobile meta lists */
.mobile-meta {
    margin: 0;
}

.mobile-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

.mobile-meta-row:last-child {
    border-bottom: 0;
}

.mobile-meta-row dt {
    color: #6c757d;
    font-weight: 500;
    margin: 0;
}

.mobile-meta-row dd {
    margin: 0;
    text-align: right;
}

.mobile-action-card .card-body {
    padding: 1rem;
}

/* Check-in photo capture */
.photo-capture {
    border: 2px dashed #ced4da;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
}

.photo-capture-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.photo-capture-trigger {
    min-height: 4.5rem;
    border-width: 2px;
    border-style: dashed;
}

.photo-preview-img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #000;
}

.photo-capture-shake {
    animation: photo-shake 0.45s ease;
}

@keyframes photo-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.checkin-form .form-select,
.checkin-form .form-control {
    min-height: 3rem;
    font-size: 1rem;
}

.checkin-form textarea.form-control {
    min-height: 5rem;
}

.sticky-mobile-submit {
    position: sticky;
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 10;
    background: linear-gradient(to top, #fff 75%, rgba(255, 255, 255, 0));
    margin: 0 -1rem -1rem;
    padding: 1rem;
}

/* Equipment detail sticky action */
.mobile-sticky-action {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 1025;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.08);
}

body:not(.has-mobile-nav) .mobile-sticky-action {
    bottom: env(safe-area-inset-bottom, 0px);
}

body:not(.has-mobile-nav) .sticky-mobile-submit {
    bottom: env(safe-area-inset-bottom, 0px);
}

/* Quick action chips on dashboard */
.mobile-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.mobile-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 5.5rem;
    padding: 1rem 0.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    gap: 0.35rem;
}

.mobile-quick-action i {
    font-size: 1.75rem;
}

.mobile-quick-action-scan {
    background: #0d6efd;
    color: #fff;
}

.mobile-quick-action-checkin {
    background: #198754;
    color: #fff;
}

.mobile-quick-action-equipment {
    background: #e7f1ff;
    color: #0d6efd;
}

.mobile-quick-action-out {
    background: #fff3cd;
    color: #664d03;
}

/* Scan result actions stack on narrow screens */
.scan-result-actions .btn {
    min-height: 3rem;
}

@media (max-width: 575.98px) {
    .scan-result-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .scan-result-actions .btn {
        width: 100%;
        margin: 0 !important;
    }

    .manual-lookup-group {
        flex-direction: column;
    }

    .manual-lookup-group .btn {
        width: 100%;
        min-height: 3rem;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .desktop-only-table {
        display: none !important;
    }

    .pb-mobile-action {
        padding-bottom: 5rem;
    }

    footer {
        margin-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
    }

    .dashboard-welcome {
        display: none;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        width: 100%;
        min-height: 3rem;
    }

    .header-stack-sm {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: none;
    }
}
