/* ===================================
   RESPONSIVE TRANG KINH DOANH
   (Dự án & Đầu tư)
   Thiết kế chuẩn UX/UI
   Không thay đổi desktop
   =================================== */

/* ===================================
   DESKTOP - Fix header overlap
   =================================== */
@media (min-width: 993px) {
    .article-page {
        padding-top: 200px !important;
    }
}

/* ===================================
   TABLET (≤ 992px)
   =================================== */
@media (max-width: 992px) {
    /* Article Page */
    .article-page {
        margin-top: 70px !important;
        padding: 30px 0 !important;
    }
    
    /* Article Container */
    .article-container {
        grid-template-columns: 1fr !important;
        padding: 0 30px !important;
        gap: 30px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Sidebar - Đặt xuống dưới */
    .sidebar {
        position: static !important;
        top: auto !important;
        margin-bottom: 0 !important;
        margin-top: 30px !important;
        max-width: 100%;
        order: 2 !important;
    }
    
    /* Main Content - Đặt lên trên */
    .main-content {
        order: 1 !important;
    }
    
    .sidebar-title {
        padding: 12px 18px !important;
        font-size: 13px !important;
    }
    
    .sidebar-menu a {
        padding: 10px 18px !important;
        font-size: 12px !important;
    }
    
    .sidebar-menu a:hover,
    .sidebar-menu a.active {
        padding-left: 23px !important;
    }
    
    /* Main Content */
    .main-content {
        padding: 30px 25px !important;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 12px !important;
        margin-bottom: 20px !important;
    }
    
    /* Article Header */
    .article-header {
        margin-bottom: 25px !important;
        padding-bottom: 18px !important;
    }
    
    .article-category {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    
    /* Article Title */
    .article-title {
        font-size: 24px !important;
        margin-bottom: 15px !important;
    }
    
    /* Article Body */
    .article-body {
        font-size: 14px !important;
        line-height: 1.7 !important;
    }
    
    .article-body p {
        margin-bottom: 18px !important;
    }
    
    .article-body h4 {
        font-size: 18px !important;
        margin-top: 25px !important;
        margin-bottom: 12px !important;
    }
    
    .article-body ul,
    .article-body ol {
        margin-bottom: 18px !important;
        padding-left: 25px !important;
    }
    
    .article-body li {
        margin-bottom: 8px !important;
    }
    
    /* Project Grid */
    .project-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    /* Project Card */
    .project-card {
        border-radius: 10px !important;
    }
    
    .project-card img {
        height: 200px !important;
    }
    
    .project-info {
        padding: 18px !important;
    }
    
    .project-info h4 {
        font-size: 15px !important;
        margin-bottom: 12px !important;
    }
    
    .project-info p {
        font-size: 13px !important;
    }
    
    /* Two Column Grid */
    .two-column-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .two-column-grid img {
        height: 250px !important;
    }
    
    /* Video Container */
    .video-container {
        margin: 25px 0 !important;
    }
}

/* ===================================
   MOBILE LỚN (≤ 768px)
   =================================== */
@media (max-width: 768px) {
    /* Article Page */
    .article-page {
        margin-top: 60px !important;
        padding: 25px 0 !important;
    }
    
    /* Article Container */
    .article-container {
        padding: 0 20px !important;
        gap: 25px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Sidebar - Đặt xuống dưới */
    .sidebar {
        border-radius: 8px !important;
        margin-bottom: 0 !important;
        margin-top: 25px !important;
        order: 2 !important;
        pointer-events: auto !important;
        position: relative !important;
        z-index: 10000 !important;
    }
    
    /* Main Content - Đặt lên trên */
    .main-content {
        order: 1 !important;
    }
    
    /* CRITICAL FIX: Đảm bảo sidebar links có thể click */
    .sidebar * {
        pointer-events: auto !important;
    }
    
    .sidebar-section {
        pointer-events: auto !important;
        position: relative !important;
        z-index: 10001 !important;
    }
    
    .sidebar-menu {
        pointer-events: auto !important;
        position: relative !important;
        z-index: 10002 !important;
    }
    
    .sidebar-menu li {
        pointer-events: auto !important;
        position: relative !important;
        z-index: 10003 !important;
    }
    
    .sidebar-menu a {
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10004 !important;
        display: block !important;
        user-select: auto !important;
        -webkit-user-select: auto !important;
        -moz-user-select: auto !important;
        touch-action: manipulation !important;
    }
    
    .sidebar-title {
        padding: 10px 15px !important;
        font-size: 12px !important;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .sidebar-menu a {
        padding: 10px 15px !important;
        font-size: 12px !important;
    }
    
    .sidebar-menu a:hover,
    .sidebar-menu a.active {
        padding-left: 20px !important;
    }
    
    /* Main Content */
    .main-content {
        padding: 25px 20px !important;
        border-radius: 8px !important;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 11px !important;
        margin-bottom: 18px !important;
        flex-wrap: wrap !important;
    }
    
    .breadcrumb a,
    .breadcrumb span {
        display: inline-block !important;
        margin: 2px 0 !important;
    }
    
    /* Article Header */
    .article-header {
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
    }
    
    .article-category {
        font-size: 11px !important;
        margin-bottom: 8px !important;
    }
    
    /* Article Title */
    .article-title {
        font-size: 20px !important;
        margin-bottom: 12px !important;
        line-height: 1.4 !important;
    }
    
    /* Article Body */
    .article-body {
        font-size: 13px !important;
        line-height: 1.7 !important;
    }
    
    .article-body p {
        margin-bottom: 15px !important;
        text-align: justify !important;
    }
    
    .article-body h4 {
        font-size: 16px !important;
        margin-top: 20px !important;
        margin-bottom: 10px !important;
    }
    
    .article-body ul,
    .article-body ol {
        margin-bottom: 15px !important;
        padding-left: 20px !important;
    }
    
    .article-body li {
        margin-bottom: 6px !important;
    }
    
    .article-body img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 8px !important;
        margin: 15px 0 !important;
    }
    
    /* Project Grid */
    .project-grid {
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }
    
    /* Project Card */
    .project-card {
        border-radius: 8px !important;
    }
    
    .project-card img {
        height: 220px !important;
    }
    
    .project-info {
        padding: 15px !important;
    }
    
    .project-info h4 {
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }
    
    .project-info p {
        font-size: 12px !important;
        line-height: 1.6 !important;
    }
    
    /* Two Column Grid */
    .two-column-grid {
        gap: 18px !important;
    }
    
    .two-column-grid img {
        height: 220px !important;
        border-radius: 8px !important;
    }
    
    /* Video Container */
    .video-container {
        margin: 20px 0 !important;
        border-radius: 8px !important;
    }
}

/* ===================================
   MOBILE NHỎ (≤ 480px)
   =================================== */
@media (max-width: 480px) {
    /* Article Page */
    .article-page {
        margin-top: 55px !important;
        padding: 20px 0 !important;
    }
    
    /* Article Container */
    .article-container {
        padding: 0 15px !important;
        gap: 20px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Sidebar - Đặt xuống dưới */
    .sidebar {
        border-radius: 6px !important;
        margin-bottom: 0 !important;
        margin-top: 20px !important;
        order: 2 !important;
    }
    
    /* Main Content - Đặt lên trên */
    .main-content {
        order: 1 !important;
    }
    
    .sidebar-title {
        padding: 10px 12px !important;
        font-size: 11px !important;
        border-radius: 6px 6px 0 0 !important;
    }
    
    .sidebar-menu a {
        padding: 10px 12px !important;
        font-size: 11px !important;
    }
    
    .sidebar-menu a:hover,
    .sidebar-menu a.active {
        padding-left: 17px !important;
    }
    
    /* Main Content */
    .main-content {
        padding: 20px 15px !important;
        border-radius: 6px !important;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 10px !important;
        margin-bottom: 15px !important;
    }
    
    /* Article Header */
    .article-header {
        margin-bottom: 18px !important;
        padding-bottom: 12px !important;
    }
    
    .article-category {
        font-size: 10px !important;
        margin-bottom: 6px !important;
    }
    
    /* Article Title */
    .article-title {
        font-size: 18px !important;
        margin-bottom: 10px !important;
        line-height: 1.3 !important;
    }
    
    /* Article Body */
    .article-body {
        font-size: 12px !important;
        line-height: 1.6 !important;
    }
    
    .article-body p {
        margin-bottom: 12px !important;
    }
    
    .article-body h4 {
        font-size: 14px !important;
        margin-top: 18px !important;
        margin-bottom: 8px !important;
    }
    
    .article-body ul,
    .article-body ol {
        margin-bottom: 12px !important;
        padding-left: 18px !important;
    }
    
    .article-body li {
        margin-bottom: 5px !important;
    }
    
    .article-body img {
        margin: 12px 0 !important;
        border-radius: 6px !important;
    }
    
    /* Project Grid */
    .project-grid {
        gap: 15px !important;
    }
    
    /* Project Card */
    .project-card {
        border-radius: 6px !important;
    }
    
    .project-card img {
        height: 180px !important;
    }
    
    .project-info {
        padding: 12px !important;
    }
    
    .project-info h4 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }
    
    .project-info p {
        font-size: 11px !important;
    }
    
    /* Two Column Grid */
    .two-column-grid {
        gap: 15px !important;
    }
    
    .two-column-grid img {
        height: 180px !important;
        border-radius: 6px !important;
    }
    
    /* Video Container */
    .video-container {
        margin: 18px 0 !important;
        border-radius: 6px !important;
    }
}

/* ===================================
   UX/UI IMPROVEMENTS
   =================================== */

/* Smooth transitions */
.sidebar-menu a,
.project-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Better hover states on mobile */
@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-5px) !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }
}

/* Touch feedback */
@media (max-width: 768px) {
    .sidebar-menu a:active,
    .project-card:active {
        transform: scale(0.98) !important;
    }
}

/* Improved readability */
@media (max-width: 768px) {
    .article-body {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Better spacing for mobile */
@media (max-width: 480px) {
    .article-body > * {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Accessibility: Focus states */
.sidebar-menu a:focus,
.project-card:focus-within {
    outline: 2px solid #28a745 !important;
    outline-offset: 2px !important;
}

/* Loading optimization */
@media (max-width: 768px) {
    .project-card,
    .sidebar {
        will-change: auto !important;
    }
    
    /* Đảm bảo sidebar không bị che bởi các element khác NHƯNG nằm dưới header */
    .sidebar {
        position: relative !important;
        z-index: 50 !important; /* Thấp hơn header (1000) để không đè lên khi scroll */
    }
    
    .sidebar * {
        pointer-events: auto !important;
    }
    
    /* Đảm bảo header luôn ở trên cùng */
    .header {
        z-index: 1000 !important;
        position: fixed !important;
    }
}

/* Prevent text overflow */
@media (max-width: 480px) {
    .article-title,
    .project-info h4 {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
}

/* Sidebar mobile improvements */
@media (max-width: 768px) {
    .sidebar {
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        pointer-events: auto !important;
    }
    
    .sidebar-section {
        max-height: none !important;
        pointer-events: auto !important;
    }
    
    .sidebar-menu {
        max-height: none !important;
        overflow-y: visible !important;
        pointer-events: auto !important;
    }
    
    .sidebar-menu a {
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
    }
}

/* Image optimization */
@media (max-width: 768px) {
    .article-body img,
    .project-card img,
    .two-column-grid img {
        object-fit: cover !important;
        width: 100% !important;
    }
}

/* Breadcrumb improvements */
@media (max-width: 768px) {
    .breadcrumb {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .breadcrumb::-webkit-scrollbar {
        height: 3px;
    }
    
    .breadcrumb::-webkit-scrollbar-thumb {
        background: #28a745;
        border-radius: 3px;
    }
}

/* Landscape mode */
@media (max-width: 768px) and (orientation: landscape) {
    .article-page {
        margin-top: 55px !important;
    }
    
    .sidebar {
        max-height: 300px;
        overflow-y: auto;
    }
}

/* Video responsive */
@media (max-width: 768px) {
    .video-container {
        padding-bottom: 56.25% !important;
    }
    
    .video-container iframe {
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .video-container iframe {
        border-radius: 6px;
    }
}
