/* Enhanced Responsive Styles for Arabic Laravel App */

/* Mobile First Approach */
@media (max-width: 576px) {
    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .navbar-brand i {
        display: none;
    }
    
    .user-dropdown .btn {
        padding: 6px 12px !important;
        font-size: 0.875rem;
    }
    
    .user-dropdown .btn span {
        display: none;
    }
    
    /* Sidebar adjustments */
    .sidebar {
        width: 100% !important;
        right: -100% !important;
    }
    
    .sidebar.show {
        right: 0 !important;
    }
    
    .sidebar .nav-link {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .sidebar .nav-link i {
        font-size: 1rem;
        margin-left: 8px;
    }
    
    /* Main content adjustments */
    .main-content {
        padding: 10px !important;
    }
    
    /* Card adjustments */
    .card {
        border-radius: 12px !important;
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px !important;
    }
    
    .card-header h5 {
        font-size: 1.1rem;
    }
    
    .card-header .d-flex {
        flex-direction: column !important;
        gap: 10px;
    }
    
    /* Button adjustments */
    .btn-modern {
        padding: 8px 16px !important;
        font-size: 0.875rem;
    }
    
    .btn-group-modern .btn {
        padding: 4px 8px !important;
    }
    
    /* Form adjustments */
    .form-control-modern,
    .form-select {
        padding: 8px 12px !important;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 4px;
    }
    
    /* Employee cards for mobile */
    .employee-card {
        padding: 12px !important;
        margin-bottom: 8px;
    }
    
    .employee-card h6 {
        font-size: 1rem;
    }
    
    .employee-card .small {
        font-size: 0.8rem !important;
    }
    
    /* Search form adjustments */
    .search-form {
        padding: 12px !important;
    }
    
    /* Profile page adjustments */
    .profile-avatar {
        width: 70px !important;
        height: 70px !important;
    }
    
    .profile-avatar i {
        font-size: 2rem !important;
    }
    
    .stat-item {
        padding: 10px !important;
        gap: 8px !important;
    }
    
    .stat-item i {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }
    
    .stat-label {
        font-size: 0.75rem !important;
    }
    
    .stat-value {
        font-size: 0.875rem !important;
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 991px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .card-header {
        padding: 18px 20px;
    }
    
    .btn-modern {
        padding: 9px 18px;
    }
    
    .employee-card {
        padding: 15px;
    }
    
    .search-form {
        padding: 16px;
    }
}

/* Desktop enhancements */
@media (min-width: 992px) {
    /* Hover effects for desktop */
    .sidebar .nav-link:hover {
        transform: translateX(-8px);
        background-color: rgba(255,255,255,0.15);
    }
    
    .table-row:hover {
        transform: scale(1.005);
    }
    
    .btn-modern:hover {
        transform: translateY(-3px);
    }
    
    .card:hover {
        transform: translateY(-4px);
    }
    
    /* Enhanced animations */
    .sidebar .nav-link {
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .table-row {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .btn-modern {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .card {
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    }
    
    .sidebar {
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    
    .navbar {
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: white;
        color: #000000;
    }
    
    .form-control-modern,
    .form-select {
        background-color: white;
        border-color: #718096;
        color: #000000;
    }
    
    .table-row:hover {
        background: linear-gradient(135deg, white, white) !important;
    }
    
    .employee-card:hover {
        background: linear-gradient(135deg, white, white);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .sidebar .nav-link:hover {
        transform: none;
    }
    
    .btn-modern:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .table-row:hover {
        transform: none;
    }
}

/* Enhanced focus indicators for accessibility */
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 1px;
}

/* Loading states */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print optimizations */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .dropdown,
    .user-dropdown {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #ddd !important;
        padding: 8px !important;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
    }
}

/* RTL specific adjustments */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="rtl"] .sidebar.show {
    right: 0;
}

[dir="rtl"] .main-content {
    margin-right: 280px;
    margin-left: 0;
}

[dir="rtl"] .dropdown-menu {
    right: 0;
    left: auto;
}

[dir="rtl"] .btn-group .btn:first-child {
    border-radius: 0 8px 8px 0;
}

[dir="rtl"] .btn-group .btn:last-child {
    border-radius: 8px 0 0 8px;
}

/* Enhanced mobile menu animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.sidebar.show {
    animation: slideInFromRight 0.3s ease-out;
}

.sidebar.hiding {
    animation: slideOutToRight 0.3s ease-out;
}

/* Enhanced scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8, #694a9e);
}

::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Performance optimizations */
.card,
.btn,
.sidebar,
.navbar {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Enhanced touch targets for mobile */
@media (max-width: 768px) {
    .btn,
    .nav-link,
    .dropdown-item,
    .form-control,
    .form-select {
        min-height: 44px;
        min-width: 44px;
    }
    
    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Custom Pagination Styling */
.pagination {
    font-size: 0.75rem !important;
}

.pagination .page-link {
    padding: 0.25rem 0.5rem !important;
    margin: 0 1px;
    border-radius: 4px !important;
    border: 1px solid #dee2e6;
    color: #6c757d;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination .page-link:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Dark mode pagination styling */
[data-bs-theme="dark"] .pagination .page-link {
    background-color: #343a40;
    border-color: #495057;
    color: #adb5bd;
    min-width: 32px;
    height: 32px;
}

[data-bs-theme="dark"] .pagination .page-link:hover {
    background-color: #495057;
    border-color: #6c757d;
    color: #fff;
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #343a40;
    border-color: #495057;
}

/* Responsive pagination */
@media (max-width: 576px) {
    .pagination {
        font-size: 0.7rem !important;
    }
    
    .pagination .page-link {
        padding: 0.2rem 0.4rem !important;
        margin: 0;
        min-width: 28px;
        height: 28px;
    }
}

/* Extra compact pagination for better mobile experience */
.pagination-sm .page-link {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.7rem !important;
    min-width: 28px;
    height: 28px;
}

/* Override Bootstrap default pagination size */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 4px !important;
}
