/* Variáveis de Tema (Baseado no GitHub Dark Mode) */
:root {
    --bg-main: #0b0e14;
    --bg-panel: #161b22;
    --bg-input: #0d1117;
    --border-color: #30363d;
    --text-main: #e0e0e0;
    --text-muted: #8b949e;
    --accent-green: #238636;
    --accent-green-hover: #2ea043;
    --accent-blue: #58a6ff;
    --accent-red: #da3633;
    --accent-red-hover: #f85149;
    --success-text: #7ee787;
    --error-text: #ff7b72;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Modais */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 14, 20, 0.9);
    backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 340px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    box-sizing: border-box;
}

.modal-content h2 {
    margin-top: 0;
    text-align: center;
    color: var(--text-main);
}

/* Formulários e Inputs */
input {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.95rem;
}

input:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* Botões */
button {
    width: 100%;
    padding: 14px;
    margin-top: 15px;
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover:not(:disabled) {
    background: var(--accent-green-hover);
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.secondary-btn {
    background: transparent;
    color: var(--accent-blue);
    margin-top: 5px;
    font-size: 0.9rem;
    padding: 10px;
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.1);
    text-decoration: underline;
}

.error-msg {
    color: var(--error-text);
    font-size: 0.85rem;
    min-height: 20px;
    margin: 5px 0;
    text-align: center;
}

/* Área do Editor */
.container {
    width: 90%;
    max-width: 850px;
    margin-top: 5vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.logo-area {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.logo-area h1 {
    margin: 0;
    font-size: 1.5rem;
}

#display-username { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#status { 
    font-size: 0.8rem; 
    color: var(--success-text); 
    transition: color 0.3s ease;
}

#btn-logout { 
    width: auto; 
    padding: 8px 16px; 
    margin: 0;
    background: var(--accent-red); 
    font-size: 0.85rem; 
}

#btn-logout:hover {
    background: var(--accent-red-hover);
}

#editor {
    flex-grow: 1;
    min-height: 60vh;
    margin-top: 30px;
    outline: none;
    line-height: 1.8;
    font-size: 1.15rem;
    color: #c9d1d9;
    padding-bottom: 50px;
}

[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #484f58;
    pointer-events: none;
}

/* Info e Links */
.auth-info {
    margin-top: 20px;
    font-size: 0.85rem;
    text-align: center;
}

.auth-info hr { 
    border: 0; 
    border-top: 1px solid var(--border-color); 
    margin: 20px 0; 
}

.auth-info a { 
    color: var(--accent-blue); 
    text-decoration: none; 
    transition: color 0.2s;
}

.auth-info a:hover {
    text-decoration: underline;
    color: #79c0ff;
}

.info-box {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
}

.info-box h3 { color: var(--success-text); margin-top: 10px; }

.info-box p, .info-box li { 
    font-size: 0.95rem; 
    line-height: 1.6; 
    color: var(--text-muted); 
    margin-bottom: 10px;
}

.close {
    float: right;
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--error-text);
    line-height: 1;
    transition: transform 0.2s;
}

.close:hover {
    transform: scale(1.2);
}

/* Custom Scrollbar para o Editor e Modais */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* Responsividade Mobile */
@media (max-width: 600px) {
    .modal-content { padding: 30px 20px; }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .controls {
        width: 100%;
        justify-content: space-between;
    }
    
    #editor { font-size: 1.05rem; }
}