* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #1a472a 100%);
    min-height: 100vh;
    position: relative;
    padding: 20px;
    overflow-x: hidden;
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.4s ease;
    position: relative;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #c41e3a;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: #a01729;
    transform: rotate(90deg);
}

.modal-title {
    color: #c41e3a;
    font-size: 2em;
    margin-bottom: 20px;
    font-weight: bold;
}

.modal-message {
    color: #2d5a3d;
    font-size: 1.1em;
    line-height: 1.8;
    margin-bottom: 25px;
}

.modal-message p {
    margin: 10px 0;
}

.qr-container {
    margin: 20px 0;
}

.qr-container img {
    max-width: 200px;
    border: 3px solid #c41e3a;
    border-radius: 10px;
    padding: 10px;
    background: white;
}

.qr-label {
    color: #2d5a3d;
    font-weight: 600;
    margin-top: 10px;
    font-size: 1em;
}

.modal-button {
    background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.modal-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.4);
}

/* Background Music Control */
.music-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 18px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s;
}

.music-control:hover {
    transform: scale(1.1);
    background: white;
}

.music-control i {
    color: #c41e3a;
    font-size: 20px;
}

/* Snowflakes Animation */
.snowflake {
    position: fixed;
    top: -10px;
    z-index: 9999;
    color: white;
    font-size: 1em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Christmas Lights */
.christmas-lights {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    justify-content: space-around;
    z-index: 1000;
    pointer-events: none;
}

.light {
    width: 10px;
    height: 20px;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.light:nth-child(odd) {
    background: #ff0000;
    box-shadow: 0 0 20px #ff0000;
}

.light:nth-child(even) {
    background: #00ff00;
    box-shadow: 0 0 20px #00ff00;
    animation-delay: 0.75s;
}

.light:nth-child(3n) {
    background: #ffff00;
    box-shadow: 0 0 20px #ffff00;
    animation-delay: 0.4s;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 60px auto 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    position: relative;
}

.container::before,
.container::after {
    position: absolute;
    font-size: 3em;
}

.container::before {
    content: "🎄";
    top: -20px;
    left: -20px;
    animation: rotate 3s ease-in-out infinite;
}

.container::after {
    content: "🎅";
    top: -20px;
    right: -20px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes rotate {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(15deg);
    }
}

@keyframes wave {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

h1 {
    text-align: center;
    color: #c41e3a;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
}

h1::before {
    content: "🎁 ";
}

h1::after {
    content: " ⛄";
}

.subtitle {
    text-align: center;
    color: #2d5a3d;
    font-size: 1.2em;
    margin-bottom: 30px;
    font-style: italic;
}

/* Header */
.simple-header {
    position: fixed;
    top: 72px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.copyright {
    font-size: 18px;
    color: #c41e3a;
    font-weight: 600;
}

.social-icons {
    display: flex;
    gap: 10px;
}

.social-icons a {
    color: #2d5a3d;
    font-size: 20px;
    transition: all 0.3s;
    text-decoration: none;
}

.social-icons a:hover {
    color: #c41e3a;
    transform: scale(1.2);
}

/* Form Container */
.form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fff 0%, #f0f8ff 100%);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.2);
    position: relative;
    border: 3px solid #c41e3a;
    transition: all 0.3s ease;
}

.form-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(196, 30, 58, 0.3);
}

.form-group {
    flex: 1;
    min-width: 140px;
    text-align: center;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #2d5a3d;
    font-weight: 600;
    font-size: 0.95em;
}

input {
    width: 100%;
    padding: 12px;
    border: 2px solid #c41e3a;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    text-align: center;
    background: white;
}

input:focus {
    outline: none;
    border-color: #2d5a3d;
    box-shadow: 0 0 10px rgba(45, 90, 61, 0.3);
    transform: scale(1.05);
}

input[readonly] {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe6e6 100%);
    font-weight: 600;
    color: #c41e3a;
}

.result input {
    color: #2d5a3d;
    font-size: 1.1em;
}

.grade4 input {
    color: #c41e3a;
    font-size: 1.1em;
}

.gradeLetter input {
    color: #d4af37;
    font-size: 1.1em;
}

/* Buttons */
button {
    display: block;
    margin: 20px auto;
    padding: 15px 35px;
    background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 30px rgba(196, 30, 58, 0.5);
}

#exportCsvBtn {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    box-shadow: 0 5px 20px rgba(45, 90, 61, 0.3);
}

#exportCsvBtn:hover {
    box-shadow: 0 8px 30px rgba(45, 90, 61, 0.5);
}

.delete-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    background: #c41e3a;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.delete-btn:hover {
    background: #a01729;
    transform: rotate(90deg) scale(1.1);
}

/* Summary Table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.summary-table th {
    background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 1.1em;
}

.summary-table td {
    padding: 15px;
    text-align: center;
    color: #2d5a3d;
    font-weight: 600;
    font-size: 1.1em;
    border-top: 2px solid #f0f0f0;
}

/* Notes Section */
.notes {
    margin: 30px 0;
    padding: 25px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border: 3px solid #2d5a3d;
}

.notes h2 {
    text-align: center;
    color: #c41e3a;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.notes h2::before {
    content: "📚 ";
}

.notes h2::after {
    content: " 🎓";
}

/* Calculation Section */
.calculation-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.calculation-title {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
}

.formula-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #c41e3a;
}

.formula-box h3 {
    color: #c41e3a;
    margin-bottom: 10px;
    font-size: 1em;
}

.formula-box p {
    color: #2d5a3d;
    line-height: 1.6;
    font-size: 0.95em;
    margin: 5px 0;
}

/* Conversion Table */
.conversion-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.conversion-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.conversion-table thead {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
}

.conversion-table th {
    color: white;
    padding: 12px 8px;
    font-weight: 600;
    font-size: 0.9em;
    text-align: center;
}

.conversion-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #2d5a3d;
}

.conversion-table tbody tr:hover {
    background: #f0f8ff;
}

/* Video Container */
.video-container {
    margin: 30px 0;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5em;
        word-break: break-word;
    }

    .subtitle {
        font-size: 1em;
    }

    .simple-header {
        position: static;
        margin-top: 20px;
        margin-bottom: 20px;
        justify-content: center;
        width: 100%;
    }

    .container {
        padding: 20px 15px;
        margin-top: 20px;
    }

    .form-container {
        padding: 15px;
    }

    .form-group {
        min-width: 120px;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .modal-title {
        font-size: 1.5em;
    }

    .modal-message {
        font-size: 1em;
    }

    .conversion-section {
        margin: 0 -15px;
        padding: 0 15px;
    }

    .music-control {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
    }
}

/* Donate Marquee Styles */
.donate-marquee {
    width: 100%;
    background: linear-gradient(90deg, #8b0000 0%, #c41e3a 50%, #8b0000 100%);
    /* Màu đỏ Giáng sinh đậm */
    color: #fff;
    padding: 8px 0;
    overflow: hidden;
    position: relative;
    z-index: 900;
    /* Thấp hơn Modal nhưng cao hơn nền */
    border-bottom: 2px solid #d4af37;
    /* Viền vàng sang trọng */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
}

.marquee-content {
    display: inline-block;
    white-space: nowrap;
    animation: scroll-left 25s linear infinite;
    /* Tốc độ chạy chữ */
    padding-left: 100%;
    /* Bắt đầu từ ngoài màn hình bên phải */
}

.marquee-content span {
    font-size: 16px;
    font-weight: 600;
    vertical-align: middle;
}

.donor {
    color: #ffd700;
    /* Tên người donate màu vàng kim */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.separator {
    margin: 0 15px;
    color: #fff;
    font-size: 1.2em;
}

/* Hiệu ứng chạy chữ */
@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Mobile responsive cho marquee */
@media (max-width: 768px) {
    .donate-marquee {
        padding: 6px 0;
    }

    .marquee-content span {
        font-size: 14px;
    }
}