﻿html {
  font-size: 14px;
  scroll-behavior: smooth;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1c1d1f;
}

/* ==================== HEADER STYLES - UDEMY DESIGN ==================== */

/* Navbar Base */
.navbar {
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    min-height: 72px;
    border-bottom: 1px solid #d1d7dc;   
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    padding: 0;
    margin-right: 2rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-brand img {
    display: block;
}

.navbar-brand:hover {
    opacity: 0.8;
}

/* Navigation Links */
.navbar .nav-link {
    color: #1c1d1f;
    font-weight: 400;
    font-size: 14px;
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar .nav-link:hover {
    color: #5624d0;
}

/* Search Bar Container */
.header-search {
    max-width: 100%;
    border: 2px solid #d1d7dc; /* Thicker border, lighter color */
    border-radius: 50px;
    background-color: #ffffff; /* Pure white background */
    overflow: visible; /* Changed from hidden to visible */
    transition: all 0.2s ease;
    height: 48px;
    display: flex;
    align-items: center;
    flex: 1;
    position: relative; /* Added for z-index */
    z-index: 100; /* Ensure it's above other elements */
    pointer-events: auto; /* Explicitly enable pointer events */
}

.header-search:hover {
    background-color: #fff;
    border-color: #5624d0; /* Purple on hover */
}

.header-search:focus-within {
    background-color: #fff;
    border-color: #5624d0; /* Purple when focused */
    box-shadow: 0 0 0 3px rgba(86, 36, 208, 0.1);
    z-index: 101; /* Raise when focused */
}

.header-search .input-group-text {
    background-color: transparent;
    border: none;
    padding: 0 0.5rem 0 1rem;
    color: #1c1d1f; /* Darker color for better visibility */
    display: flex;
    align-items: center;
    height: 100%;
    transition: color 0.2s ease;
    z-index: 1; /* Ensure button is above */
    pointer-events: auto; /* Enable pointer events */
}

/* Search button hover effect */
.header-search button.input-group-text:hover {
    color: #5624d0;
}

.header-search button.input-group-text:active {
    color: #401b9c;
}

.header-search .form-control {
    background-color: transparent;
    border: none;
    padding: 0.75rem 1rem 0.75rem 0;
    font-size: 14px;
    color: #1c1d1f;
    height: 48px;
    line-height: 1.5;
    position: relative; /* Added for z-index */
    z-index: 1; /* Ensure input is above */
    pointer-events: auto; /* Explicitly enable pointer events */
    cursor: text; /* Show text cursor */
    top: -45px;
    left: 40px;
}

.header-search .form-control:focus {
    background-color: transparent;
    box-shadow: none;
    outline: none;
}

.header-search .form-control::placeholder {
    color: #6a6f73;
    opacity: 1;
    font-size: 14px;
}

/* Disable browser autocomplete dropdown */
.header-search .form-control::-webkit-contacts-auto-fill-button,
.header-search .form-control::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
    position: absolute;
    right: 0;
}

/* Hide any autocomplete suggestions */
.header-search input[type="search"]::-webkit-search-decoration,
.header-search input[type="search"]::-webkit-search-cancel-button,
.header-search input[type="search"]::-webkit-search-results-button,
.header-search input[type="search"]::-webkit-search-results-decoration {
    display: none;
}

/* Right Side Navigation */
.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* Right side spacing */
.navbar-nav-right {
    gap: 0.5rem;
    margin-left: 2rem;
    flex-shrink: 0;
}

.navbar-nav-right .nav-item:first-child {
    margin-left: 0;
}

/* Icon Links */
.navbar .nav-link i {
    color: #1c1d1f;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.navbar .nav-link:hover i {
    color: #5624d0;
}

/* Heart Icon specific styling */
.bi-heart {
    font-weight: 400;
}

.nav-link:hover .bi-heart {
    color: #e74c3c;
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 40px;
    text-align: center;
    border: 1px solid transparent;
}

.user-avatar:hover {
    transform: scale(1.05);
    border-color: #1c1d1f;
}

/* Dropdown Menu */
.dropdown-menu {
    border: 1px solid #d1d7dc;
    box-shadow: 0 2px 8px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.1);
    border-radius: 4px;
    margin-top: 0.5rem;
    min-width: 240px;
    padding: 0.5rem 0;
    animation: fadeIn 0.2s ease;
    z-index: 1050;
    position: absolute;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 14px;
    color: #1c1d1f;
    transition: background-color 0.15s ease;
    text-decoration: none;
    display: block;
}

.dropdown-item:hover {
    background-color: #f7f9fa;
    color: #1c1d1f;
}

.dropdown-item:active {
    background-color: #e8e9eb;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid #d1d7dc;
    opacity: 1;
}

/* Notification Badge */
.nav-item .badge {
    font-size: 0.65rem;
    padding: 3px 6px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
}

/* Container Fluid */
.navbar .container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    display: flex;
    align-items: center;
    max-width: 100%;
    gap: 0;
}

/* Mobile Toggle Button */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Responsive Design */
@media (max-width: 991px) {
    .navbar {
        position: relative;
    }
    
    .header-search {
        margin: 1rem 0;
        height: 44px;
    }
    
    .header-search .form-control {
        height: 44px;
    }
    
    .navbar-nav {
        margin-top: 1rem;
        width: 100%;
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .nav-item {
        margin: 0.25rem 0;
        width: 100%;
    }
    
    .navbar {
        min-height: auto;
    }
    
    .navbar .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .dropdown-menu {
        width: 100%;
    }
    
    .navbar-nav-right {
        margin-left: 0;
    }
}

@media (min-width: 992px) {
    .header-search {
        max-width: none;
        flex: 1;
        margin: 0 2rem;
    }
    
    .navbar .form-control {
        width: 100%;
    }
    
    .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
        align-items: center;
        flex: 1;
    }
}

@media (min-width: 1200px) {
    .navbar .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .header-search {
        margin: 0 2.5rem;
    }
}

@media (min-width: 1400px) {
    .navbar .container-fluid {
        max-width: 1600px;
        margin: 0 auto;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
    
    .header-search {
        margin: 0 3rem;
    }
    
    .navbar-nav-right {
        margin-left: 2.5rem;
    }
}

@media (min-width: 1600px) {
    .navbar .container-fluid {
        max-width: 1800px;
        padding-left: 3rem;
        padding-right: 3rem;
    }
    
    .header-search {
        margin: 0 3.5rem;
    }
}

/* ==================== FOOTER STYLES ==================== */
.site-footer {
    background-color: #1c1d1f;
    margin-top: 3rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    width: 100%;
}

.site-footer a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #c0c4c7;
    text-decoration: underline;
}

.site-footer .btn-outline-light {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 14px;
    padding: 0.5rem 1rem;
}

.site-footer .btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

/* ==================== MAIN CONTENT ==================== */
.container {
    max-width: 1340px;
}

main {
    min-height: calc(100vh - 72px - 250px);
    padding-top: 2rem;
}

/* ==================== FORM STYLES ==================== */
.btn {
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus {
  box-shadow: none;
  outline: none;
}

.form-control:focus, 
.form-check-input:focus {
  border-color: #5624d0;
  box-shadow: 0 0 0 0.2rem rgba(86, 36, 208, 0.25);
}

.form-floating > .form-control-plaintext::placeholder, 
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, 
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ==================== UTILITIES ==================== */

/* Selection color */
::selection {
    background-color: #5624d0;
    color: #fff;
}

::-moz-selection {
    background-color: #5624d0;
    color: #fff;
}

/* Smooth transitions */
a, button, .nav-link, .btn {
    transition: all 0.2s ease;
}

/* Link styles */
a {
    color: #5624d0;
    text-decoration: none;
}

a:hover {
    color: #401b9c;
    text-decoration: underline;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Keep focus outline for keyboard users */
:focus-visible {
    outline: 2px solid #5624d0;
    outline-offset: 2px;
}

/* Scrollbar styling (for webkit browsers) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading state */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Disabled state */
.disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* ==================== USER DROPDOWN MENU - UDEMY STYLE ==================== */

/* User Dropdown Container */
.user-dropdown {
    position: relative;
}

.user-dropdown-menu {
    width: 300px;
    border: 1px solid #d1d7dc;
    box-shadow: 0 2px 8px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.1);
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 0;
    animation: fadeInDropdown 0.2s ease;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1050;
    position: absolute;
    right: 0;
    top: 100%;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Khối 1: User Info Section */
.user-info-section {
    padding: 16px;
    background-color: #fff;
}

.user-avatar-large {
    width: 48px;
    height: 48px;
    font-size: 16px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: #1c1d1f;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #6a6f73;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dropdown Sections */
.dropdown-section {
    padding: 0;
}

/* Dropdown Items */
.user-dropdown-menu .dropdown-item {
    padding: 12px 16px;
    font-size: 14px;
    color: #1c1d1f;
    transition: background-color 0.15s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    border: none;
    background: none;
    width: 100%;
}

.user-dropdown-menu .dropdown-item:hover {
    background-color: #f7f9fa;
    color: #1c1d1f;
}

.user-dropdown-menu .dropdown-item:active {
    background-color: #e8e9eb;
}

.user-dropdown-menu .dropdown-item:focus {
    background-color: #f7f9fa;
}

/* Divider */
.user-dropdown-menu .dropdown-divider {
    margin: 0;
    border-top: 1px solid #eeeeee;
    opacity: 1;
}

/* Purple Badge for Notifications */
.bg-purple {
    background-color: #5624d0;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Language Section Styling */
.user-dropdown-menu .text-muted {
    font-size: 13px;
    color: #6a6f73;
}

/* Logout Item - Emphasized */
.user-dropdown-menu .fw-semibold {
    font-weight: 600;
}

/* Scrollbar for dropdown if content is too long */
.user-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.user-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.user-dropdown-menu::-webkit-scrollbar-thumb {
    background: #d1d7dc;
    border-radius: 3px;
}

.user-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #b4bcc4;
}

/* Hover effect on dropdown trigger */
.user-dropdown:hover .user-avatar {
    border-color: #1c1d1f;
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .user-dropdown-menu {
        width: 100%;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .user-info-section {
        padding: 12px;
    }
    
    .user-dropdown-menu .dropdown-item {
        padding: 10px 12px;
    }
}

/* Focus states for accessibility */
.user-dropdown .dropdown-toggle:focus {
    outline: 2px solid #5624d0;
    outline-offset: 2px;
}

/* Prevent text selection in dropdown */
.user-dropdown-menu {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Link style override in dropdown */
.user-dropdown-menu .dropdown-item:hover {
    text-decoration: none;
}

/* Animation for dropdown show/hide */
.user-dropdown-menu.show {
    animation: fadeInDropdown 0.2s ease;
}

/* ==================== EXPLORE DROPDOWN MENU ==================== */

/* Explore Dropdown Container */
.explore-dropdown {
    position: relative;
}

.explore-dropdown .nav-link {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.explore-dropdown .nav-link::after {
    display: none; /* Remove default Bootstrap arrow */
}

.explore-dropdown-menu {
    width: 280px;
    border: 1px solid #d1d7dc;
    box-shadow: 0 2px 8px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.1);
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 8px;
    animation: fadeInDropdown 0.2s ease;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1050;
    position: absolute;
}

/* Explore Menu Items */
.explore-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 16px;
    color: #1c1d1f !important;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.explore-item:hover {
    background-color: #f5f5f5;
    color: #1c1d1f !important;
    text-decoration: none;
}

.explore-item:visited {
    color: #1c1d1f !important;
}

.explore-item:active {
    color: #1c1d1f !important;
}

.explore-item:focus {
    color: #1c1d1f !important;
}

/* Category Icon */
.explore-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Scrollbar for explore dropdown */
.explore-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.explore-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.explore-dropdown-menu::-webkit-scrollbar-thumb {
    background: #d1d7dc;
    border-radius: 3px;
}

.explore-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #b4bcc4;
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .explore-dropdown-menu {
        width: 100%;
        max-width: 300px;
    }
    
    .explore-item {
        padding: 12px 16px;
    }
}

/* Hover effect on dropdown trigger */
.explore-dropdown:hover .nav-link {
    color: #5624d0;
}

/* Focus states for accessibility */
.explore-dropdown .dropdown-toggle:focus {
    outline: 2px solid #5624d0;
    outline-offset: 2px;
}