/* === MAIN CSS === */

/* Variáveis CSS */
:root {
    --primary-purple: #8B5CF6;
    --secondary-purple: #A78BFA;
    --dark-purple: #6D28D9;
    --accent-purple: #EC4899;
    --black: #000000;
    --white: #FFFFFF;
    --gray-light: #F8FAFC;
    --gray-medium: #64748B;
    --shadow-light: rgba(139, 92, 246, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --gradient-primary: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    --gradient-card: linear-gradient(145deg, var(--white) 0%, var(--gray-light) 100%);
}

/* Body e Container Principal */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 50%, var(--black) 100%);
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

/* Elementos de Background */
.bg-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -150px;
    background: rgba(236, 72, 153, 0.1);
}

.circle-2 {
    width: 200px;
    height: 200px;
    bottom: 100px;
    left: -100px;
    background: rgba(139, 92, 246, 0.1);
}

.circle-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 10%;
    background: rgba(167, 139, 250, 0.08);
}

/* Card Principal */
.converter-card {
    background: var(--gradient-card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 420px;
    width: 100%;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Header */
.card-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    padding-top: 20px;
}

.star-icon {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: var(--accent-purple);
    filter: drop-shadow(0 2px 4px rgba(236, 72, 153, 0.3));
}

.title {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-purple);
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(236, 72, 153, 0.2);
    line-height: 1.2;
}

.subtitle {
    font-size: 28px;
    font-weight: 800;
    color: var(--black);
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Descrição */
.description {
    margin-bottom: 32px;
}

.description p {
    font-size: 14px;
    color: var(--gray-medium);
    line-height: 1.6;
    text-align: center;
}

/* Formulário de Conversão */
.converter-section {
    margin-bottom: 32px;
}

.converter-form {
    position: relative;
    z-index: 20;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
    z-index: 25;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--black);
    background: var(--white);
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
    position: relative;
    z-index: 30;
}

.input-group input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    transform: translateY(-2px);
}

.input-group input::placeholder {
    color: var(--gray-medium);
    font-weight: 400;
}

/* Grupo de Seleção */
.select-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    position: relative;
    z-index: 25;
}

.select-wrapper {
    flex: 1;
    position: relative;
    z-index: 30;
}

.select-wrapper select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--black);
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
    box-sizing: border-box;
    position: relative;
    z-index: 35;
}

.select-wrapper select:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Botão de Troca */
.swap-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 30;
}

.swap-btn:hover {
    transform: translateY(-2px) rotate(180deg);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.swap-btn:active {
    transform: translateY(0) rotate(180deg);
}

/* Botão de Conversão */
.convert-btn {
    width: 100%;
    padding: 18px;
    background: var(--gradient-primary);
    color: var(--white);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    z-index: 25;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.2) !important;
}

/* Loading Animation */
.loading {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.loading.active {
    display: block;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Seção de Resultado */
.result-section {
    margin-bottom: 32px;
    position: relative;
    z-index: 20;
}

.result-card {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    animation: slideUp 0.5s ease-out;
}

.result-card.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-amount {
    font-size: 32px;
    font-weight: 800;
    color: var(--black);
    margin-bottom: 8px;
    font-family: 'Poppins', monospace;
}

.result-info {
    font-size: 14px;
    color: var(--gray-medium);
    margin-bottom: 8px;
}

.exchange-rate {
    font-size: 12px;
    color: var(--primary-purple);
    font-weight: 500;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 5;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-bottom {
    width: 100%;
}

.footer-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
    margin-bottom: 16px;
}

.footer-credits {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-credits p {
    color: var(--gray-light);
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-version {
    background: var(--primary-purple);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.footer-status {
    font-size: 12px;
    color: var(--gray-light);
}

.developer {
    color: var(--primary-purple);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.developer:hover {
    color: var(--accent-purple);
    text-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
}

/* Estados de validação */
.input-group input:invalid {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-group input:valid:not(:placeholder-shown) {
    border-color: #10B981;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .converter-card {
        padding: 24px;
        margin: 0;
        border-radius: 20px;
        max-width: 100%;
    }
    
    .title, .subtitle {
        font-size: 22px;
    }
    
    .description p {
        font-size: 13px;
        line-height: 1.5;
    }
    
    .input-group input,
    .select-wrapper select {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .convert-btn {
        padding: 16px;
        font-size: 15px;
        border-radius: 10px;
    }
    
    .result-amount {
        font-size: 24px;
    }
    
    .footer {
        padding: 16px;
    }
    
    .footer-credits {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-credits p {
        font-size: 13px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 12px;
    }
    
    .converter-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .title, .subtitle {
        font-size: 20px;
    }
    
    .star-icon {
        font-size: 20px;
    }
    
    .select-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .swap-btn {
        order: -1;
        align-self: center;
        transform: rotate(90deg);
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .swap-btn:hover {
        transform: rotate(270deg) translateY(-2px);
    }
    
    .result-amount {
        font-size: 22px;
    }
    
    .result-info {
        font-size: 13px;
    }
    
    .exchange-rate {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .converter-card {
        padding: 16px;
        border-radius: 14px;
    }
    
    .card-header {
        padding-top: 15px;
    }
    
    .title, .subtitle {
        font-size: 18px;
        letter-spacing: 0.5px;
    }
    
    .description {
        margin-bottom: 24px;
    }
    
    .description p {
        font-size: 12px;
    }
    
    .input-group input,
    .select-wrapper select {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    .convert-btn {
        padding: 14px;
        font-size: 14px;
    }
    
    .swap-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .result-amount {
        font-size: 20px;
    }
    
    .footer-credits p {
        font-size: 11px;
    }
    
    .footer-version {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .footer-status {
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .converter-card {
        padding: 14px;
        margin: 4px;
    }
    
    .title, .subtitle {
        font-size: 16px;
    }
    
    .input-group input,
    .select-wrapper select {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .convert-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .result-amount {
        font-size: 18px;
    }
    
    .swap-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

@media (max-width: 320px) {
    .converter-card {
        padding: 12px;
        margin: 2px;
        border-radius: 12px;
    }
    
    .title, .subtitle {
        font-size: 15px;
    }
    
    .description p {
        font-size: 11px;
    }
    
    .input-group input,
    .select-wrapper select {
        padding: 10px;
        font-size: 14px;
    }
    
    .convert-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .result-amount {
        font-size: 16px;
    }
    
    .result-info {
        font-size: 11px;
    }
    
    .exchange-rate {
        font-size: 10px;
    }
}

/* Responsividade para landscape em celulares */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 8px;
    }
    
    .converter-card {
        padding: 16px;
        max-width: 90%;
    }
    
    .title, .subtitle {
        font-size: 18px;
        margin-bottom: 2px;
    }
    
    .description {
        margin-bottom: 16px;
    }
    
    .converter-section {
        margin-bottom: 16px;
    }
    
    .result-section {
        margin-bottom: 16px;
    }
    
    .footer {
        padding: 8px;
    }
}

/* Estados de hover melhorados */
@media (hover: hover) {
    .input-group input:hover {
        border-color: var(--secondary-purple);
    }
    
    .select-wrapper select:hover {
        border-color: var(--secondary-purple);
    }
    
    .result-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
    }
}

/* Animações de entrada */
.converter-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}