/* Custom Styles for Travel Guide System */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .sidebar {
    border-left: 1px solid #dee2e6;
    border-right: none;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar .sidebar-title {
        display: none;
    }
    
    .sidebar .nav-link span {
        display: none !important;
    }
    
    .sidebar .nav-link {
        justify-content: center;
        padding: 14px 0;
        margin: 4px 8px;
        position: relative;
    }
    
    .sidebar .nav-link i {
        margin: 0 !important;
        font-size: 1.3rem;
    }
    
    .sidebar .sidebar-header {
        justify-content: center;
        padding: 0 10px;
    }
    
    #sidebarToggle {
        display: none;
    }
    
    #mainContent {
        left: 70px;
    }
    
    [dir="rtl"] #mainContent {
        left: 0;
        right: 70px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 60px;
    }
    
    #mainContent {
        left: 60px;
    }
    
    [dir="rtl"] #mainContent {
        left: 0;
        right: 60px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-in;
}

/* Checkbox highlight when checked */
.checkbox-highlight {
    padding: 8px 12px;
    border-radius: 5px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.checkbox-highlight:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.checkbox-highlight input[type="checkbox"]:checked + label {
    color: #667eea;
    font-weight: 500;
}

.checkbox-highlight input[type="checkbox"]:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.checkbox-highlight:has(input[type="checkbox"]:checked) {
    background-color: #e7f3ff;
    border-color: #667eea;
}

/* Fallback for browsers that don't support :has() */
.checkbox-highlight.checked {
    background-color: #e7f3ff;
    border-color: #667eea;
}

/* Sidebar Toggle Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 250px;
    background: #ffffff;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    border-right: 1px solid #e9ecef;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
}

.sidebar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    color: white;
    border-radius: 0;
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-header .sidebar-title {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar-header .btn-link {
    color: white !important;
    opacity: 0.9;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sidebar-header .btn-link:hover {
    opacity: 1;
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.sidebar-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebarToggle {
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebarToggle:hover {
    opacity: 1;
}

#toggleIcon {
    transition: transform 0.3s ease;
    font-size: 1rem;
}

/* Sidebar Navigation Container */
#sidebarNav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

/* Collapsed Sidebar Styles */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    padding: 14px 0;
    text-align: center;
    position: relative;
    justify-content: center;
    margin: 4px 8px;
    border-radius: 10px;
}

.sidebar.collapsed .nav-link span {
    display: none !important;
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .nav-link i {
    font-size: 1.3rem;
    margin: 0 !important;
}

.sidebar.collapsed #toggleIcon {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-divider {
    margin: 8px 10px;
}

/* RTL Support for sidebar */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-left: 1px solid #e9ecef;
    border-right: none;
    box-shadow: -2px 0 15px rgba(0,0,0,0.1);
}

[dir="rtl"] .sidebar.collapsed #toggleIcon {
    transform: rotate(0deg);
}

[dir="rtl"] .sidebar:not(.collapsed) #toggleIcon {
    transform: rotate(180deg);
}

/* Main content adjustment */
#mainContent {
    position: absolute;
    top: 56px;
    left: 250px;
    right: 0;
    min-height: calc(100vh - 56px);
    padding: 20px;
    box-sizing: border-box;
    transition: left 0.3s ease;
}

.sidebar.collapsed ~ #mainContent {
    left: 70px;
}

[dir="rtl"] #mainContent {
    left: 0;
    right: 250px;
}

[dir="rtl"] .sidebar.collapsed ~ #mainContent {
    right: 70px;
    left: 0;
}

/* Sidebar tooltip styles - using JavaScript for positioning */
.sidebar-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.sidebar-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #333;
}

[dir="rtl"] .sidebar-tooltip::before {
    left: auto;
    right: -6px;
    border-right-color: transparent;
    border-left-color: #333;
}

/* Sidebar Navigation Links - Enhanced Design */
.sidebar .nav-link {
    color: #495057;
    padding: 14px 20px;
    border-radius: 8px;
    margin: 4px 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    border-left-color: #667eea;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
    color: #667eea;
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left-color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-weight: 600;
}

.sidebar .nav-link.active i {
    color: white;
    transform: scale(1.15);
}

/* Sidebar divider */
.sidebar-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 8px 15px;
    opacity: 0.5;
}

/* Select2 Integration with Bootstrap 5 */
.select2-container {
    width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 0.75rem;
    height: 38px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-left: 0;
    padding-right: 0;
    line-height: 38px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 8px;
}

.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: 0;
}

/* Fix Select2 in input-group */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 1% !important;
}

.input-group .select2-container .select2-selection {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .select2-container--open .select2-selection {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Ensure Select2 dropdown appears above modals */
.select2-container {
    z-index: 9999;
}

/* Print styles */
@media print {
    .navbar, .sidebar, .btn {
        display: none !important;
    }
    
    .select2-container {
        display: none !important;
    }
    
    select.select2-hidden-accessible {
        display: block !important;
    }
}
