:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --text-color: #000000;
    --bg-color: #50ad50;
    --card-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-color: #dfe6e9;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --error-color: #d63031;
}

.dark-mode {
    --primary-color: #a29bfe;
    --secondary-color: #6c5ce7;
    --text-color: #f5f6fa;
    --bg-color: #2d3436;
    --card-color: #1e272e;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --border-color: #636e72;
    --success-color: #55efc4;
    --warning-color: #ffeaa7;
    --error-color: #ff7675;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-red-500);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.converter-container {
    background-color: var(--card-color);
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-color);
    width: 100%;
    max-width: 500px;
    padding: 25px;
    position: relative;
    overflow: hidden;
}

.converter-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe, #00b894, #fdcb6e);
    background-size: 400% 400%;
    animation: gradientBG 8s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.converter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.converter-header h1 {
    color: var(--primary-color);
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.category-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.category-tabs::-webkit-scrollbar {
    height: 5px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 5px;
}

.tab-btn {
    flex: 1;
    min-width: max-content;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-btn:hover:not(.active) {
    background-color: var(--secondary-color);
    color: white;
}

.converter-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-section, .output-section {
    display: flex;
    gap: 10px;
}

.input-section input, .output-section input {
    flex: 2;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.input-section select, .output-section select {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

.swap-btn {
    align-self: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.swap-btn:hover {
    transform: rotate(180deg);
    background-color: var(--secondary-color);
}

.converter-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.converter-footer button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s;
}

.converter-footer button:hover {
    background-color: var(--secondary-color);
    color: white;
}

.favorites-section, .history-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.favorites-section h3, .history-section h3 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.favorites-list, .history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.favorite-item, .history-item {
    background-color: var(--bg-color);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorite-item button, .history-item button {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
}

.fun-fact {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 8px;
    font-style: italic;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s;
}

.fun-fact.show {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none;
}

@media (max-width: 480px) {
    .converter-container {
        padding: 15px;
    }
    
    .converter-header h1 {
        font-size: 20px;
    }
    
    .input-section, .output-section {
        flex-direction: column;
    }
    
    .converter-footer {
        flex-direction: column;
    }
    
    .converter-footer button {
        width: 100%;
    }
}