/* Global Variables */
:root {
    --bg-color: #050505;
    --bg-gradient-start: #1a0b2e;
    --text-main: #f0f0f0;
    --text-muted: #a0a0a0;
    --primary-color: #00a8ff;
    --secondary-color: #7000ff;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-family: 'Inter', sans-serif;

    /* Dashboard Light ERP Theme */
    --sidebar-bg: #1b4353; /* Cor Dark Steel Blue extraída da imagem */
    --sidebar-hover: #112b36;
    --sidebar-border: rgba(255,255,255,0.1);
    --panel-bg: #ffffff;
    --content-bg: #f0f2f5;
    --card-bg: #ffffff; /* Ajustado para branco absoluto para mesclar imagens jpeg com fundo branco */
    --card-border: #d1d5db;
    --text-dark: #2d3436;
    --text-light: #636e72;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Landing Page (index.html) */
.landing-body { 
    height: 100vh; 
    display: flex; 
    flex-direction: column;
    background-color: #10161a;
    background-image: url('IMAGE/paginahome.jpg');
    background-position: top left;
    background-size: cover;
    background-repeat: no-repeat;
    position: relative; 
    overflow: hidden; 
}
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 2rem 4rem; position: absolute; top: 0; left: 0; right: 0; z-index: 10; }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; }
.logo span { color: var(--primary-color); text-shadow: 0 0 10px rgba(0, 168, 255, 0.5); }
.login-button { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 0.6rem 1.5rem; border-radius: 8px; font-weight: 600; backdrop-filter: blur(10px); transition: all 0.3s ease; text-transform: uppercase; font-size: 0.85rem; cursor: pointer; color:#fff;}
.login-button:hover { border-color: var(--primary-color); box-shadow: 0 0 15px rgba(0, 168, 255, 0.3); background: rgba(0, 168, 255, 0.05); }
.hero { flex: 1; display: flex; justify-content: center; align-items: center; text-align: center; padding: 0 2rem; z-index: 2; }
.hero-content { max-width: 800px; }
.hero-title { font-size: 4rem; font-weight: 800; margin-bottom: 1rem; background: linear-gradient(90deg, var(--text-main) 0%, var(--primary-color) 50%, var(--secondary-color) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 3rem; line-height: 1.6; }
.cta-button { display: inline-block; background: linear-gradient(135deg, var(--secondary-color), var(--primary-color)); color: #fff; padding: 1rem 3rem; border-radius: 50px; font-size: 1.1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 10px 30px rgba(0, 168, 255, 0.3); transition: all 0.3s ease; border: none; cursor: pointer; }
.cta-button:hover { transform: translateY(-3px); box-shadow: 0 15px 40px rgba(0, 168, 255, 0.5); }

/* Login Modal index.html */
.login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 100; display: none; justify-content: center; align-items: center; }
.login-box { background: rgba(26, 30, 38, 0.95); padding: 2.5rem; border-radius: 8px; border: 1px solid var(--primary-color); width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0, 168, 255, 0.4); backdrop-filter: blur(10px); }
.login-box h2 { font-size: 1.5rem; margin-bottom: 1.5rem; color: #fff; text-align: center; }
.login-group { margin-bottom: 1.5rem; }
.login-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.login-group input { width: 100%; padding: 0.8rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: #fff; }
.login-group input:focus { border-color: var(--primary-color); outline: none; }
.btn-login-submit { width: 100%; background: var(--primary-color); color: #fff; border: none; padding: 0.8rem; border-radius: 4px; font-weight: 600; font-size: 1rem; cursor: pointer; }
.error-msg { color: #e74c3c; font-size: 0.8rem; margin-top: 0.5rem; text-align: center; display: none; }

/* ============================
   Dashboard Layout (Layout ERP)
   ============================ */
.dashboard-body {
    display: flex;
    flex-direction: row;
    background-color: var(--content-bg);
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Estilo Sistema */
.sidebar {
    width: 190px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 10;
    transition: transform 0.3s ease;
}

.sidebar .logo {
    padding: 1.3rem 1.5rem;
    font-size: 1.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    color: #fff;
}

.sidebar-title {
    font-size: 0.70rem;
    color: #8c9ba5;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    letter-spacing: 1px;
    font-weight: 600;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 1rem;
}

.nav-item { width: 100%; }

.nav-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #c4d0d9;
    font-weight: 400;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.nav-item a.active {
    background-color: var(--primary-color);
    color: #fff;
    border-left-color: #ffffff;
}

.nav-item.config-nav {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cabeçalho Unificado Azul no Topo */
.content-header {
    background-color: #265a6b; /* Cor Teal Escolhida Exatamente pelo Usuário */
    color: #fff;
    padding: 0 2rem;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 168, 255, 0.2);
    z-index: 5;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
}

.user-profile .avatar {
    width: 32px;
    height: 32px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logout-icon {
    color: rgba(255,255,255,0.8);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.logout-icon:hover { color: #fff; cursor: pointer;}

/* Container de Submenus e Funções Diárias */
.content-area {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    background-color: transparent;
}

/* Grid das Caixinhas Cinzas */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Caixas menores */
    gap: 1rem;
}

.submenu-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 1rem 0.5rem;
    min-height: 115px; /* Garante tamanho exato sem transbordar com as fotos */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submenu-card:hover {
    background-color: #fafbfc;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.submenu-card img {
    height: 58px; /* Tamanho proporcional para abrigar aproximadamente ~60% */
    width: auto;
    max-width: 90%;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.icon-placeholder {
    width: 55px;
    height: 55px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    background-color: rgba(0, 168, 255, 0.08);
    border-radius: 8px;
}

.icon-placeholder svg { width: 28px; height: 28px; }
.submenu-card h4 { font-size: 0.85rem; color: var(--text-dark); font-weight: 600; }

.empty-state { text-align: center; color: var(--text-light); max-width: 450px; margin: 4rem auto; }
.empty-state p { font-size: 1.15rem; color: var(--text-dark); margin: 1rem 0 0.5rem; font-weight: 600; }

/* ============================
   DBGRID / Data Table View
   ============================ */
.info-card-box {
    background: #f8f9fa;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.info-card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
}
.info-card-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    width: 100%;
}
.info-card-label.admin-editable {
    border-bottom: 1px dashed var(--primary-color);
    padding-bottom: 2px;
    cursor: text;
}
.info-card-label.admin-editable:focus {
    outline: none;
    background: rgba(0, 168, 255, 0.05);
}

.dbgrid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background-color: transparent;
    overflow: hidden;
}

.dbgrid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dbgrid-header h3 { color: var(--text-dark); font-size: 1.25rem; font-weight: 600; }

.dbgrid-table-wrapper {
    flex: 1;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    overflow: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    max-height: calc(100vh - 350px);
    min-height: 300px;
}

.dbgrid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    white-space: nowrap;
}

.dbgrid-table th {
    background-color: #f1f3f5;
    color: var(--text-dark);
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid #747d8c;
    border-bottom: 2px solid #2f3542;
    position: sticky;
    top: 0;
    z-index: 2;
}

.resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
}

.resizer:hover, .resizer.resizing {
    background-color: var(--primary-color);
}

.dbgrid-table td {
    padding: 0.4rem 0.75rem;
    border: 1px solid #747d8c; /* Darker border for clear separation */
    color: #2f3542;
}

/* Ferramentas de Admin Colunas */
.col-config-input {
    width: calc(100% - 25px);
    border: 1px solid var(--primary-color);
    background: rgba(255,255,255,0.9);
    padding: 0.2rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    font-family: inherit;
}
.col-hide-btn {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    float: right;
    margin-left: 5px;
    margin-top: 2px;
}
.col-hide-btn:hover { background: #ff6b81; }

.col-hidden-admin { 
    opacity: 0.6; 
    background-color: #fad3d3 !important; 
    color: transparent !important; 
    max-width: 65px !important; 
    width: 65px !important;
    overflow: hidden;
}
.col-hidden-admin input, .col-hidden-admin div { display: none !important; }
.dbgrid-table td.col-hidden-admin { font-size: 0px !important; padding: 0 !important; }

.dbgrid-table tbody tr:hover { background-color: #f8f9fa; }
.dbgrid-table tbody tr:nth-child(even) { background-color: #fbfcff; }

.dbgrid-loading { margin-top: 1rem; text-align: center; color: var(--primary-color); font-weight: 600; }


/* ============================
   Modal & Forms
   ============================ */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
    display: none; justify-content: center; align-items: center; z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #ffffff; border: 1px solid var(--card-border); border-radius: 8px;
    width: 90%; max-width: 600px; max-height: 90vh; overflow-y:auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); animation: slideUp 0.3s ease;
}

@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--card-border); background-color: #f8f9fb; }
.modal-header h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-dark);}
.close-btn { background: none; border: none; color: var(--text-light); font-size: 1.5rem; cursor: pointer; }
.close-btn:hover { color: #e74c3c; }

.modal-tabs { display: flex; background: #f8f9fb; border-bottom: 1px solid var(--card-border); }
.tab-btn { flex: 1; background: none; border: none; color: var(--text-light); padding: 1rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn:hover { color: var(--text-dark); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); background-color: #fff; }

.modal-content { padding: 1.5rem; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease; }

.config-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-group label { display: block; font-size: 0.82rem; color: var(--text-light); margin-bottom: 0.5rem; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; background: #ffffff; border: 1px solid var(--card-border); color: var(--text-dark);
    padding: 0.75rem 1rem; border-radius: 4px; font-family: inherit; font-size: 0.95rem; resize: vertical;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.1); }

.form-actions { display: flex; gap: 1rem; margin-top: 0.5rem; }
.form-actions.space-between { justify-content: space-between; }
.form-actions.right { justify-content: flex-end; }

.btn { padding: 0.75rem 1.5rem; border-radius: 4px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; border: none; font-family: inherit; font-size: 0.85rem; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: #0097e6; }
.btn-secondary { background: #f1f2f6; color: var(--text-dark); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: #e2e5ec; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.menu-list-preview { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--card-border); }
.menu-list-preview h3 { font-size: 0.9rem; margin-bottom: 1rem; color: var(--text-dark); }
.menu-list-preview ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.menu-list-preview li { background: #f8f9fb; padding: 0.6rem 1rem; border-radius: 4px; border: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--text-dark); }
.menu-item-info { display: flex; align-items: center; gap: 0.5rem; }
.menu-item-actions { display: flex; gap: 0.25rem; }
.action-btn-sm { background: none; border: none; cursor: pointer; padding: 0.4rem; border-radius: 4px; display: flex; align-items: center; transition: all 0.2s; }
.edit-btn { color: var(--primary-color); }
.edit-btn:hover { background: rgba(0, 168, 255, 0.1); }
.delete-btn { color: #e74c3c; }
.delete-btn:hover { background: rgba(231, 76, 60, 0.1); }
.submenu-badge { font-size: 0.70rem; background: rgba(0, 168, 255, 0.1); color: var(--primary-color); padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 600; }

@media (max-width: 768px) {
    .sidebar { position: absolute; left: -190px; box-shadow: none; }
    .sidebar.open { left: 0; box-shadow: 2px 0 15px rgba(0,0,0,0.5); }
    .mobile-menu-btn { display: flex; }
    .content-area, .dbgrid-container { padding: 1.5rem; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .form-row { flex-direction: column; gap: 0; }
}
