/* Original inline block 1. */
@media (max-width: 768px) {
  .menu-profile ul li {
    width: 62px;
  }
}
   /* CSS cho các nút hành động */
    /* CSS for Author Actions Toolbar */
.author-actions-toolbar {
  display: flex;
  gap: 12px;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
}
.action-btn, .action-btn:visited {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}
.action-btn:hover, .action-btn.saved {
  background-color: #e5e7eb;
  border-color: #d1d5db;
  color: #1f2937;
}
.action-btn i {
  font-size: 14px;
  line-height: 1;
}
/* Primary Button (Zalo) */
.action-btn--primary, .action-btn--primary:visited {
  background-color: #1947c4;
  color: #ffffff;
  border-color: #1947c4;
}
.action-btn--primary:hover {
  background-color: #123593;
  border-color: #123593;
  color: #ffffff;
}

/* Placeholder for mobile fixed bar */
.author-actions-placeholder {
  display: none;
  height: 80px; /* Match mobile toolbar height */
}

/* --- DESKTOP STYLES (PC) --- */
@media (min-width: 992px) {
  .author-actions-toolbar {
    position: sticky;
    top: 100px; /* Adjust this value to position it correctly below your header */
    flex-direction: column;
    margin-top: 30px !important; /* Thêm khoảng cách trên cho PC */
    gap: 15px;
    width: 52px; /* Width of the circular buttons */
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
  }
  .author-actions-toolbar .action-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    padding: 0;
  }
  /* Giữ lại màu nền cho nút Zalo trên PC */
  .author-actions-toolbar .action-btn--primary,
  .author-actions-toolbar .action-btn--primary:hover {
    background-color: #1947c4;
    border-color: #1947c4;
  }
  .author-actions-toolbar .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  }
  .author-actions-toolbar .action-btn i {
    font-size: 18px;
    color: #555;
  }
  .author-actions-toolbar .action-btn.saved i,
  .author-actions-toolbar .action-btn:hover i {
    color: #1947c4;
  }
  .author-actions-toolbar .action-btn--primary i {
    color: #fff; /* Giữ icon Zalo màu trắng */
  }
  .author-actions-toolbar .action-btn .text {
    display: none; /* Hide text on desktop */
  }
}

/* --- MOBILE STYLES --- */
@media (max-width: 991.98px) {
  .author-content-wrapper {
    flex-direction: column;
  }
  .author-actions-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 6px; /* Giảm padding cho thanh toolbar */
    margin: 0;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    z-index: 999;
    justify-content: center;
    transition: transform 0.3s ease-in-out;
    gap: 6px; /* Giảm khoảng cách giữa các nút */
  }
  .author-actions-toolbar.unfixed {
    position: absolute;
    transform: translateY(100%); /* Hide it initially when unfixed */
  }
  .author-actions-toolbar .action-btn {
    flex-grow: 1;
    padding: 6px 8px; /* Giảm padding cho nút */
    font-size: 11px; /* Giảm cỡ chữ */
  }
  .author-actions-toolbar .action-btn i {
    font-size: 13px; /* Giảm cỡ icon */
  }
  .author-actions-placeholder {
    display: block;
    height: 60px; /* Giảm chiều cao placeholder */
  }
}
/* Specific for popup mobile toolbar */
.mobile-only-toolbar {
    display: none; /* Ẩn trên desktop */
}
@media (max-width: 991.98px) {
    .mobile-only-toolbar { display: flex; } /* Hiện trên mobile */
}

    /* CSS cho layout portfolio (Copy từ author.php) */
    .author-content-wrapper {
        display: flex;
        align-items: flex-start; /* Giữ nguyên */
        padding: 10px 10px 0; /* Thêm padding vào đây thay vì .portfolio-popup-main */
    }
    .profile-image {
        width: 100%;
        flex-grow: 1;
        /* Sử dụng biến CSS, với giá trị fallback */
        gap: var(--portfolio-spacing, 10px);
        column-gap: var(--portfolio-spacing, 10px);
    }
    .profile-image.layouts_three .portfolio-item-display {
        /* Sử dụng biến CSS, với giá trị fallback */
        margin-bottom: var(--portfolio-spacing, 10px);
    }
    .profile-image.single-item-grid {
      display: flex !important;
      flex-direction: column !important;
      align-items: center !important;
      grid-template-columns: 1fr !important;
      column-count: 1 !important;
    }
    .profile-image.layouts_three .portfolio-item-display{
      margin-bottom: var(--portfolio-spacing, 10px);
    }
    .profile-image.single-item-grid .portfolio-item-display {
      width: 100% !important;
      margin: 0 auto !important;
    }
    .portfolio-item-display {
        position: relative; /* Cần thiết cho overlay */
        overflow: hidden;
        cursor: pointer; /* Thêm con trỏ chuột */
    }
    .portfolio-item-display img, .portfolio-overlay {
        /* Sử dụng biến CSS, với giá trị fallback */
        border-radius: var(--portfolio-border-radius, 0px);
    }
    .fb-comments-container{
      background: #fff;
      padding: 20px 40px 25px;
      border-top: 1px solid #e9ecef;
    }
    .portfolio-overlay {
        position: absolute; top: 0; left: 0; right: 0; bottom: 0;
        display: flex; align-items: center; justify-content: center;
        background: rgba(0,0,0,0); /* Nền trong suốt mặc định */
        opacity: 0; /* Ẩn overlay mặc định cho ảnh */
        transition: background-color 0.3s ease, opacity 0.3s ease; /* Hiệu ứng chuyển động */
        pointer-events: none; /* Cho phép click xuyên qua overlay */
    }
    /* Hiển thị overlay khi hover (chỉ cho hiệu ứng overlay) */
    .hover-effect-overlay .portfolio-item-display:hover .portfolio-overlay {
        opacity: 1;
        background-color: rgba(0,0,0,0.5);
    }
    .hover-effect-overlay .portfolio-item-display:hover .portfolio-overlay .play {
        transform: scale(1);
        opacity: 1;
    }
    .portfolio-overlay .play {
        font-size: 20px; color: #fff; background: rgba(25, 71, 196, 0.8);
        border-radius: 50%; width: 50px; height: 50px;
        display: flex; align-items: center; justify-content: center;
        transform: scale(0.8);
        opacity: 0;
        transition: all 0.3s ease;
    }
    /* Luôn hiển thị icon play cho video */
    .portfolio-item-display.is-video .portfolio-overlay {
        opacity: 1; /* Luôn hiện overlay để chứa nút play */
        background: transparent; /* Nền trong suốt */
    }
    .portfolio-item-display.is-video .play {
        opacity: 0.8; /* Nút play hơi mờ */
        transform: scale(1); /* Kích thước bình thường */
    }
    .portfolio-item-display.is-video:hover .play {
        opacity: 1; /* Rõ hơn khi hover */
    }
    /* Responsive cho popup content */
    @media (max-width: 991.98px) {
        .author-content-wrapper {
            /* Bỏ padding trên mobile vì đã có ở parent */
            padding: 20px; /* Thêm lại padding cho mobile */
            flex-direction: column;
        }
        .fb-comments-container { padding: 20px; }
    }

/* Original inline block 2. */
.portfolio-popup-header .author-box-info.popup-version {
                position: relative;
                width: 100%;
                border: 1px solid rgba(129, 160, 230, 0.25);
                background: linear-gradient(152deg, #ffffff 0%, #f7faff 52%, #edf4ff 100%);
                border-radius: 18px;
                padding: 14px 16px;
                box-shadow: 0 12px 28px rgba(21, 52, 122, 0.1);
        }
        .portfolio-popup-header .author-box-main {
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto;
                gap: 14px 16px;
                align-items: center;
        }
        .portfolio-popup-header .author-head {
                display: flex;
                align-items: flex-start;
                gap: 12px;
                min-width: 0;
        }
        .portfolio-popup-header .user-avatar-shell {
                width: 68px;
                height: 68px;
                border-radius: 50%;
                padding: 2px;
                background: linear-gradient(145deg, #8db5ff 0%, #2f64dd 100%);
                flex-shrink: 0;
        }
        .portfolio-popup-header .user-avatar-shell .rounded-circle {
                width: 64px !important;
                height: 64px !important;
                border-radius: 50%;
                border: 2px solid #fff;
                box-shadow: 0 8px 20px rgba(19, 52, 122, 0.22);
                object-fit: cover;
        }
        .portfolio-popup-header .user-avatar-shell img {
            width: 64px !important;
            height: 64px !important;
            min-width: 64px !important;
            min-height: 64px !important;
            max-width: 64px !important;
            max-height: 64px !important;
            display: block;
            border-radius: 50% !important;
            object-fit: cover;
        }
        .portfolio-popup-header .author-info {
                min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            text-align: left;
        }
        .portfolio-popup-header .author-title-wrapper {
                display: flex;
                align-items: center;
                gap: 8px;
                min-width: 0;
                margin-bottom: 5px;
        }
        .portfolio-popup-header h1.portfolio-title {
                margin: 0;
                font-size: 1.08rem !important;
                font-weight: 800;
                color: #17366f;
                text-align: left !important;
                min-width: 0;
        }
        .portfolio-popup-header h1.portfolio-title span.label {
                background: linear-gradient(45deg, #0088fd 0%, #003bff 50%, #001faa 100%);
                font-size: 11px;
                padding: 2px 8px;
                border-radius: 999px;
                color: #fff;
                box-shadow: 0 6px 14px rgba(0, 59, 255, 0.28);
                display: inline-block;
                margin-right: 7px;
                position: relative;
                top: -1px;
        }
        .portfolio-popup-header .author-follow-btn {
            background: rgba(255, 255, 255, 0.88);
            color: #2b4f9a;
            border: 1px solid #c3d4fb;
            padding: 5px 12px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .portfolio-popup-header .author-follow-btn.saved,
        .portfolio-popup-header .author-follow-btn:hover {
            background: linear-gradient(45deg, #0088fd 0%, #003bff 50%, #001faa 100%);
            border-color: transparent;
            color: #fff;
            box-shadow: 0 8px 14px rgba(0, 59, 255, 0.22);
        }
        .portfolio-popup-header .author-follow-btn .follow-icon {
            display: none;
        }
        .portfolio-popup-header .author-meta-line {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: #4f648f;
            background: rgba(255, 255, 255, 0.8);
            border: 1px solid rgba(172, 194, 238, 0.38);
            border-radius: 999px;
            padding: 4px 10px;
            font-size: 12px;
            line-height: 1.2;
            margin-top: 4px;
            max-width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            align-self: flex-start;
        }
        .portfolio-popup-header .author-meta-line i {
            color: #2a5ec5;
            font-size: 11px;
        }
        .menu-profile-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: flex-end;
            align-items: center;
            margin: 0;
            padding: 0;
        }
        .menu-profile-list li {
            list-style: none;
        }
        .menu-profile-list li a {
            display: block;
            text-align: center;
            white-space: nowrap;
            padding: 8px 16px;
            border-radius: 999px;
            text-decoration: none;
            font-weight: 700;
            color: #5f6f8e;
            background-color: #eef3fb;
            border: 1px solid #dce6f8;
            transition: all 0.25s ease;
            font-size: 14px;
        }
        .menu-profile-list li.active a,
        .menu-profile-list li a:hover {
            color: #fff !important;
            background: linear-gradient(45deg, #0088fd 0%, #003bff 50%, #001faa 100%);
            border-color: transparent;
            box-shadow: 0 10px 16px rgba(0, 59, 255, 0.2);
            transform: translateY(-1px);
        }

        @media (max-width: 991.98px) {
            .portfolio-popup-header .author-box-main {
                grid-template-columns: 1fr;
            }
            .menu-profile-list {
                justify-content: flex-start;
            }
        }

        @media (max-width: 600px) {
            .portfolio-popup-header .author-follow-btn .text {
                display: none;
            }
            .portfolio-popup-header .author-follow-btn .follow-icon {
                display: inline-block;
            }
            .menu-profile-list {
                gap: 4px;
                justify-content: center;
            }
            .menu-profile-list li {
                flex: 0 0 auto;
                max-width: none;
                min-width: 0;
            }
            .menu-profile-list li a {
                width: 74px;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 4px 8px;
                font-size: 12px;
                line-height: 1.25;
                white-space: nowrap;
            }
            .menu-profile-list li.active a,
            .menu-profile-list li a:hover {
                transform: none;
                box-shadow: 0 6px 10px rgba(0, 59, 255, 0.16);
            }
        }

        @media (max-width: 576px) {
            .portfolio-popup-header .author-box-info.popup-version {
                border-radius: 14px;
                padding: 10px 10px;
                box-shadow: 0 8px 18px rgba(21, 52, 122, 0.08);
            }
            .portfolio-popup-header .author-box-main {
                gap: 8px 10px;
            }
            .portfolio-popup-header .author-head {
                gap: 8px;
            }
            .portfolio-popup-header .user-avatar-shell {
                width: 56px;
                height: 56px;
                padding: 2px;
            }
            .portfolio-popup-header .user-avatar-shell .rounded-circle,
            .portfolio-popup-header .user-avatar-shell img {
                width: 52px !important;
                height: 52px !important;
                min-width: 52px !important;
                min-height: 52px !important;
                max-width: 52px !important;
                max-height: 52px !important;
            }
            .portfolio-popup-header .author-title-wrapper {
                gap: 6px;
                margin-bottom: 3px;
            }
            .portfolio-popup-header h1.portfolio-title {
                font-size: 0.96rem !important;
            }
            .portfolio-popup-header h1.portfolio-title span.label {
                font-size: 10px;
                padding: 1px 7px;
                margin-right: 5px;
            }
            .portfolio-popup-header .author-meta-line {
                font-size: 11px;
                padding: 3px 8px;
                gap: 5px;
                margin-top: 2px;
            }
            .menu-profile-list {
                gap: 4px;
            }
            .menu-profile-list li {
                flex: 0 0 auto;
                max-width: none;
                min-width: 0;
            }
            .menu-profile-list li a {
                width: 70px;
                padding: 3px 7px;
                font-size: 11px;
                line-height: 1.25;
                border-radius: 999px;
                white-space: nowrap;
            }
        }

/* Original inline block 3. */
/* === Bổ sung cho Off-canvas Filter trên Mobile === */
.filter-offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.filter-offcanvas-overlay.show {
    display: block;
    opacity: 1;
}
.filter-offcanvas {
    position: fixed;
    top: 0;
    right: -320px; /* Bắt đầu bên ngoài màn hình */
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 99999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}
.filter-offcanvas.show {
    right: 0;
}
.offcanvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}
.offcanvas-header h5 {
    margin: 0;
    font-size: 18px;
}
.offcanvas-header .btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}
.offcanvas-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}
.offcanvas-body .control-group {
    margin-bottom: 15px;
}
.offcanvas-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}
.offcanvas-footer .btn-control {
    width: 100%;
}
.btn-filter-toggle {
    display: none; /* Ẩn trên desktop */
    padding: 10px 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.btn-filter-toggle i {
    margin-right: 5px;
}
/* === Kết thúc Off-canvas === */

/* General Styles */
.list-portfolio-wrap {
    padding: 20px 0;
}

/* Filter Bar */
.portfolio-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(247,249,253,0.96) 100%);
    border: 1px solid #e2e8f5;
    box-shadow: 0 10px 24px rgba(22, 34, 66, 0.06);
}
.portfolio-total-count {
    font-size: 14px;
    font-weight: 500;
    color: #52607a;
    white-space: nowrap;
    margin-right: auto;
    padding-right: 18px;
    border-right: 1px solid #dbe3f1;
}
.portfolio-total-count span {
    color: #1947c4;
    font-weight: 700;
}

.portfolio-controls form {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    position: relative;
    flex: 0 0 152px;
    min-height: 42px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #d8e1f0;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}

.control-group:focus-within,
.control-group:hover {
    border-color: #1947c4;
    box-shadow: 0 0 0 3px rgba(25, 71, 196, 0.08), 0 10px 18px rgba(25, 71, 196, 0.08);
}

.control-group .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    padding-left: 10px;
    color: #6c757d;
    flex-shrink: 0;
}

.control-group .icon img {
    width: 16px;
    height: 16px;
    opacity: 0.78;
}

.control-group select {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    outline: none;
}

.control-group select:focus {
    box-shadow: none;
}

.control-group .native-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.custom-select-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px 8px 0;
    border: 0;
    background: transparent;
    color: #23314f;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.custom-select-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-right: 2px solid #7a869d;
    border-bottom: 2px solid #7a869d;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.control-group.is-open .custom-select-arrow {
    transform: rotate(-135deg) translateY(-1px);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid #d8e1f0;
    background: #fff;
    box-shadow: 0 18px 40px rgba(17, 29, 61, 0.18);
}

.control-group.is-open .custom-select-dropdown {
    display: block;
}

.custom-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #24324a;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.custom-select-option:hover,
.custom-select-option.is-selected {
    background: #edf3ff;
    color: #1947c4;
}

.control-buttons {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
}

.btn-control {
    min-height: 42px;
    padding: 9px 14px;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.btn-search {
    background: #1947c4;
    color: #fff;
}

.btn-search:hover {
    background: #123593;
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(25, 71, 196, 0.18);
}

.btn-duan {
    background: linear-gradient(135deg, #ffbe3d 0%, #ff9b1c 52%, #ff7f0f 100%);
    color: #ffffff;
    padding-left: 16px;
    padding-right: 16px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 20px rgba(255, 142, 23, 0.26);
    letter-spacing: 0.2px;
}

.btn-duan:hover {
    background: linear-gradient(135deg, #ffc857 0%, #ffad32 52%, #ff8a1e 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(255, 142, 23, 0.32);
}

/* Portfolio Grid */
.list-portfolio-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* Item Portfolio - Assuming styles are in item-portfolio.php or main CSS.
   Adding some basic hover effects here for completeness. */
.portfolio-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.quatrang {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.quatrang .page-numbers {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
}

.quatrang .page-numbers:hover,
.quatrang .page-numbers.current {
    background: #1947c4;
    color: #fff;
    border-color: #1947c4;
}

/* Responsive */
@media (max-width: 1200px) {
    .portfolio-controls form {
        gap: 8px;
    }
    .control-group {
        flex-basis: 142px;
    }
}

@media (max-width: 992px) {
    /* Ẩn các bộ lọc dropdown và nút Cảm hứng trên mobile */
    .portfolio-controls form .control-group {
        display: none;
    }
    /* Hiển thị nút Lọc */
    .btn-filter-toggle {
        display: inline-flex; /* Sử dụng flex để căn giữa icon và text */
        align-items: center;
        justify-content: center;
        gap: 5px;
    }
    /* Sắp xếp lại form trên mobile để nút Lọc chiếm nhiều không gian hơn */
    .portfolio-controls form {
        display: flex; /* Chuyển sang flexbox */
        gap: 8px;
        width: 100%; /* Đảm bảo form chiếm toàn bộ chiều rộng */
    }
    .portfolio-controls form .control-buttons {
        display: flex; /* Chuyển sang flexbox */
        gap: 8px;
        flex-grow: 1; /* Cho phép container của 2 nút này co giãn */
    }
    .btn-filter-toggle, .btn-control {
        flex-grow: 1; /* Cho cả 3 nút tự co giãn đều */
        min-height: 38px;
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 14px;
    }
    .portfolio-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        border-radius: 14px;
        margin-bottom: 12px;
    }
    .portfolio-total-count {
        width: 100%;
        display: none; /* Ẩn phần đếm trên mobile */
    }
}

@media (max-width: 576px) {
    main .section-home {
        padding: 10px 0 8px;
    }

    main .section-home h1 {
        font-size: 22px;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    main .section-home .login-register {
        min-height: 36px;
        padding: 7px 16px !important;
        font-size: 13px !important;
        border-radius: 9px !important;
        box-shadow: 0 6px 14px rgba(0, 55, 200, 0.22) !important;
    }

    .portfolio-controls {
        padding: 8px;
        border-radius: 12px;
        gap: 8px;
        margin-bottom: 10px;
    }

    .portfolio-controls form {
        gap: 8px;
    }

    .btn-filter-toggle,
    .btn-control {
        min-height: 34px;
        padding: 6px 10px;
        border-radius: 9px;
        font-size: 13px;
    }

    .btn-filter-toggle i {
        margin-right: 4px;
        font-size: 13px;
    }

    .list-portfolio-inner {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Original inline block 4. */
.portfolio-popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top, rgba(12, 24, 52, 0.75), rgba(0, 0, 0, 0.88));
    z-index: 99998; display: none; align-items: flex-start; justify-content: center;
    padding-top: 5vh; overflow-y: auto; backdrop-filter: blur(7px);
    gap: 20px; /* Khoảng cách giữa sidebar và container chính */
}
.portfolio-popup-container {
    background: linear-gradient(160deg, #ffffff 0%, #f7faff 100%);
    border-radius: 18px;
    width: 100%; max-width: 1060px;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(191, 207, 239, 0.45);
    margin-bottom: 5vh;
    position: relative; /* Thêm để nút close hoạt động đúng */
}
.portfolio-popup-sidebar {
    /* CSS cho thanh công cụ bên cạnh */
    position: sticky;
    top: 5vh; /* Giữ nó ở đầu màn hình khi cuộn */
    flex-shrink: 0;
    align-self: flex-start; /* Căn nó lên trên cùng */
    z-index: 1; /* Đảm bảo sidebar luôn nổi lên trên */
}
.portfolio-popup-close {
    position: fixed; top: 15px; right: 20px; /* Đổi thành fixed */
    font-size: 32px; color: #fff; cursor: pointer; line-height: 1; z-index: 100000;
    background: rgba(15, 29, 61, 0.6);
    border: 1px solid rgba(255,255,255,0.24);
    border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
}
.portfolio-popup-main { 
    padding: 0; /* Bỏ padding để nội dung tràn lề */
    display: flex;
    flex-direction: column;
}
.portfolio-popup-header { 
    border-bottom: 0;
    min-height: 75px; /* Để giữ không gian khi đang tải */
    padding: 20px 24px 12px 24px;
}
.portfolio-popup-content .loading-spinner {
    width: 40px; height: 40px; border: 4px solid #f3f3f3;
    border-top: 4px solid #1947c4; border-radius: 50%;
    animation: spin 1s linear infinite; margin: 50px auto;
}
.project-inline-detail {
    padding: 22px 24px 26px;
}
.project-inline-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d9e2f4;
    background: #f5f7fc;
    color: #1947c4;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    margin-bottom: 16px;
}
.project-inline-title {
    margin: 0 0 8px;
    color: #1f2a44;
    font-size: 28px;
    font-weight: 800;
}
.project-inline-meta {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    color: #5f6b84;
    font-size: 13px;
    margin-bottom: 18px;
}
.project-inline-meta a {
    color: #1947c4;
    text-decoration: none;
}
.project-inline-content {
    color: #44506a;
    line-height: 1.8;
    margin-bottom: 22px;
    font-size: 15px;
    background: #fff;
    border: 1px solid #e5edfb;
    border-radius: 14px;
    padding: 14px 16px;
}
.project-inline-gallery .list-image {
    column-count: 2;
    column-gap: 15px;
}
.project-inline-gallery-item {
    break-inside: avoid;
    height: auto !important;
    margin-bottom: 15px;
}
.project-inline-gallery-item a {
    display: block;
    height: auto !important;
}
.project-inline-gallery-item img {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 12px;
    display: block;
}
/* CSS cho thanh công cụ mobile */
.author-actions-toolbar.mobile-only-toolbar {
    display: none; /* Ẩn trên desktop */
}
@media (max-width: 768px) {
    .portfolio-popup-overlay { padding-top: 0; }
    .portfolio-popup-container { 
        max-width: 100%; height: 100%; border-radius: 0; margin-bottom: 0; 
        display: flex; flex-direction: column; /* Chuyển container sang flexbox dọc */
    }
    .portfolio-popup-main { 
        height: 100%; padding: 0; 
        display: flex; flex-direction: column; /* Chuyển main sang flexbox dọc */
        overflow: hidden; /* Ngăn main tự cuộn */
    }
    .portfolio-popup-header { padding: 14px 14px 10px 14px; flex-shrink: 0; z-index: 10; background: #fff; }
    .portfolio-popup-content { padding: 0; flex-grow: 1; overflow-y: auto; } /* Chỉ cho phép content cuộn */
    .project-inline-detail { padding: 16px; }
    .project-inline-title { font-size: 22px; }
    .project-inline-gallery .list-image { column-count: 1 !important; }

    .portfolio-popup-close {
        color: #fff; background: rgba(0,0,0,0.3); border-radius: 50%;
        width: 30px; height: 30px; display: flex; align-items: center;
        justify-content: center; top: 10px; right: 10px;
    }
    .author-actions-toolbar.mobile-only-toolbar {
        display: flex; /* Hiện trên mobile */
    }
    .portfolio-popup-sidebar {
        display: none; /* Ẩn sidebar trên mobile, vì nó đã được tích hợp ở dưới */
    }
}

/* Original inline block 5. */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
}
.load-more-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 220px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #f3f6fb;
    color: #1947c4;
    font-weight: 600;
}
.quatrang {
    margin-top: 0; /* Reset margin-top cũ */
    margin-left: auto; /* Đẩy qua phải */
}
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(25,71,196,0.15);
    border-top-color: #1947c4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 20px;
    }
    .quatrang {
        margin-left: 0;
		display: none;
    }
}
