* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, #4B0082, #8A2BE2, #9370DB); /* Nền tím gradient */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333; /* Mặc định chữ màu tối */
    overflow: hidden;
    transition: background 0.5s, color 0.5s;
}

body.dark-mode {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e); /* Nền tối gradient cho dark mode */
    color: #fff; /* Chữ màu trắng trong dark mode */
}

.container {
    background: rgba(240, 242, 245, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    max-width: 750px;
    width: 100%;
    position: relative;
    animation: fadeIn 0.5s ease-in;
}

body.dark-mode .container {
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

h1 {
    font-size: 2em;
    color: #8A2BE2; /* Màu tím */
    text-shadow: 0 0 5px rgba(138, 43, 226, 0.5);
}

h1 i {
    margin-right: 12px;
}

.subtitle {
    font-size: 1.1em;
    color: #4a4a4a; /* Màu xám đậm, dễ nhìn */
    font-weight: 500;
    margin-bottom: 15px;
    text-shadow: none;
}

body.dark-mode .subtitle {
    color: #b0b0b0;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.example code {
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 8px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    color: #BA55D3; /* Tím nhạt hơn cho code example */
    text-shadow: none;
}

body.dark-mode .example code {
    background: rgba(255, 255, 255, 0.1);
    color: #DDA0DD; /* Tím sáng hơn trong dark mode */
    text-shadow: 0 0 5px rgba(221, 160, 221, 0.5);
}

.input-group label {
    font-size: 1.2em;
    color: #9932CC; /* Tím đậm */
    text-shadow: 0 0 5px rgba(153, 50, 204, 0.5);
    margin-bottom: 10px;
    display: block;
}

.input-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

input[type="url"] {
    flex: 1;
    padding: 15px;
    border: 2px solid #9370DB; /* Tím trung bình */
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-size: 1em;
    transition: all 0.3s ease;
    animation: neonPurpleGlow 2s infinite alternate; /* Áp dụng animation mặc định */
}

body.dark-mode input[type="url"] {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: #BA55D3; /* Màu border tím trong dark mode */
    animation: neonPurpleGlowDark 2s infinite alternate; /* Animation khác cho dark mode nếu muốn hiệu ứng khác */
}

input[type="url"]:focus {
    border-color: #BA55D3; /* Tím nhạt khi focus */
    box-shadow: 0 0 15px rgba(186, 85, 211, 0.5);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    animation: none; /* Tắt animation khi focus */
}

body.dark-mode input[type="url"]:focus {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes neonPurpleGlow { /* Animation mặc định cho màu tím */
    0% {
        box-shadow: 0 0 5px #9932CC, 0 0 10px #9932CC, 0 0 20px #9932CC, 0 0 30px #BA55D3;
        border-color: #9932CC;
    }
    50% {
        box-shadow: 0 0 10px #BA55D3, 0 0 20px #BA55D3, 0 0 30px #BA55D3, 0 0 40px #9932CC;
        border-color: #BA55D3;
    }
    100% {
        box-shadow: 0 0 5px #9932CC, 0 0 10px #9932CC, 0 0 20px #9932CC, 0 0 30px #BA55D3;
        border-color: #9932CC;
    }
}

/* Có thể định nghĩa thêm animation cho dark mode nếu muốn hiệu ứng khác */
@keyframes neonPurpleGlowDark {
    0% {
        box-shadow: 0 0 5px #DDA0DD, 0 0 10px #DDA0DD, 0 0 20px #DDA0DD, 0 0 30px #BA55D3;
        border-color: #DDA0DD;
    }
    50% {
        box-shadow: 0 0 10px #BA55D3, 0 0 20px #BA55D3, 0 0 30px #BA55D3, 0 0 40px #DDA0DD;
        border-color: #BA55D3;
    }
    100% {
        box-shadow: 0 0 5px #DDA0DD, 0 0 10px #DDA0DD, 0 0 20px #DDA0DD, 0 0 30px #BA55D3;
        border-color: #DDA0DD;
    }
}


.neon-btn {
    padding: 12px;
    background: linear-gradient(45deg, #8A2BE2, #DA70D6); /* Gradient tím */
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    font-size: 1.1em;
    transition: all 0.3s ease;
    animation: neonPurpleGlow 2s infinite alternate; /* Áp dụng animation mặc định */
}

body.dark-mode .neon-btn {
    animation: neonPurpleGlowDark 2s infinite alternate; /* Animation khác cho dark mode */
}

.neon-btn:hover {
    transform: scale(1.05);
    animation: none; /* Tắt animation khi hover */
    box-shadow: 0 0 25px rgba(186, 85, 211, 0.7); /* Tím khi hover */
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #DA70D6, #8A2BE2); /* Gradient tím */
    border: none;
    border-radius: 10px;
    font-size: 1.3em;
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(186, 85, 211, 0.5); /* Tím */
    transition: all 0.3s ease;
    animation: neonPurpleGlow 2s infinite alternate; /* Áp dụng animation mặc định */
}

body.dark-mode .primary-btn {
    animation: neonPurpleGlowDark 2s infinite alternate; /* Animation khác cho dark mode */
}

.primary-btn:hover {
    background: linear-gradient(45deg, #8A2BE2, #DA70D6);
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.7); /* Tím khi hover */
    transform: translateY(-3px);
    animation: none; /* Tắt animation khi hover */
}

#resultArea {
    margin-top: 25px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#resultArea.result-visible {
    opacity: 1;
}

#resultArea h2 {
    font-size: 1.4em;
    color: #9932CC; /* Tím đậm */
    text-shadow: 0 0 10px rgba(153, 50, 204, 0.7);
    margin-bottom: 15px;
}

.output-wrapper {
    display: flex;
    gap: 15px;
}

textarea {
    flex: 1;
    padding: 15px;
    border: 2px solid #9370DB; /* Tím trung bình */
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    resize: vertical;
    transition: all 0.3s ease;
    animation: neonPurpleGlow 2s infinite alternate; /* Áp dụng animation mặc định */
}

body.dark-mode textarea {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: #BA55D3; /* Màu border tím trong dark mode */
    animation: neonPurpleGlowDark 2s infinite alternate; /* Animation khác cho dark mode */
}

textarea:focus {
    border-color: #BA55D3; /* Tím nhạt khi focus */
    box-shadow: 0 0 15px rgba(186, 85, 211, 0.5);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    animation: none; /* Tắt animation khi focus */
}

body.dark-mode textarea:focus {
    background: rgba(255, 255, 255, 0.1);
}

.warning-text {
    color: #ff4d4d;
    font-size: 0.95em;
    margin-top: 10px;
    text-shadow: 0 0 5px rgba(255, 77, 77, 0.5);
}

.footer-note {
    font-size: 0.9em;
    color: #666;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

body.dark-mode .footer-note {
    color: #b0b0b0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #9370DB; /* Tím cho icon */
    transition: all 0.3s ease;
}

body.dark-mode .icon-btn {
    color: #BA55D3; /* Tím sáng hơn trong dark mode */
}

.icon-btn:hover {
    color: #DA70D6; /* Tím khi hover */
    text-shadow: 0 0 10px rgba(218, 112, 214, 0.7);
}

.open-link-btn { /* Style cho nút mở link */
    margin-top: 15px;
    background: linear-gradient(45deg, #8A2BE2, #DA70D6);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
    display: block; /* Đảm bảo nút được hiển thị theo mặc định khi được JS kích hoạt */
    width: fit-content; /* Nút chỉ rộng bằng nội dung */
    margin-left: auto; /* Căn phải */
    margin-right: auto; /* Căn trái */
}

.open-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.7);
}