/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Otimizações de performance */
html {
    scroll-behavior: smooth;
}

*,
*::before,
*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: no-preference) {
    * {
        animation-duration: revert !important;
        animation-iteration-count: revert !important;
        transition-duration: revert !important;
        scroll-behavior: revert !important;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-description {
    font-size: 1.2rem;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Main content */
main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    margin-top: 20px;
}

/* Dimension selector */
.dimension-selector {
    margin-bottom: 30px;
}

.dimension-selector h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #555;
    font-size: 1.3rem;
}

.dimension-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.dimension-btn {
    background: #f8f9fa;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.dimension-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.dimension-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Conversion area */
.conversion-area {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
}

.conversion-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.conversion-row:last-child {
    margin-bottom: 0;
}

.input-group, .result-group, .unit-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

input, select {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[readonly] {
    background: #ffffff;
    font-weight: 600;
    color: #667eea;
}

/* Conversion arrow */
.conversion-arrow {
    text-align: center;
    font-size: 2rem;
    margin: 10px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px auto;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.conversion-arrow:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.conversion-arrow:active {
    transform: rotate(180deg) scale(0.95);
}



/* Info display */
.info-display {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Examples section */
.examples-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #f0f0f0;
}

.examples-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #555;
}

.examples-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.example-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    font-style: italic;
    color: #666;
}

/* Estilos para elementos dinâmicos */
.conversion-info, .units-info {
    text-align: left;
}

.conversion-info h4, .units-info h4 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.unit-details {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unit-detail, .unit-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    flex-wrap: wrap;
}

.unit-emoji {
    font-size: 1.5rem;
    min-width: 30px;
}

.unit-description {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

.unit-info-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin: 15px 0;
}

.conversion-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 20px;
}

.conversion-divider::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.5) 20%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0.5) 80%, transparent 100%);
    border-radius: 1px;
}

/* Responsividade para unit-info-grid */
@media (max-width: 600px) {
    .unit-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .conversion-divider {
        order: 2;
        margin: 10px 0;
        height: 1px;
        width: 50px;
        align-self: center;
    }
    
    .conversion-divider::before {
        width: 100%;
        height: 1px;
        background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.5) 20%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0.5) 80%, transparent 100%);
    }
    
    .unit-info-item:first-child {
        order: 1;
    }
    
    .unit-info-item:last-child {
        order: 3;
    }
}

.fun-facts {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    border-left: 3px solid #ffd700;
}

.fun-facts h5 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.fun-facts p {
    color: rgba(255,255,255,0.95);
    font-size: 0.9rem;
    margin: 0;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    main {
        padding: 20px;
        margin-top: 15px;
    }
    
    .dimension-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .dimension-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .conversion-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .examples-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .conversion-area {
        padding: 15px;
    }
    
    input, select {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .unit-info-item {
        padding: 10px;
        gap: 8px;
    }
    
    .unit-emoji {
        font-size: 1.3rem;
        min-width: 25px;
    }
    
    .unit-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }
}
