:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --dark-color: #2b2d42;
    --light-color: #f8f9fa;
    --success-color: #4cc9f0;
    --error-color: #f72585;
    --border-radius: 12px;
    --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7ff;
    color: var(--dark-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
    margin-bottom: 20px;
}

.converter-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

@media (max-width: 600px) {
    .input-row {
        flex-direction: column;
        align-items: stretch;
    }
}

.input-field {
    flex: 1;
    position: relative;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-color);
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

input {
    padding-right: 40px;
}

.unit-icon {
    position: absolute;
    right: 15px;
    top: 38px;
    color: #666;
    font-size: 0.9rem;
}

.swap-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    align-self: center;
}

.swap-btn:hover {
    background: var(--secondary-color);
    transform: rotate(180deg);
}

.swap-btn i {
    font-size: 1.2rem;
}

.result-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.result-title {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.conversion-history {
    margin-top: 30px;
}

.history-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--dark-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-history {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 0.9rem;
}

.history-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.history-item:last-child {
    border-bottom: none;
}

.history-conversion {
    font-weight: 500;
}

.history-value {
    color: var(--primary-color);
}

.history-date {
    font-size: 0.8rem;
    color: #999;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-secondary {
    background: #e9ecef;
    color: var(--dark-color);
}

.btn-secondary:hover {
    background: #dee2e6;
}

.favorites-container {
    margin-top: 30px;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.favorite-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.favorite-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.favorite-value {
    font-weight: 600;
    color: var(--primary-color);
}

.favorite-conversion {
    font-size: 0.8rem;
    color: #666;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    position: relative;
}

.tab.active {
    color: var(--primary-color);
    font-weight: 500;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}