:root {
    --primary-color: #4f46e5;
    --secondary-color: #818cf8;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --container-bg: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --success-color: #10b981;
    --error-color: #ef4444;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.dark-theme {
    --primary-color: #818cf8;
    --secondary-color: #6366f1;
    --text-color: #f9fafb;
    --bg-color: #111827;
    --container-bg: #1f2937;
    --border-color: #374151;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.main-nav .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.main-nav .logo i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a.active {
    color: var(--primary-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--container-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.centered-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.simple-description {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.4;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.compact-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background-color: var(--container-bg);
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px var(--shadow-color);
    margin-bottom: 2rem;
}

.editor-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
}

.output-container {
    width: 40%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.output-field {
    width: 100%;
    flex-grow: 1;
    min-height: 150px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    overflow: auto;
    padding: 1rem;
}

.control-panel {
    width: 55%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

textarea {
    width: 100%;
    flex-grow: 1;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    resize: vertical;
}

#output {
    font-weight: 500;
    position: relative;
}

.output-container::after {
    content: attr(data-value);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 50px;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.three-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.three-columns .control-group {
    min-width: 100px;
}

.three-columns input,
.three-columns select {
    width: 100%;
    min-width: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.letter-type {
    flex-grow: 1;
    width: 100%;
}

.checkbox-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.alphabet-selection {
    width: 100%;
}

.alphabet-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

select,
input[type="number"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    width: 100%;
    cursor: pointer;
    outline: none;
}

select:focus,
input[type="number"]:focus {
    outline: 2px solid var(--primary-color);
    border-color: var(--primary-color);
}

.dark-theme select,
.dark-theme input[type="number"] {
    background-color: var(--container-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.output-container .button-group {
    justify-content: flex-start;
}

.control-group label {
    font-weight: 500;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--secondary-color);
}

.secondary-btn {
    background-color: var(--container-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: var(--border-color);
}

footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .editor-layout {
        flex-direction: column;
    }
    
    .control-panel,
    .output-container {
        width: 100%;
    }
    
    .control-row {
        flex-direction: column;
    }
    
    .three-columns {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .compact-editor-container {
        flex-direction: column;
    }
    
    textarea {
        max-height: 200px;
    }
    
    .control-panel {
        width: 55%;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 5px 15px var(--shadow-color);
    position: relative;
}

.modal h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.modal p {
    margin-bottom: 1.5rem;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.close:hover {
    color: var(--error-color);
}

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

.container {
    animation: fadeIn 0.5s ease-in-out;
}

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.info-section {
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.info-section h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.info-content {
    color: var(--text-color);
}

.info-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.info-content ul {
    list-style-type: disc;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.info-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.faq-item {
    margin-bottom: 1.5rem;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .info-section {
        padding: 1rem;
    }
    
    .info-section h2 {
        font-size: 1.3rem;
    }
    
    .faq-item h3 {
        font-size: 1rem;
    }
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.dropdown-trigger i {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-trigger i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-menu a:hover {
    background-color: var(--border-color);
}

.dropdown-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        box-shadow: none;
        padding: 0;
        margin-top: 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .nav-links.active .dropdown-menu {
        display: block;
    }
}

.dropdown-trigger.active {
    color: var(--text-color);
}

.dark-theme .dropdown-menu {
    background-color: rgba(47, 55, 70, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-menu a {
    background-color: transparent;
    transition: background-color 0.2s ease;
}

.dark-theme .dropdown-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dropdown-menu a.active {
    font-weight: normal;
}

.nav-links a.active {
    color: var(--text-color);
}

.nav-links a.active::after {
    display: none;
}

@media (max-width: 768px) {
    .dropdown-menu a:hover, 
    .dark-theme .dropdown-menu a:hover {
        background-color: transparent;
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1100;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--error-color);
}

.toast.info {
    background-color: var(--primary-color);
}

#palette-output {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    min-height: 250px;
    justify-content: stretch;
}

.color-box {
    flex-grow: 1;
    width: 100%;
    min-height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.color-box:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    z-index: 10;
}

.color-code {
    font-weight: 500;
    font-size: 1rem;
    background-color: rgba(0,0,0,0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    pointer-events: none;
}

#color-controls {
    width: 30%;
}

#palette-output {
   flex-grow: 1;
}

@media (max-width: 768px) {
     #palette-output {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
     .color-box {
        min-width: 120px;
        height: 120px;
    }
    
    #color-controls {
        width: 100%;
    }
}