body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.navbar {
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

    .navbar.scrolled {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

.form-section {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 900px;
    margin: auto;
    transition: transform 0.3s ease;
}

    .form-section:hover {
        transform: translateY(-5px);
    }

.card-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

    .card-input-row input,
    #set-name {
        border: 3px solid #b3b3b3;
        border-radius: 0.5rem;
        padding: 0.75rem;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
        font-size: 1rem;
    }

    .card-input-row .word-input {
        flex: 2;
        min-width: 150px;
    }

    .card-input-row .definition-input {
        flex: 1;
        min-width: 100px;
    }

    .card-input-row .translation-input {
        flex: 2;
        min-width: 150px;
    }

    .card-input-row input:hover,
    #set-name:hover {
        border-color: #6b7280;
    }

    .card-input-row input:focus,
    #set-name:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        outline: none;
    }

    .card-input-row input.error,
    #set-name.error {
        border-color: #dc2626 !important;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
        animation: shake 0.3s ease;
    }

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.btn {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: #6366f1;
}

    .btn-primary:hover {
        background: #4f46e5;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    }

.btn-danger {
    background: #ef4444;
    padding: 0.75rem;
    min-width: 40px;
}

    .btn-danger:hover {
        background: #b91c1c;
        transform: translateY(-2px);
    }

.btn-success {
    background: #22c55e;
}

    .btn-success:hover {
        background: #16a34a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    }

.btn-download {
    background: #f59e0b;
}

    .btn-download:hover {
        background: #d97706;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    }

.btn-upload {
    background: #10b981;
}

    .btn-upload:hover {
        background: #059669;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    }

.form-select {
    border: 3px solid #b3b3b3;
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: border-color 0.3s ease;
}

    .form-select:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        outline: none;
    }

.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: none;
    font-size: 0.95rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

    .popup-overlay.active {
        opacity: 1;
        visibility: visible;
    }

.popup-content {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 2.5rem 2rem 2rem 2rem; /* Tăng padding-top để tạo khoảng cách cho header */
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.popup-overlay.active .popup-content {
    transform: translateY(0);
}

.popup-close {
    position: sticky;
    top: 0rem; /* Giảm top một chút nhưng kết hợp với padding-top của popup-content */
    right: 0.75rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

    .popup-close:hover {
        background: #b91c1c;
    }

.file-input {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-section {
        padding: 1.5rem;
        max-width: 100%;
    }

    .card-input-row {
        flex-direction: column;
        align-items: stretch;
        background: #ffffff;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

        .card-input-row input,
        #set-name {
            width: 100%;
            margin-bottom: 0.75rem;
            font-size: 0.9rem;
            padding: 0.6rem;
            position: relative;
        }

        .card-input-row .word-input {
            border-color: #6366f1;
            background: rgba(99, 102, 241, 0.05);
        }

            .card-input-row .word-input::before {
                content: 'Từ vựng';
                position: absolute;
                top: -1.5rem;
                left: 0;
                font-size: 0.8rem;
                color: #4b5563;
                font-weight: 500;
            }

        .card-input-row .definition-input {
            border-color: #10b981;
            background: rgba(16, 185, 129, 0.05);
        }

            .card-input-row .definition-input::before {
                content: 'Phân loại';
                position: absolute;
                top: -1.5rem;
                left: 0;
                font-size: 0.8rem;
                color: #4b5563;
                font-weight: 500;
            }

        .card-input-row .translation-input {
            border-color: #f59e0b;
            background: rgba(245, 158, 11, 0.05);
        }

            .card-input-row .translation-input::before {
                content: 'Dịch nghĩa';
                position: absolute;
                top: -1.5rem;
                left: 0;
                font-size: 0.8rem;
                color: #4b5563;
                font-weight: 500;
            }

        .card-input-row .word-input,
        .card-input-row .definition-input,
        .card-input-row .translation-input {
            flex: none;
            min-width: 0;
        }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        width: 100%;
        margin-bottom: 0.5rem;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .btn-danger {
        min-width: 36px;
        padding: 0.6rem;
        margin: 0 auto;
    }

    .flex.space-x-4 {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .popup-content {
        padding: 1.5rem;
        max-width: 90%;
        max-height: 90vh;
    }

        .popup-content table {
            font-size: 0.85rem;
        }

    h2.text-2xl {
        font-size: 1.5rem;
    }

    h3.text-lg {
        font-size: 1.25rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .form-section {
        max-width: 700px;
    }

    .card-input-row input,
    #set-name {
        font-size: 0.95rem;
        padding: 0.65rem;
    }

    .card-input-row .word-input {
        flex: 1.8;
    }

    .card-input-row .definition-input {
        flex: 0.8;
    }

    .card-input-row .translation-input {
        flex: 1.8;
    }

    .btn {
        padding: 0.65rem 1.3rem;
        font-size: 0.95rem;
    }

    .popup-content {
        max-height: 85vh;
    }
}
