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

/* Variáveis CSS para tema light */
:root {
    --bg-primary: #667eea;
    --bg-secondary: #764ba2;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --main-bg: white;
    --card-bg: white;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --border-color: #e0e0e0;
    --border-focus: #667eea;
    --shadow-color: rgba(0,0,0,0.2);
    --result-card-bg: #1e1e1e;
    --result-card-text: #d4d4d4;
    --result-card-title: #4ec9b0;
    --info-card-bg: #f8f9fa;
    --btn-primary-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --btn-secondary-bg: #6c757d;
    --btn-secondary-hover: #5a6268;
    --pre-bg: #1e1e1e;
    --pre-text: #d4d4d4;
    --pre-border: #333;
    --result-pre-bg: #0d1117;
    --result-pre-text: #58a6ff;
    --result-pre-border: #30363d;
    --char-list-bg: white;
    --char-list-text: #666;
    --char-list-border: #ddd;
    --example-bg: white;
    --example-border: #667eea;
    --example-text: #667eea;
    --code-example-bg: #f8f9fa;
    --code-example-text: #333;
    --code-example-border: #dee2e6;
    --code-bg: #f0f0f0;
    --code-text: #d63384;
    --h1-color: white;
    --h2-color: #333;
    --h3-color: #555;
    --label-color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Previne flash durante carregamento */
html {
    visibility: visible;
    opacity: 1;
}

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

h1 {
    color: var(--h1-color);
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.result-card {
    background: var(--result-card-bg);
    color: var(--result-card-text);
}

.result-card h2 {
    color: var(--result-card-title);
    margin-bottom: 15px;
}

.info-card {
    background: var(--info-card-bg);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--label-color);
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    background-color: var(--main-bg);
    color: var(--text-primary);
}

.form-group input[type="number"] {
    width: 150px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: var(--code-text);
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: white;
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
    border: 2px solid var(--pre-border);
}

#result {
    background: var(--result-pre-bg);
    color: var(--result-pre-text);
    border-color: var(--result-pre-border);
}

.char-list {
    background: var(--char-list-bg);
    padding: 15px;
    border-radius: 6px;
    font-family: monospace;
    color: var(--char-list-text);
    border: 1px solid var(--char-list-border);
}

.examples {
    margin-top: 20px;
}

.example {
    margin-bottom: 25px;
    padding: 15px;
    background: var(--example-bg);
    border-radius: 8px;
    border-left: 4px solid var(--example-border);
}

.example strong {
    display: block;
    margin-bottom: 10px;
    color: var(--example-text);
}

.example pre {
    margin-top: 10px;
    font-size: 12px;
}

.code-example {
    background: var(--code-example-bg);
    color: var(--code-example-text);
    border: 1px solid var(--code-example-border);
}

h2 {
    color: var(--h2-color);
    margin-bottom: 15px;
    font-size: 1.5em;
}

h3 {
    color: var(--h3-color);
    margin-top: 20px;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 14px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .card {
        padding: 15px;
    }
    
    button {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .form-group input[type="number"] {
        width: 100%;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .theme-toggle .text {
        display: none;
    }
}

/* Botão de alternância de tema */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}

.theme-toggle .icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .icon {
    transform: rotate(180deg);
}

/* Tema Dark */
html.dark-theme,
body.dark-theme {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --main-bg: #2d2d3a;
    --card-bg: #2d2d3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --border-color: #404040;
    --border-focus: #4a9eff;
    --shadow-color: rgba(0,0,0,0.4);
    --result-card-bg: #1e1e2e;
    --result-card-text: #e0e0e0;
    --result-card-title: #4ec9b0;
    --info-card-bg: #1e1e2e;
    --btn-primary-bg: linear-gradient(135deg, #4a9eff 0%, #6b73ff 100%);
    --btn-secondary-bg: #4a5568;
    --btn-secondary-hover: #5a6268;
    --pre-bg: #1e1e2e;
    --pre-text: #e0e0e0;
    --pre-border: #404040;
    --result-pre-bg: #0d1117;
    --result-pre-text: #58a6ff;
    --result-pre-border: #30363d;
    --char-list-bg: #1e1e2e;
    --char-list-text: #b0b0b0;
    --char-list-border: #404040;
    --example-bg: #1e1e2e;
    --example-border: #4a9eff;
    --example-text: #4a9eff;
    --code-example-bg: #1e1e2e;
    --code-example-text: #e0e0e0;
    --code-example-border: #404040;
    --code-bg: #1e1e2e;
    --code-text: #ff6b9d;
    --h1-color: #f0f0f0;
    --h2-color: #f0f0f0;
    --h3-color: #f0f0f0;
    --label-color: #e0e0e0;
}

/* Inputs e selects no tema dark */
html.dark-theme input,
html.dark-theme select,
html.dark-theme textarea,
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background-color: #2d2d3a !important;
    color: #e0e0e0 !important;
    border-color: #404040 !important;
}

html.dark-theme input:focus,
html.dark-theme select:focus,
html.dark-theme textarea:focus,
body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus {
    background-color: #2d2d3a !important;
    color: #e0e0e0 !important;
    border-color: #4a9eff !important;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1) !important;
}

html.dark-theme input::placeholder,
html.dark-theme select::placeholder,
html.dark-theme textarea::placeholder,
body.dark-theme input::placeholder,
body.dark-theme select::placeholder,
body.dark-theme textarea::placeholder {
    color: #888888 !important;
}

/* Animações para feedback visual */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Indicadores de status nos botões */
.btn-secondary[style*="background-color: rgb(40, 167, 69)"],
.btn-secondary[style*="background-color: #28a745"] {
    animation: pulse 0.5s ease-in-out;
}

.btn-secondary[style*="background-color: rgb(220, 53, 69)"],
.btn-secondary[style*="background-color: #dc3545"] {
    animation: shake 0.5s ease-in-out;
}

