/* ==========================================================================
   #RESET & BASE STYLES
   ========================================================================== */

/**
 * 1. Use a more-intuitive box-sizing model.
 * 2. Remove default margin and padding
 * 3. Prevent font size adjustment after orientation changes in iOS
 */
*, *::before, *::after {
    box-sizing: border-box; /* 1 */
    margin: 0; /* 2 */
    padding: 0; /* 2 */
    -webkit-text-size-adjust: 100%; /* 3 */
}

/**
 * Basic styling
 */
:root {
    /* Colors */
    --color-primary: #667eea;
    --color-secondary: #764ba2;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-white: #ffffff;
    --color-error: #ef4444;
    --color-success: #10b981;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/**
 * Base styles
 */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    padding: var(--spacing-md);
}

/**
 * Typography
 */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    text-decoration: underline;
}

/**
 * Layout
 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/**
 * Card de vidro (Glassmorphism)
 */
.card-glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    margin-bottom: var(--spacing-xl);
}

/* ==========================================================================
   #FORMULÁRIO
   ========================================================================== */
.utm-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.form-label span {
    display: inline-block;
    margin-right: 8px;
}

.required-asterisk {
    color: #e53e3e;
}

/* Inputs */
.input-glass {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #1f2937;
    transition: all 0.3s ease;
    font-size: 16px;
}

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

/* Tooltip */
.tooltip-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: help;
}

.tooltip-icon {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    font-weight: normal;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
    width: 100%;
}

.btn-danger:hover {
    background-color: #c53030;
}

/* Resultado */
.result-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    display: none;
}

.result-card h2 {
    margin-bottom: 12px;
    color: #333;
}

.result-output {
    display: flex;
    align-items: center;
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

#final-url {
    flex: 1;
    word-break: break-all;
    margin-right: 12px;
}

#copy-btn {
    background: none;
    border: none;
    color: #4a5568;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

#copy-btn:hover {
    background: #edf2f7;
    color: #2d3748;
}

#copy-btn svg {
    width: 20px;
    height: 20px;
}

/* Feedback de cópia */
.feedback-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #38a169;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.feedback-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Mensagens de erro */
.error-message {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

.input-glass.is-invalid {
    border-color: #e53e3e;
}

/* Animações */
@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slide-in 0.5s ease forwards;
}

/* Texto com gradiente */
.text-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Responsividade */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2rem;
    }
    
    .main-header p {
        font-size: 1rem;
    }
    
    .utm-form {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.main-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    padding: 20px 0;
    font-size: 0.9rem;
}

.main-footer p {
    margin: 0;
}

/* Mostrar seção de resultado */
#result-section.show {
    display: block;
}

/* Efeitos de sombra */
.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Efeito de desfoque */
.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Animações */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* Decoração de fundo */
.background-decoration {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.background-decoration::before {
    content: '';
    position: absolute;
    top: -160px;
    right: -160px;
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(64px);
    animation: float 3s ease-in-out infinite;
}

.background-decoration::after {
    content: '';
    position: absolute;
    bottom: -160px;
    left: -160px;
    width: 320px;
    height: 320px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    filter: blur(64px);
    animation: float 3s ease-in-out infinite;
    animation-delay: 2s;
}

/* Animações */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Container principal */
.main-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea, #764ba2);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* Container principal do conteúdo */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Cabeçalho */
.main-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
    z-index: 10;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem 1rem;
}

.main-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.main-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Card principal */
.card-glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Formulário UTM */
.utm-form {
    display: grid;
    gap: 1.5rem;
}

/* Grupo de formulário */
.form-group {
    margin-bottom: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Rótulos e inputs */
.form-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.required-asterisk {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Tooltips */
.tooltip-container {
    position: relative;
    display: inline-flex;
    margin-left: 0.5rem;
    cursor: pointer;
}

.tooltip-icon {
    width: 1rem;
    height: 1rem;
    color: #6b7280;
    transition: color 0.2s;
}

.tooltip-container:hover .tooltip-icon {
    color: #4b5563;
}

.tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: #1f2937;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.4;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Mensagens de erro */
.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* Inputs com efeito de vidro */
.input-glass {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

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

.input-glass.is-invalid,
.input-glass.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    width: 100%;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

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

/* Resultado */
.result-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 2rem;
    display: none;
    animation: slide-in 0.3s ease-out;
}

.result-card.show {
    display: block;
}

.result-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #1f2937;
    font-size: 1.25rem;
}

.result-output {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
}

.result-output p {
    margin: 0;
    flex: 1;
    word-break: break-all;
    color: #1f2937;
}

/* Botão de copiar */
#copy-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

#copy-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

#copy-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Rodapé */
.main-footer {
    text-align: center;
    padding: 1.5rem;
    color: white;
    margin-top: 2rem;
    font-size: 0.875rem;
}

/* Toast de feedback */
.feedback-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 50;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.feedback-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   #RESPONSIVIDADE
   ========================================================================== */

/* Telas médias (tablets) */
@media (min-width: 768px) {
    .utm-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-danger {
        width: auto;
        min-width: 200px;
    }
}

/* Telas grandes (desktops) */
@media (min-width: 1024px) {
    .main-header h1 {
        font-size: 3rem;
    }
    
    .main-header p {
        font-size: 1.25rem;
    }
    
    /* Ajustes adicionais para telas grandes */
    .container {
        padding: 0 2rem;
    }
}