@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(circle, #ff1e1e 0%, #8b0000 100%);
    min-height: 100vh;
    font-family: 'Montserrat', sans-serif;
    color: white;
    overflow-x: hidden;
}

/* ============ HEADER ============ */
.header-section {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeDown 0.8s ease-out;
}

.tet-year {
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff700, #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
    margin-bottom: 10px;
}

.tet-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tet-subtitle {
    font-size: 1.2rem;
    color: #ffe680;
    margin-top: 10px;
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* ============ HÌNH NỀN HÓNG BAN ============ */
#leaf-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.petal {
    position: absolute;
    font-size: 2rem;
    animation: falling linear infinite;
}

@keyframes falling {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ============ CARD ============ */
.card {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 15px;
}

/* ============ FORM ============ */
.form-group {
    margin-bottom: 15px;
}

.input-tet {
    width: 100%;
    background: white;
    color: #1a1a1a;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid #ffd700;
    transition: all 0.3s ease;
}

.input-tet:focus {
    outline: none;
    border-color: #ffed4e;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.input-tet::placeholder {
    color: #999;
}

.error-message {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ BUTTON ============ */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #ffd700, #fff700);
    color: #8b0000;
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-admin-link {
    background: none;
    border: none;
    color: #ffd700;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin: 0;
    animation: glow 2s ease-in-out infinite;
    font-weight: 600;
}

.btn-admin-link:hover {
    color: #ffed4e;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.6);
    }
}

.btn-back {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #8b0000;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    padding: 12px 20px;
    font-size: 0.9rem;
}

.btn-back:hover {
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 2px solid #ffd700;
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
    padding: 10px 20px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: rgba(255, 107, 107, 0.5);
}

/* ============ DANH SÁCH ============ */
.list-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.list-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #ffd700;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.list-item-name {
    font-weight: bold;
    color: #ffd700;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.list-item-blessing {
    color: #ffe680;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 8px;
}

.list-item-amount {
    text-align: right;
    font-weight: bold;
    font-size: 1.1rem;
}

.amount-success {
    color: #4ade80;
}

.amount-fail {
    color: #ff6b6b;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #ffe680;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* ============ PHONG BÁO ============ */
.envelopes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .envelopes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.envelope {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    background: linear-gradient(135deg, #cc0000, #8b0000);
    border: 4px solid #ffd700;
    border-radius: 15px;
    cursor: pointer;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.envelope:hover:not(:disabled) {
    transform: scale(1.05) rotate(-3deg);
    box-shadow: 0 12px 25px rgba(255, 215, 0, 0.3);
}

.envelope:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.envelope.opened {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8b0000;
    transform: scale(1.1) rotate(12deg);
    animation: popEnvelope 0.6s ease-out;
}

@keyframes popEnvelope {
    0% {
        transform: scale(0.8) rotate(0deg);
    }
    50% {
        transform: scale(1.15) rotate(15deg);
    }
    100% {
        transform: scale(1.1) rotate(12deg);
    }
}

.envelope-sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkle 0.6s ease-out;
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* ============ KẾT QUẢ ============ */
.result-card {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    animation: slideUp 0.6s ease-out;
    margin-bottom: 30px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-title {
    font-size: 2rem;
    font-weight: 900;
    color: #ffd700;
    margin-bottom: 20px;
}

.result-amount {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8b0000;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.result-amount-value {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.result-amount-label {
    font-size: 1.2rem;
    font-weight: bold;
}

.result-blessing {
    color: #ffe680;
    font-size: 1.3rem;
    font-style: italic;
    margin-bottom: 30px;
    font-weight: 600;
}

.result-fail {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
    color: white;
}

/* ============ MUSIC CONTROL ============ */
.music-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    cursor: pointer;
}

.music-icon {
    width: 55px;
    height: 55px;
    border: 2px solid #ffd700;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffd700;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.music-icon:hover {
    transform: scale(1.1);
}

.music-icon.playing {
    animation: rotate 4s linear infinite;
    background: #ffd700;
    color: #8b0000;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

/* ============ SCROLL ============ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffed4e;
}

/* ============ ANIMATION ============ */
@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============ DONATE SECTION ============ */
.donate-section {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.donate-title {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.donate-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.donate-form input {
    padding: 12px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    background: white;
    color: #1a1a1a;
    font-weight: 600;
}

.donate-form button {
    padding: 12px;
    background: linear-gradient(45deg, #1d976c, #93f9b9);
    color: #053d29;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.donate-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(29, 151, 108, 0.3);
}

#qr-display {
    text-align: center;
    margin-top: 20px;
}

#qr-display img {
    max-width: 300px;
    border: 4px solid #ffd700;
    border-radius: 12px;
    background: white;
    padding: 10px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .tet-year {
        font-size: 3.5rem;
    }

    .tet-title {
        font-size: 1.8rem;
    }

    .card {
        padding: 20px;
    }

    .envelopes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .envelope {
        font-size: 2rem;
    }

    .result-amount-value {
        font-size: 2rem;
    }
}
