.youtube-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 0.5rem;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.score-highlight {
    animation: pulse 0.4s ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Custom button styles - giữ màu như ban đầu */
/* Prevent flash by applying styles immediately */
.btn-primary {
    background-color: #3b82f6 !important;
    color: white !important;
    border: none !important;
}

/* DaisyUI Pagination - đảm bảo màu xanh và hỗ trợ dark mode */
#pagination-container .join {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
}

#pagination-container .join .btn-primary {
    background-color: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

/* Dark mode support cho pagination */
[data-theme="dark"] #pagination-container .join .btn-primary {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: white !important;
}

#pagination-container .join .btn-outline {
    border-color: hsl(var(--bc) / 0.2);
    background-color: transparent;
}

#pagination-container .join .btn-outline:hover:not(:disabled) {
    background-color: hsl(var(--bc) / 0.1);
    border-color: hsl(var(--bc) / 0.3);
}

#pagination-container .join .btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive pagination trên mobile */
@media (max-width: 768px) {
    #pagination-container .join .btn-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Ensure buttons have correct color on initial render */
#load-video-btn.btn-primary {
    background-color: #3b82f6 !important;
    color: white !important;
    border: none !important;
}

#fetch-new-videos-btn.btn-secondary {
    background-color: #64748b !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background-color: #2563eb !important;
}

.btn-secondary {
    background-color: #64748b !important;
    color: white !important;
    border: none !important;
}

.btn-secondary:hover {
    background-color: #475569 !important;
}

.btn-ghost-custom {
    /* background-color: #f1f5f9 !important; */
    /* color: #334155 !important; */
    border: 1px solid #cbd5e1 !important;
}

.btn-ghost-custom:hover {
    background-color: #e2e8f0 !important;
}

.btn-error-custom {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5 !important;
}

.btn-error-custom:hover {
    background-color: #fee2e2 !important;
}

.btn-adjust {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

.btn-adjust:hover {
    background-color: #e2e8f0 !important;
}

.btn-warning-custom {
    background-color: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px solid #fcd34d !important;
}

.btn-warning-custom:hover {
    background-color: #fde68a !important;
}

.btn-success {
    background-color: #10b981 !important;
    color: white !important;
    border: none !important;
}

.btn-success:hover {
    background-color: #059669 !important;
}

 .btn-youtube {
    border-color: #6b7280 !important; /* màu tối cho border */
    color: #374151 !important; /* màu tối cho text */
    background-color: transparent !important;
}

.btn-youtube .fab.fa-youtube {
    color: #ff6363 !important; /* màu đỏ cho icon */
}

.btn-youtube:hover {
    background-color: #ff6363 !important;
    color: white !important;
    border-color: #ff6363 !important;
}

.btn-youtube:hover .fab.fa-youtube {
    color: white !important; /* màu trắng cho icon khi hover */
}   

/* Layout Switching Styles */
/* Layout 1 column: max-w-5xl, all sections stack vertically */
#main-container.layout-1-column {
    max-width: 56rem !important; /* max-w-5xl */
}

/* Ensure grid container supports ordering */
#main-container.layout-1-column .grid {
    display: grid !important;
}

/* Override responsive classes for 1-column layout - force everything to stack vertically */
#main-container.layout-1-column .layout-video-player {
    grid-column: span 12 / span 12 !important;
    grid-column-start: 1 !important;
    grid-column-end: 13 !important;
    grid-row-start: auto !important;
    order: 1 !important;
}

@media (min-width: 1280px) {
    #main-container.layout-1-column .layout-video-player {
        grid-column: span 12 / span 12 !important;
        grid-column-start: 1 !important;
        grid-column-end: 13 !important;
        grid-row-start: auto !important;
        order: 1 !important;
    }
}

/* Right Column: Force to full width and stack vertically */
#main-container.layout-1-column .layout-right-column {
    grid-column: span 12 / span 12 !important;
    grid-column-start: 1 !important;
    grid-column-end: 13 !important;
    grid-row-start: auto !important;
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    flex-direction: unset !important;
    order: 2 !important;
}

@media (min-width: 768px) {
    #main-container.layout-1-column .layout-right-column {
        grid-column: span 12 / span 12 !important;
        grid-column-start: 1 !important;
        grid-column-end: 13 !important;
        grid-row-start: auto !important;
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
        order: 2 !important;
    }
}

@media (min-width: 1280px) {
    #main-container.layout-1-column .layout-right-column {
        grid-column: span 12 / span 12 !important;
        grid-column-start: 1 !important;
        grid-column-end: 13 !important;
        grid-row-start: auto !important;
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
        flex-direction: unset !important;
        order: 2 !important;
    }
}

/* Video Control: Full width */
#main-container.layout-1-column .layout-video-control {
    grid-column: span 12 !important;
}

@media (min-width: 768px) {
    #main-container.layout-1-column .layout-video-control {
        grid-column: span 12 !important;
    }
}

/* History and Export: Side by side, 6 columns each */
#main-container.layout-1-column .layout-history {
    grid-column: span 6 !important;
}

@media (min-width: 768px) {
    #main-container.layout-1-column .layout-history {
        grid-column: span 6 !important;
    }
}

#main-container.layout-1-column .layout-export {
    grid-column: span 6 !important;
}

@media (min-width: 768px) {
    #main-container.layout-1-column .layout-export {
        grid-column: span 6 !important;
    }
}

/* Layout 2 columns: default (current layout) */
#main-container.layout-2-columns {
    max-width: 90rem !important; /* max-w-8xl */
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom DaisyUI rounded box */
:root {
    --rounded-box: 0.8rem;
    --rounded-btn: 0.4rem;
    --padding-card: 0.5rem;
}

@media (max-width: 640px) {
    :root {
        --padding-card: 0.25rem;
    }
}


/* SweetAlert2 custom styles - giữ lại font hiện tại */
.swal2-popup {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
}

.swal2-title {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
}

.swal2-html-container {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
}



.swal2-confirm,
.swal2-cancel,
.swal2-deny {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
}

/* Dark theme variables */

/* Score history horizontal scroll */
#score-history-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#score-history-list::-webkit-scrollbar {
    height: 6px;
}

#score-history-list::-webkit-scrollbar-track {
    background: transparent;
}

#score-history-list::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

#score-history-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.7);
}

/* Theater Mode Styles */
body.theater-mode #main-header {
    display: none !important;
}

body.theater-mode #main-footer {
    display: none !important;
}

body.theater-mode #main-container {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Select2 Custom Styles để tương thích với DaisyUI */
.select2-container {
    width: 100% !important;
}

/* Style cho select box - giống input DaisyUI (multiple) */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #d1d5db !important;
    border-radius: 0.4rem !important;
    min-height: 2rem !important;
    background-color: #ffffff !important;
    padding: 0 2px !important;
    transition: all 0.2s ease !important;
}

/* Style cho select box - giống input DaisyUI (single) */
.select2-container--default .select2-selection--single {
    border: 1px solid #d1d5db !important;
    border-radius: 0.4rem !important;
    height: 2rem !important;
    background-color: #ffffff !important;
    padding: 0 0.5rem !important;
    transition: all 0.2s ease !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2rem !important;
    padding: 0 !important;
    color: #1f2937 !important;
    font-size: 0.875rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 2rem !important;
    right: 0.5rem !important;
}

/* Dark mode support */
[data-theme="dark"] .select2-container--default .select2-selection--multiple,
.dark .select2-container--default .select2-selection--multiple {
    border-color: #4b5563 !important;
    background-color: #1f2937 !important;
}

[data-theme="dark"] .select2-container--default .select2-selection--single,
.dark .select2-container--default .select2-selection--single {
    border-color: #4b5563 !important;
    background-color: #1f2937 !important;
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f9fafb !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #3b82f6 !important;
    outline: 2px solid rgba(59, 130, 246, 0.2) !important;
    outline-offset: 2px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #3b82f6 !important;
    outline: 2px solid rgba(59, 130, 246, 0.2) !important;
    outline-offset: 2px !important;
}

/* Style cho tags đã chọn - màu primary đẹp */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #3b82f6 !important;
    border: none !important;
    color: #ffffff !important;
    padding: 3px 0 3px 20px !important;
    margin: 0.125rem 0.25rem 0.125rem 0 !important;
    border-radius: 0.4rem !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
    max-width: 100% !important;
    position: relative !important;
}

.select2-selection__clear {
    margin-top: 0px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #ffffff !important;
    font-weight: bold !important;
    opacity: 0.9 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 3px 0 0 0.25rem !important;
    border: none !important;
    background: transparent !important;
    flex-shrink: 0 !important;
    width: 1.125rem !important;
    height: 1.125rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    font-size: 1rem !important;
    order: 2 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ffffff !important;
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
}

/* Đảm bảo text không đè lên nút x */
.select2-container--default .select2-selection--multiple .select2-selection__choice > span {
    flex: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    order: 1 !important;
}

/* Style cho input field bên trong (multiple select inline) */
.select2-container--default .select2-search--inline .select2-search__field {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 1.5rem !important;
    color: #1f2937 !important;
    font-size: 0.875rem !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

[data-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field,
.dark .select2-container--default .select2-search--inline .select2-search__field {
    color: #f9fafb !important;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: #9ca3af !important;
    opacity: 0.7 !important;
}

/* Style cho search field trong dropdown (single select) */
.select2-container--default .select2-search .select2-search__field {
    border-radius: 0.4rem !important;
}

.select2-container--default .select2-search .select2-search__field:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: none !important;
}

[data-theme="dark"] .select2-container--default .select2-search .select2-search__field,
.dark .select2-container--default .select2-search .select2-search__field {
    border-color: #4b5563 !important;
    background-color: #1f2937 !important;
    color: #f9fafb !important;
}

[data-theme="dark"] .select2-container--default .select2-search .select2-search__field:focus,
.dark .select2-container--default .select2-search .select2-search__field:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: none !important;
}

.select2-container--default .select2-search .select2-search__field::placeholder {
    color: #9ca3af !important;
    opacity: 0.7 !important;
}

/* Style cho dropdown */
.select2-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 0.8rem !important;
    background-color: #ffffff !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 0.25rem !important;
}

[data-theme="dark"] .select2-dropdown,
.dark .select2-dropdown {
    border-color: #4b5563 !important;
    background-color: #1f2937 !important;
}

/* Style cho options */
.select2-container--default .select2-results__option {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    color: #1f2937 !important;
    transition: background-color 0.15s ease !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option,
.dark .select2-container--default .select2-results__option {
    color: #f9fafb !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #1f2937 !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true],
.dark .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #f9fafb !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option--highlighted {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
}

/* Line clamp utility */