/* ============================================
   MOBİL RESPONSIVE STİLLER
   ============================================ */

/* Mobil cihazlar (max 768px) */
@media (max-width: 768px) {
    /* Log səhifəsi üçün mobil uyğunluq */
    
    /* Kart başlığı */
    .content-card .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
        padding: 15px !important;
    }
    
    .card-header h2 {
        font-size: 1.25rem;
        margin-bottom: 5px !important;
    }
    
    .card-header .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .card-header .btn-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    /* Filter forması */
    #filter-form .row {
        margin: 0 -5px;
    }
    
    #filter-form .col-md-3,
    #filter-form .col-md-4,
    #filter-form .col-md-2 {
        padding: 0 5px;
        margin-bottom: 10px;
    }
    
    #filter-form .form-label {
        font-size: 0.875rem;
        margin-bottom: 3px;
    }
    
    #filter-form .form-select,
    #filter-form .form-control,
    #filter-form .input-group {
        font-size: 0.875rem;
    }
    
    #filter-form button[type="submit"] {
        font-size: 0.875rem;
        padding: 8px 12px;
    }
    
    /* Cədvəl mobil görünüş */
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        overflow: hidden;
        margin: 0 -15px;
        width: calc(100% + 30px);
    }
    
    .table {
        margin-bottom: 0;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 10px;
        background: white;
    }
    
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table tbody td:last-child {
        border-bottom: none;
    }
    
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        font-size: 0.875rem;
        min-width: 100px;
    }
    
    .table tbody td .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    /* Log mesajları */
    .log-message {
        font-size: 0.875rem;
        line-height: 1.4;
        word-break: break-word;
    }
    
    .log-message .text-muted {
        font-size: 0.75rem;
    }
    
    /* Düymə qrupları */
    .btn-group-sm > .btn,
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 36px;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    /* Statistik kartlar */
    .row .col-md-3 {
        margin-bottom: 15px;
    }
    
    /* Boş məlumat mesajı */
    .alert.text-center {
        padding: 20px 15px;
    }
    
    .alert .display-4 {
        font-size: 3rem;
    }
}

/* Kiçik mobil cihazlar (max 576px) */
@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .content-card {
        border-radius: 10px;
        overflow: hidden;
    }
    
    /* Kart gövdəsi */
    .card-body {
        padding: 15px !important;
    }
    
    /* Filter sətri */
    #filter-form .row {
        flex-direction: column;
    }
    
    #filter-form .col-md-3,
    #filter-form .col-md-4,
    #filter-form .col-md-2 {
        width: 100%;
        padding: 0;
        margin-bottom: 12px;
    }
    
    /* Cədvəl hüceyrələri */
    .table tbody td {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }
    
    .table tbody td::before {
        margin-bottom: 5px;
        min-width: auto;
    }
    
    /* Badge'lar */
    .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    /* Düymələr */
    .btn {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
    
    .btn i {
        font-size: 0.875rem;
    }
    
    /* Pagination */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 0.875rem;
    }
}

/* Çox kiçik mobil cihazlar (max 375px) */
@media (max-width: 375px) {
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    .card-header p.text-muted {
        font-size: 0.8rem;
    }
    
    .table tbody td::before {
        font-size: 0.8rem;
    }
    
    .table tbody td {
        font-size: 0.85rem;
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    /* Log detalları modalı */
    #logDetailsModal .modal-body {
        padding: 15px;
    }
    
    #logDetailsContent {
        font-size: 0.75rem;
        padding: 10px;
    }
}

/* Tablet cihazlar (768px - 992px) */
@media (min-width: 768px) and (max-width: 992px) {
    .content-card .card-header {
        padding: 15px 20px !important;
    }
    
    .card-header h2 {
        font-size: 1.3rem;
    }
    
    .table th,
    .table td {
        padding: 8px;
        font-size: 0.875rem;
    }
    
    .log-message {
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* ============================================
   TOUCH-FRIENDLY INTERFACE
   ============================================ */

/* Touch-friendly düymələr */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* iOS zoom problemi üçün */
    }
    
    /* Touch scroll improvement */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Daha böyük tap targets */
    .table tbody td {
        padding: 12px 0;
    }
    
    .badge {
        padding: 6px 10px;
        font-size: 0.875rem;
    }
    
    /* Checkbox və radio büyüt */
    .form-check-input {
        width: 20px;
        height: 20px;
    }
    
    .form-check-label {
        padding-left: 30px;
        font-size: 1rem;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    .content-card {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .card-header {
        background-color: #4a5568 !important;
        color: #e2e8f0;
    }
    
    .table {
        color: #e2e8f0;
    }
    
    .table tbody tr {
        background-color: #4a5568;
        border-color: #718096;
    }
    
    .table tbody td {
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .table tbody td::before {
        color: #cbd5e0;
    }
    
    .form-control,
    .form-select {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #4a5568;
        border-color: #63b3ed;
        color: #e2e8f0;
    }
    
    .modal-content {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .modal-header {
        border-color: #718096;
    }
    
    .modal-footer {
        border-color: #718096;
    }
    
    pre.bg-light {
        background-color: #4a5568 !important;
        color: #e2e8f0;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
    
    .modal.fade .modal-dialog {
        transition: transform 0.3s ease-out;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus styles for keyboard navigation */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .table tbody tr {
        border-width: 2px;
    }
    
    .badge {
        border: 1px solid currentColor;
    }
}

/* Print styles */
@media print {
    .content-card .card-header .btn,
    .content-card .card-header .btn-group,
    #filter-form,
    .table tbody td:last-child {
        display: none !important;
    }
    
    .content-card {
        border: none;
        box-shadow: none;
    }
    
    .table {
        border: 1px solid #000;
    }
    
    .table th,
    .table td {
        border: 1px solid #000;
    }
}

/* Inline mobil üçün əlavə CSS */
.mobile-table {
    font-size: 0.875rem;
}

.mobile-table td {
    padding: 10px 5px;
}

/* Touch feedback */
.touch-active {
    transform: scale(0.98);
    opacity: 0.9;
    transition: transform 0.1s ease;
}

/* Scrollbar optimization */
.table-responsive::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile action bar */
.mobile-action-bar {
    position: fixed;
    bottom: 70px;
    right: 15px;
    z-index: 1030;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #dee2e6;
    z-index: 1030;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: #6c757d;
    /* background: linear-gradient(45deg, black, transparent);
   font-size: 0.75rem;*/
    /*padding: 5px;
    flex: 1;*/
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 3px;
}

.nav-item.active {
    color: #0d6efd;
}

.nav-item span {
    font-size: 0.7rem;
}

/* Pull to refresh */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px;
    background: linear-gradient(to bottom, rgba(13, 110, 253, 0.1), transparent);
    z-index: 1040;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pull-to-refresh.show {
    transform: translateY(0);
}

.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 110, 253, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
}

.refresh-indicator i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile toast */
.mobile-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.875rem;
    z-index: 1050;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.mobile-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mobile-toast.toast-info { background: rgba(13, 110, 253, 0.9); }
.mobile-toast.toast-success { background: rgba(25, 135, 84, 0.9); }
.mobile-toast.toast-warning { background: rgba(255, 193, 7, 0.9); }
.mobile-toast.toast-error { background: rgba(220, 53, 69, 0.9); }

/* Landscape mode optimization */
@media (orientation: landscape) and (max-height: 500px) {
    .card-header {
        padding: 10px 15px !important;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
        margin-bottom: 5px !important;
    }
    
    .table-responsive {
        max-height: 200px;
    }
    
    .bottom-nav {
        display: none;
    }
    
    .mobile-action-bar {
        bottom: 15px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .badge, .form-control {
        border-width: 0.5px;
    }
}

/* Battery saver mode */
@media (prefers-reduced-transparency: reduce) {
    .action-buttons,
    .mobile-toast,
    .refresh-indicator {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 1);
    }
}

/* Data saver mode */
@media (prefers-reduced-data: reduce) {
    .bi::before {
        font-display: block;
    }
    
    .table tbody tr {
        animation: none;
    }
}