/* Root: Define reusable CSS variables */
:root {
    --primary-color: #4CAF50;
    --primary-color-hover: #45a049;
    --border-color: #ddd;
    --font-color: #555;
    --bg-overlay: rgba(0, 0, 0, 0.8);
    --padding-small: 8px;
    --padding-medium: 10px;
    --padding-large: 12px;
    --font-size-small: 14px;
    --font-size-medium: 16px;
    --font-size-large: 20px;
    --gap-small: 8px;
    --gap-medium: 10px;
}

/* General Reset */
body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

h1 {
    text-align: center;
}

input {
    display: block;
    width: 50%;
    margin: 10px auto;
    padding: var(--padding-medium);
    font-size: var(--font-size-medium);
}

ul {
    list-style: none;
    padding: 0;
    width: 50%;
    margin: 20px auto;
}

button {
    padding: var(--padding-small) calc(var(--padding-small) * 2);
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-small);
    border-radius: 5px;
}

button:hover {
    background-color: var(--primary-color-hover);
}

/* Help Button */
.help-button {
    margin: 10px auto;
    display: block;
}

/* Help Overlay */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.help-content {
    background: #fff;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    line-height: 1.6;
}

.help-content h2 {
    margin-top: 0;
}

.help-content ul {
    padding: 0 20px;
    width: 90%;
}

.help-content li {
    margin-bottom: 10px;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    color: #333;
    cursor: pointer;
}

.close-button:hover {
    color: red;
}

code {
    font-family: inherit; /* Match the parent font family */
    font-size: inherit; /* Match the parent font size */
    background-color: #f5f5f5; /* Optional: light gray background for visibility */
    padding: 2px 4px; /* Optional: small padding for better readability */
    border-radius: 3px; /* Optional: rounded corners for a cleaner look */
}

/* List Item: Flexbox Layout for Unicode Items */
.unicode-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-medium); /* Consistent gap between columns */
    padding: var(--padding-small) var(--padding-medium);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-medium);
}

/* Columns within the list item */
.unicode-char {
    flex: 0 0 5ch; /* Compact spacing for character column */
    font-size: var(--font-size-large);
    text-align: center;
}

.unicode-code {
    flex: 0 0 12ch; /* Enough space for Unicode code */
    color: var(--font-color);
    text-align: left;
}

.unicode-name {
    flex: 1; /* Take up remaining space */
    text-transform: lowercase;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.copy-btn {
    flex: 0 0 auto; /* Do not allow shrinking */
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 5px 8px;
    font-size: var(--font-size-small);
    border-radius: 5px;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: var(--primary-color-hover);
}

.hidden {
    display: none;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    ul {
        width: 80%;
    }

    .unicode-item {
        gap: var(--gap-small); /* Smaller spacing for tighter layout */
        font-size: var(--font-size-small);
    }

    .unicode-char {
        flex: 0 0 6ch; /* Adjust column width */
        font-size: var(--font-size-medium);
    }

    .unicode-code {
        flex: 0 0 10ch; /* Adjust width */
    }

    .unicode-name {
        font-size: var(--font-size-small);
    }
}

@media (max-width: 768px) {
    ul {
        width: 90%;
    }

    .unicode-item {
        gap: var(--gap-small);
        padding: var(--padding-small);
        font-size: var(--font-size-small);
    }

    .unicode-char {
        flex: 0 0 4ch;
        font-size: var(--font-size-small);
    }

    .unicode-code {
        flex: 0 0 8ch;
        font-size: var(--font-size-small);
    }

    .copy-btn {
        padding: 3px 6px;
        font-size: var(--font-size-small);
    }
}

/* Mobile-Specific Adjustments (for screens < 480px) */
@media (max-width: 480px) {
    h1 {
        font-size: var(--font-size-medium); /* Slightly smaller title */
    }

    input {
        width: 100%;
        font-size: var(--font-size-small);
        padding: var(--padding-small);
    }

    ul {
        width: 100%;
    }

    .unicode-item {
        gap: var(--gap-small);
        font-size: var(--font-size-small);
        padding: var(--padding-small);
    }

    .unicode-char {
        flex: 0 0 4ch;
        font-size: var(--font-size-small);
    }

    .unicode-code, .unicode-name, .copy-btn {
        flex: 1 1 100%; /* Stack all elements vertically */
        text-align: center;
    }

    .copy-btn {
        padding: 3px 5px;
        font-size: var(--font-size-small);
    }
}
