/* Mobile-specific styles for Salbar HIS */

/* Ensure touch targets are at least 44x44px (Apple HIG) */
@media (max-width: 768px) {
    a, button, .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Prevent text selection on touch */
    .btn, button {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #F4F3F8; /* Cultured */
    border-top: 1px solid #558C03; /* Avocado */
    z-index: 1000;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 4px rgba(85, 140, 3, 0.1);
}

.mobile-bottom-nav .nav-link {
    color: #6c757d;
    text-decoration: none;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    transition: color 0.3s ease;
}

.mobile-bottom-nav .nav-link:hover,
.mobile-bottom-nav .nav-link.active {
    color: #558C03; /* Avocado */
}

.mobile-bottom-nav .nav-link i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

/* Mobile-optimized cards */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-header h6 {
        font-size: 0.9rem;
    }
}

/* Mobile-optimized tables */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Stack table columns on very small screens */
    @media (max-width: 576px) {
        .table,
        .table thead,
        .table tbody,
        .table th,
        .table td,
        .table tr {
            display: block;
        }
        
        .table thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        .table tr {
            border: 1px solid #ccc;
            margin-bottom: 0.5rem;
            padding: 0.5rem;
            border-radius: 4px;
        }
        
        .table td {
            border: none;
            position: relative;
            padding-left: 50%;
            text-align: left;
        }
        
        .table td:before {
            content: attr(data-label) ": ";
            position: absolute;
            left: 6px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
            font-weight: bold;
        }
    }
}

/* Mobile-optimized forms */
@media (max-width: 768px) {
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-group .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Mobile-optimized modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
}

/* Mobile-optimized navigation */
@media (max-width: 768px) {
    .navbar-brand img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
    }
    
    .dropdown-menu {
        border: none;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
}

/* Mobile-optimized dashboard cards */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .stats-card .card-body {
        padding: 1rem;
    }
    
    .stats-card .h5 {
        font-size: 1.5rem;
    }
    
    .stats-card .text-xs {
        font-size: 0.7rem;
    }
}

/* Mobile-optimized charts */
@media (max-width: 768px) {
    .chart-area {
        height: 250px;
    }
    
    .card-body canvas {
        max-height: 250px;
    }
}

/* Mobile-optimized buttons */
@media (max-width: 768px) {
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
    
    .btn-group .btn {
        margin-right: 0.25rem;
    }
}

/* Mobile-optimized alerts */
@media (max-width: 768px) {
    .alert {
        font-size: 0.875rem;
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
}

/* Mobile-optimized pagination */
@media (max-width: 768px) {
    .pagination {
        justify-content: center;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Mobile-optimized search */
@media (max-width: 768px) {
    .search-form {
        margin-bottom: 1rem;
    }
    
    .search-form .form-control {
        margin-bottom: 0.5rem;
    }
    
    .search-form .btn {
        width: 100%;
    }
}

/* Mobile-optimized filters */
@media (max-width: 768px) {
    .filter-section {
        margin-bottom: 1rem;
    }
    
    .filter-section .form-group {
        margin-bottom: 0.75rem;
    }
    
    .filter-section .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Mobile-optimized timeline */
@media (max-width: 768px) {
    .timeline {
        padding-left: 20px;
    }
    
    .timeline-marker {
        left: -25px;
        width: 8px;
        height: 8px;
    }
    
    .timeline-content {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .timeline-title {
        font-size: 0.9rem;
    }
    
    .timeline-text {
        font-size: 0.8rem;
    }
}

/* Mobile-optimized quick actions */
@media (max-width: 768px) {
    .quick-actions .col-md-2 {
        margin-bottom: 1rem;
    }
    
    .quick-actions .btn {
        height: auto;
        padding: 1rem 0.5rem;
    }
    
    .quick-actions .btn i {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Mobile-optimized notifications */
@media (max-width: 768px) {
    .notification-item {
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        border-radius: 6px;
    }
    
    .notification-item .notification-title {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .notification-item .notification-message {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }
    
    .notification-item .notification-time {
        font-size: 0.7rem;
        margin-top: 0.25rem;
    }
}

/* Mobile-optimized stats */
@media (max-width: 768px) {
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .stats-grid .card {
        margin-bottom: 0;
    }
}

/* Mobile-optimized empty states */
@media (max-width: 768px) {
    .empty-state {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .empty-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .empty-state h5 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
}

/* Mobile-optimized loading states */
@media (max-width: 768px) {
    .loading-spinner {
        font-size: 1.5rem;
    }
    
    .loading-text {
        font-size: 0.9rem;
    }
}

/* Mobile-optimized error states */
@media (max-width: 768px) {
    .error-state {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .error-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .error-state h5 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .error-state p {
        font-size: 0.9rem;
    }
}

/* Mobile-optimized success states */
@media (max-width: 768px) {
    .success-state {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .success-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .success-state h5 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .success-state p {
        font-size: 0.9rem;
    }
}

/* Mobile-optimized print styles */
@media print {
    .mobile-bottom-nav,
    .navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .container-fluid {
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Mobile-optimized accessibility */
@media (max-width: 768px) {
    .sr-only-mobile {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    
    .focus-visible:focus {
        outline: 2px solid #558C03; /* Avocado */
        outline-offset: 2px;
    }
}

/* Mobile-optimized animations */
@media (max-width: 768px) {
    .fade-in {
        animation: fadeIn 0.3s ease-in;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    .slide-in {
        animation: slideIn 0.3s ease-out;
    }
    
    @keyframes slideIn {
        from { transform: translateX(-100%); }
        to { transform: translateX(0); }
    }
}

/* Mobile-optimized touch targets */
@media (max-width: 768px) {
    .btn,
    .nav-link,
    .page-link,
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-check-input {
        width: 1.2rem;
        height: 1.2rem;
    }
    
    .form-check-label {
        padding-left: 0.5rem;
    }
}
