/* ========================================
   LEADS DOS MLK - Database Manager CSS
   Design Premium e Profissional
   ======================================== */

/* ===== RESET E BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== BODY E BACKGROUND ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #e8eaed;
    padding: 20px;
    line-height: 1.6;
}

/* ===== CONTAINER PRINCIPAL ===== */
#content {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== HEADERS GERAIS ===== */
h1, h2, h3, #h1 {
    color: #e8eaed;
    font-weight: 600;
    margin: 20px 0 15px 0;
}

h2, h3 {
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

/* ===== LINKS GERAIS ===== */
a {
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: #764ba2;
}

/* ===== MENSAGENS E ALERTAS ===== */
.error, .message {
    padding: 12px 18px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    font-size: 0.9rem;
}

.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.message {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* ========================================
   PÁGINA DE LOGIN (body#login)
   ======================================== */

body#login #menu {
    display: none !important;
}

body#login {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body#login #content {
    max-width: 480px;
    width: 100%;
    padding: 50px 40px;
}

/* Logo "LEADS DOS MLK" */
body#login #content::before {
    content: 'LEADS DOS MLK';
    display: block;
    text-align: center;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 15px rgba(102, 126, 234, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(118, 75, 162, 0.8)); }
}

/* Subtítulo */
body#login #content::after {
    content: 'Database Management System';
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

/* Formulário de Login - Layout Vertical */
body#login form table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border: none;
}

body#login form table tr {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

body#login form table th {
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body#login form table td {
    padding: 0;
    border: none;
    width: 100%;
}

/* Inputs na página de login */
body#login input[type="text"],
body#login input[type="password"],
body#login select {
    width: 100% !important;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px;
    color: #ffffff !important;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

body#login input[type="text"]:focus,
body#login input[type="password"]:focus,
body#login select:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15) !important;
}

body#login select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 18px !important;
    padding-right: 45px !important;
}

body#login select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* Botão de Login */
body#login input[type="submit"] {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 10px;
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    margin-top: 10px;
}

body#login input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

body#login input[type="submit"]:active {
    transform: translateY(0);
}

body#login fieldset {
    border: none;
    padding: 0;
}

body#login legend {
    display: none;
}

/* ========================================
   INTERFACE PRINCIPAL (após login)
   ======================================== */

/* Menu de Navegação */
#menu {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#menu a {
    color: #e8eaed;
    padding: 8px 16px;
    border-radius: 6px;
    margin-right: 8px;
    display: inline-block;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#menu a:hover {
    background: rgba(102, 126, 234, 0.2);
    text-decoration: none;
}

#menu a.active {
    background: rgba(102, 126, 234, 0.3);
    color: #ffffff;
}

/* Sidebar de Databases */
#dbs {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Fieldsets e Legends */
fieldset {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.02);
}

legend {
    color: #667eea;
    font-weight: 600;
    font-size: 1rem;
    padding: 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabelas de Dados - Layout Tabular Normal */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

thead {
    background: rgba(102, 126, 234, 0.15);
}

th {
    background: rgba(102, 126, 234, 0.2);
    color: #ffffff;
    font-weight: 600;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

td {
    padding: 10px 15px;
    color: #e8eaed;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(102, 126, 234, 0.08);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Inputs e Campos de Formulário na Interface Principal */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* Select específico */
select {
    cursor: pointer;
    padding-right: 30px;
}

select option {
    background: #1a1a2e;
    color: #ffffff;
    padding: 8px;
}

textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* Botões - Inline e Espaçados */
input[type="submit"],
input[type="button"],
button,
.button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 8px;
    white-space: nowrap;
}

input[type="submit"]:hover,
input[type="button"]:hover,
button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

input[type="submit"]:active,
input[type="button"]:active,
button:active {
    transform: translateY(0);
}

/* Checkboxes e Radio Buttons */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    vertical-align: middle;
    margin: 0 6px 0 0;
    flex-shrink: 0;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Labels com checkboxes */
label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-right: 15px;
    color: #e8eaed;
}

/* Paginação */
.pages {
    margin: 20px 0;
    text-align: center;
}

.pages a,
.pages span {
    padding: 8px 12px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.pages a:hover {
    background: rgba(102, 126, 234, 0.2);
    text-decoration: none;
}

.pages .active {
    background: rgba(102, 126, 234, 0.3);
    color: #ffffff;
    font-weight: 600;
}

/* Code e Pre */
code, pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    color: #86efac;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.9em;
}

pre {
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Formulários dentro de tabelas - manter inline */
td input[type="text"],
td input[type="number"],
td input[type="password"],
td select {
    width: auto;
    min-width: 150px;
    max-width: 100%;
}

td input[type="checkbox"],
td input[type="radio"] {
    margin: 0;
}

/* Links em tabelas */
td a {
    margin-right: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #content {
        padding: 20px;
        border-radius: 12px;
    }
    
    body#login #content {
        padding: 30px 20px;
    }
    
    body#login #content::before {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    body#login #content::after {
        font-size: 0.75rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px 10px;
    }
    
    #menu a {
        display: block;
        margin-bottom: 8px;
    }
    
    input[type="submit"],
    input[type="button"],
    button {
        width: 100%;
        margin-right: 0;
    }
}

/* ===== AJUSTES FINAIS ===== */

/* Remover margens desnecessárias */
p {
    margin: 10px 0;
}

/* Espaçamento de formulários */
form > p {
    margin: 15px 0;
}

/* Títulos de seção */
.title {
    color: #667eea;
    font-weight: 600;
    margin: 20px 0 10px 0;
}

/* SQL Query textarea */
#sqlarea {
    width: 100%;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.3);
    color: #86efac;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 15px;
}

/* ===== CORREÇÃO DE SOBREPOSIÇÕES DO HEADER ===== */

/* Header principal do Adminer */
#header {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
    overflow: visible;
}

/* Breadcrumbs e navegação superior */
#breadcrumb {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#breadcrumb a,
#breadcrumb span {
    display: inline-block;
    margin-right: 10px;
    color: #e8eaed;
}

/* Informações do usuário e versão */
#version {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    padding: 5px 0;
    display: block;
    text-align: right;
}

/* Logout e links superiores */
#logout,
#lang {
    display: inline-block;
    margin-left: 15px;
}

/* Ajustar h1 do Adminer */
#h1 {
    display: block;
    text-align: left;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

/* Remover emojis do h1 em páginas internas */
body:not(#login) #h1::before,
body:not(#login) #h1::after {
    content: '';
    display: none;
}

/* Ajustar tabelas de formulário para não serem afetadas */
body:not(#login) form table {
    display: table;
}

body:not(#login) form table tr {
    display: table-row;
}

body:not(#login) form table td,
body:not(#login) form table th {
    display: table-cell;
}

/* Espaçamento entre elementos do form */
form table th {
    padding-right: 15px;
    white-space: nowrap;
    vertical-align: middle;
}

form table td {
    vertical-align: middle;
}

/* Ajustar posicionamento de elementos flutuantes */
.float {
    float: none !important;
    display: inline-block;
    margin: 0 10px 10px 0;
}

.clear {
    clear: both;
}

/* Links de idioma e configurações */
#lang select {
    padding: 6px 30px 6px 10px;
    font-size: 0.85rem;
    min-width: auto;
}

/* Ajustar width de inputs em contextos específicos */
form table input[type="text"],
form table input[type="number"],
form table input[type="password"],
form table select,
form table textarea {
    width: 300px;
    max-width: 100%;
}

/* Textarea SQL com tamanho fixo melhor */
form textarea[name="query"] {
    width: 100%;
    min-height: 150px;
}

/* Pequenos inputs (como limit, offset) */
input[size="3"],
input[size="4"],
input[size="5"] {
    width: auto !important;
    max-width: 80px;
}

/* Select pequenos */
select[name="limit"] {
    width: auto !important;
    min-width: 80px;
    max-width: 120px;
}
