* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff7675 0%, #fd79a8 100%);
    min-height: 100vh;
    color: #333;
}

header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0.5rem 0;
}

header h1 a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    margin-right: 1rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

header h1 a:hover {
    opacity: 1;
}

.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.converter-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.converter-card h2 {
    color: #333;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 500;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
}

.category-tab {
    background: none;
    border: 2px solid #e0e6ed;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-tab:hover {
    background: #f8f9fa;
    border-color: #ff7675;
    color: #ff7675;
}

.category-tab.active {
    background: linear-gradient(135deg, #ff7675, #fd79a8);
    color: white;
    border-color: #ff7675;
}

.conversion-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

.converter-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.input-group,
.unit-group {
    display: flex;
    flex-direction: column;
}

.input-group label,
.unit-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

.input-group input,
.unit-group select {
    padding: 0.8rem;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-group input:focus,
.unit-group select:focus {
    outline: none;
    border-color: #ff7675;
    box-shadow: 0 0 0 3px rgba(255, 118, 117, 0.1);
}

#to-value {
    background: #e8f5e8;
    font-weight: 600;
    color: #2d3436;
}

.conversion-arrow {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

#swap-units {
    background: linear-gradient(135deg, #ff7675, #fd79a8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.3);
}

#swap-units:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 118, 117, 0.4);
}

.quick-conversions {
    margin: 2rem 0;
}

.quick-conversions h3 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.quick-btn {
    background: white;
    border: 2px solid #ff7675;
    color: #ff7675;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.quick-btn:hover {
    background: #ff7675;
    color: white;
    transform: translateY(-2px);
}

.conversion-history {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.conversion-history h3 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

.history-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-outline {
    background: transparent;
    color: #ff7675;
    border: 2px solid #ff7675;
}

.btn-outline:hover {
    background: #ff7675;
    color: white;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    background: white;
    padding: 0.8rem;
    border-radius: 8px;
    border-left: 4px solid #ff7675;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-item:hover {
    background: #f1f2f6;
    transform: translateX(5px);
}

.history-item .conversion-time {
    font-size: 0.8rem;
    color: #666;
    float: right;
}

.formula-section {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: center;
}

.formula-section h3 {
    margin-bottom: 1rem;
}

.formula-display {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
}

.formula-display .formula {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.formula-display .explanation {
    font-size: 0.9rem;
    opacity: 0.9;
}

.empty-state {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.converter-row {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 1rem;
    }
    
    .converter-card {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .category-tabs {
        justify-content: center;
    }
    
    .category-tab {
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
    }
    
    .converter-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .conversion-arrow {
        order: -1;
        margin: 0.5rem 0;
    }
    
    #swap-units {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .quick-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .quick-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .history-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .converter-card {
        padding: 1rem;
    }
    
    .conversion-section {
        padding: 1rem;
    }
    
    .category-tab {
        flex: 1;
        text-align: center;
        min-width: 60px;
    }
    
    .history-item {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #swap-units:hover {
        transform: scale(1.1);
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    }
    
    .converter-card {
        background: #2d3436;
        color: white;
    }
    
    .conversion-section,
    .conversion-history {
        background: #636e72;
    }
    
    .input-group input,
    .unit-group select {
        background: #2d3436;
        border-color: #636e72;
        color: white;
    }
    
    #to-value {
        background: #00b894;
        color: white;
    }
    
    .history-item {
        background: #2d3436;
        color: white;
    }
    
    .category-tab {
        border-color: #636e72;
        color: #ddd;
    }
    
    .category-tab:hover {
        background: #636e72;
        color: white;
    }
}
