:root {
    --color-primary: #3dd397;
    --color-green: #246d4b;
    --color-light-green: #f3ffe1;
    --color-text: #141414;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #006B38;
    background: radial-gradient(circle, #f3ffe1 35%, #d2ffea 60% 100%);
    background-image: url('./images/bg-2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
}

.participants-wrapper {
    max-height: 400px;
    overflow-y: auto;
}


:is(#winners-list, .participants-wrapper)::-webkit-scrollbar {
    width: 6px;
    height: 8px;
    background-color: transparent !important;
}

.list-group::-webkit-scrollbar-thumb,
.list-group::-webkit-scrollbar-track {
    background-color: transparent !important;
}

:is(#winners-list, .participants-wrapper):hover::-webkit-scrollbar {
    background-color: #ecf5e6 !important;
}

:is(#winners-list, .participants-wrapper)::-webkit-scrollbar-thumb {
    background-color: transparent !important;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Thanh kéo */
:is(#winners-list, .participants-wrapper):hover::-webkit-scrollbar-thumb {
    background-color: var(--color-green) !important;
    transition: all 0.3s ease;
}

:is(#winners-list, .participants-wrapper)::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-green);
}

.card {
    border-radius: 15px;
    border: none;
    overflow: hidden;
}

.card-header {
    font-weight: 600;
    padding: 15px 20px;
    background: var(--color-green);
}

.card-body {
    padding: 20px;
}

.form-control:focus {
    border-color: #54f3b6;
    outline: 0;
    box-shadow: 0 0 0 .25rem rgba(12, 187, 85, 0.25);
}

.btn-outline-danger.btn-delete,
.btn-outline-danger.btn-delete-winner {
    --bs-btn-border-color: transparent !important
}

.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--color-green);
    --bs-btn-border-color: var(--color-green);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--color-green);
    --bs-btn-hover-border-color: var(--color-green);
    --bs-btn-focus-shadow-rgb: 60, 153, 110;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--color-green);
    --bs-btn-active-border-color: var(--color-green);
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--color-green);
    --bs-btn-disabled-border-color: var(--color-green);
}

.btn-outline-success {
    --bs-btn-color: var(--color-green) !important;
    --bs-btn-bg: transparent !important;
    --bs-btn-border-color: var(--color-green) !important;
    --bs-btn-hover-color: var(--color-green) !important;
    --bs-btn-hover-bg: var(--color-green) !important;
    --bs-btn-hover-border-color: var(--color-green) !important;
}

.btn-outline-success:hover {
    --bs-btn-color: var(--color-green) !important;
    --bs-btn-bg: var(--color-green) !important;
    --bs-btn-border-color: var(--color-green) !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: var(--color-green) !important;
    --bs-btn-hover-border-color: var(--color-green) !important;
}

.btn-add-participant,
.btn-return {
    background-color: var(--color-green);
    color: #fff;
}

.btn-add-participant:hover,
.btn-return:hover {
    background-color: #154931;
    color: #fff;
}

/* Participant List Item */
#participants-list {
    margin-bottom: 0;
}

#participants-list tbody td {
    border-bottom: 1px dashed #e6e6e6;
}

#participants-list tbody tr:last-child {
    border-bottom: 0px solid transparent !important;
}

#participants-list tbody tr:last-child td {
    border-bottom: 0px solid transparent !important;
}

#participants-list tbody tr:hover {
    background-color: #f8f9fa;
}

#participants-list tbody tr:hover .participant-id,
#participants-list tbody tr:hover .participant-name {
    color: var(--color-green);
    font-weight: 500;
}

.participant-name {
    font-weight: 400;
    color: var(--color-text);
}

.participant-id {
    font-size: 0.85rem;
    color: #999;
}

.btn-delete {
    padding: 4px 12px;
    font-size: 0.85rem;
}

/* Winner List Item */
.winner-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fffbf0;
    transition: all 0.3s ease;
}

.winner-item:hover {
    background: #fff9e6;
    box-shadow: 0 2px 8px rgb(131 77 9 / 22%);
}

.winner-name {
    font-weight: 600;
    color: var(--color-text);
    flex-grow: 1;
}

.winner-time {
    font-size: 0.85rem;
    color: #666;
}

.winner-badge {
    background: #ffedb6;
    color: #d97706;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 10px;
}

/* Error Message */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Buttons */
.btn-success {
    background-color: var(--color-green);
    border-color: var(--color-green);
}

.btn-success:hover {
    background-color: #1a5538;
    border-color: #1a5538;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #2bb87f;
    border-color: #2bb87f;
}

/* Scrollbar Styling */
.list-group::-webkit-scrollbar {
    width: 8px;
}

.list-group::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.list-group::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.list-group::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.participant-item,
.winner-item {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .dashboard-title {
        font-size: 1.75rem;
    }

    .card-body {
        padding: 15px;
    }
}
/* Google Sheet setup modal */
.gsheet-step {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    font-weight: 600;
    color: var(--color-green);
}

.gsheet-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-green);
    color: #fff;
    font-size: 0.8rem;
}

.gsheet-code-wrapper {
    position: relative;
}

.gsheet-code {
    max-height: 260px;
    overflow: auto;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
}

.gsheet-copy-btn {
    position: absolute;
    top: 8px;
    right: 18px;
    z-index: 1;
}

#gsheet-url-input {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.85rem;
}

#gsheet-current-url {
    word-break: break-all;
}

/* Theme settings modal */
.theme-section-title {
    font-weight: 600;
    color: var(--color-green);
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.theme-image-card {
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.theme-image-preview {
    height: 130px;
    border-radius: 6px;
    margin-bottom: 8px;
    /* nền ô cờ để thấy được ảnh PNG trong suốt */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e9e9e9 25%, transparent 25%),
        linear-gradient(-45deg, #e9e9e9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9e9e9 75%),
        linear-gradient(-45deg, transparent 75%, #e9e9e9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.theme-color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.theme-color-item input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 2px;
    flex-shrink: 0;
}

.theme-preset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.theme-preset .swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .15);
}

.theme-preview {
    width: 100%;
    max-width: 280px;
}

/* Link tải file mẫu */
.sample-download a {
    color: var(--color-green);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.sample-download a:hover {
    text-decoration: underline;
}

/* ===== Dashboard quản trị (v2) ===== */
body {
    background-attachment: fixed;
}

.admin-nav {
    background: rgba(20, 60, 42, 0.92);
    backdrop-filter: blur(6px);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.admin-brand {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.admin-tabs {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    padding: 6px;
    gap: 4px;
    flex-wrap: wrap;
}

.admin-tabs .nav-link {
    color: var(--color-green);
    font-weight: 600;
    border-radius: 8px;
}

.admin-tabs .nav-link.active {
    background: var(--color-green);
    color: #fff;
}

.participants-wrapper {
    max-height: 520px;
}

#winners-list {
    max-height: 620px;
    overflow-y: auto;
    padding-right: 4px;
}

.min-w-0 {
    min-width: 0;
}

.winner-card {
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}

.winner-card.cancelled {
    background: #f8f9fa;
}

.winner-card.cancelled .winner-name {
    text-decoration: line-through;
    color: #6c757d;
}

.winner-num {
    background: var(--color-green);
    color: #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.winner-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 10px;
}

.winner-actions .dropdown-item[aria-disabled] {
    color: #adb5bd;
}

/* Giải thưởng */
.prize-card-admin {
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 14px;
    height: 100%;
    background: #fff;
}

.prize-card-admin.current {
    border: 2px solid var(--color-green);
    box-shadow: 0 0 0 4px rgba(36, 109, 75, 0.12);
}

.prize-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: #f3f7f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.prize-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.prize-thumb .li {
    font-size: 2rem;
    color: var(--color-green);
}

.prize-image-preview {
    width: 140px;
    height: 110px;
    flex-direction: column;
}

/* Thông báo */
.toast-stack {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
}

.toast-notification {
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    font-weight: 500;
}

.email-preview {
    width: 100%;
    height: 70vh;
    border: 0;
    display: block;
    background: #f4f6f5;
}

/* ===== Tab Ủng hộ tác giả ===== */
.support-card {
    position: relative;
    max-width: 440px;
    margin: 48px auto 24px;
    background: #f3f8f5;
    border-radius: 22px;
    padding: 56px 24px 24px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.support-icon {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 84px;
    height: 84px;
    border-radius: 22px;
    background: #d4f53c;
    border: 5px solid #0f1f17;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: #3b2a20;
}

.support-title {
    font-weight: 800;
    margin-bottom: 6px;
    color: #141414;
}

.support-desc {
    color: #444;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.support-amounts {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.support-amounts button {
    border: 1px solid #d5d9d7;
    background: #fff;
    border-radius: 999px;
    padding: 6px 16px;
    font-weight: 600;
    color: #141414;
}

.support-amounts button.active {
    background: #0f1f17;
    color: #d4f53c;
    border-color: #0f1f17;
}

.support-custom {
    max-width: 260px;
    margin: 0 auto 14px;
}

.support-qr {
    background: #fff;
    border: 1px solid #e3e7e5;
    border-radius: 16px;
    width: 240px;
    min-height: 240px;
    margin: 0 auto 14px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-qr img {
    width: 100%;
    height: auto;
}

.support-qr-error {
    font-size: 0.85rem;
    color: #888;
}

.support-info {
    background: #fff;
    border: 1px solid #e3e7e5;
    border-radius: 14px;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.9rem;
}

.support-info > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.support-info span {
    color: #666;
}

.support-copy {
    border: 0;
    background: #7ee2a8;
    color: #0f3d26;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    margin-left: 6px;
}

/* ===== Điện thoại ===== */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    .admin-nav {
        position: static;
    }

    .admin-brand {
        flex-basis: 100%;
        font-size: 0.95rem;
    }

    .admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .card-body {
        padding: 14px;
    }

    .participants-wrapper,
    #winners-list {
        max-height: 60vh;
    }

    .winner-actions {
        justify-content: flex-start;
    }

    #pending-banner {
        flex-wrap: wrap;
    }

    .toast-stack {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: none;
    }

    .support-card {
        margin-top: 56px;
        padding: 52px 16px 18px;
    }

    .email-preview {
        height: 60vh;
    }
}

/* Email / tên dài tự xuống dòng, không đẩy mất nút sửa / xoá */
#participants-list td:nth-child(2),
.winner-card .small {
    overflow-wrap: anywhere;
}

/* ===== Tab Party ===== */
.party-add-form {
    border-top: 1px dashed #ddd;
    padding-top: 12px;
}

.party-sound-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.party-sound-row .name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.party-tile {
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    padding: 8px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}

.party-tile.active {
    border: 2px solid var(--color-green);
}

.party-tile-preview {
    height: 90px;
    border-radius: 8px;
    background-color: #f5f5f5;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.party-tile-preview img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.party-tile .name {
    font-size: 0.85rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.party-default-btn {
    width: 70px;
}

.party-default-btn path {
    fill: #45484d;
    stroke: #fff;
    stroke-width: 9;
}

.party-default-btn text {
    fill: #fff;
    font-size: 31px;
    font-weight: 800;
    text-anchor: middle;
}
