/* =========================================
   ESTRUTURA MESTRE (LAYOUT FIXO E RESPONSÍVEL)
   ========================================= */
* { box-sizing: border-box; }

body.app-layout {
    margin: 0; 
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: url('fundo.gif') no-repeat center center fixed;
    background-size: cover;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex; /* Sidebar à esquerda, Main à direita */
}

/* =========================================
   SIDEBAR LATERAL (COM EFEITOS RESTAURADOS)
   ========================================= */
.sidebar {
    width: 100px;
    min-width: 100px;
    background: #636466;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30px; /* Um pouco mais de espaço no topo */
    position: relative;
    z-index: 100;
    overflow: visible; /* Necessário para o efeito de "salto" */
}

.sidebar-item { 
    width: 100%; 
    text-align: center;
    margin-bottom: 12px; /* Espaçamento original */
    position: relative;
}

.sidebar-item a { 
    text-decoration: none; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 10px 0;
    transition: all 0.3s ease;
    width: 100%;
    border-radius: 0; /* Base quadrada */
    position: relative;
    z-index: 1;
}

/* Ícone maior por padrão */
.sidebar-item img { 
    width: 48px; 
    height: 48px; 
    margin-bottom: 8px; 
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: transform 0.3s ease, opacity 0.3s ease; /* Transição para o zoom */
}

.sidebar-item span { 
    color: #ffffff; 
    font-size: 10px; 
    font-weight: bold; 
    text-transform: uppercase; 
    display: block;
    transition: opacity 0.3s ease;
}

/* EFEITOS HOVER E ATIVO (O "SALTO" ARREDONDADO) */
.sidebar-item a:hover, 
.sidebar-item a.active { 
    background: #C41F3A; /* Mesma cor da sidebar */
    width: 110px; /* Aumenta a largura para a direita */
    box-shadow: 10px 0 15px rgba(0,0,0,0.2); /* Sombra para dar profundidade */
    border-radius: 0 15px 15px 0; /* Arredonda apenas o lado direito */
    z-index: 2; /* Fica por cima dos outros itens */
}

/* Zoom na imagem ao passar o mouse */
.sidebar-item a:hover img {
    transform: scale(1.1); /* Aumenta 10% */
    opacity: 1;
}

/* =========================================
   CONTAINER PRINCIPAL, HEADER E FOOTER
   ========================================= */
.main-container { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100vh;
    padding: 15px 15px 10px 30px; /* Margens originais */
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.main-header { 
    height: 60px;
    min-height: 60px;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px;
    position: relative;
}

.logo-top { height: 45px; }

/* Título da página (centralizado no cabeçalho) */
.page-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #4d4e50;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

/* Divisor sutil abaixo do header/cards (cor do logo) */
.header-divider {
    height: 1px;
    width: 100%;
    margin: 6px 0 12px 0;
    background: linear-gradient(
        90deg,
        rgba(199, 31, 58, 0) 0%,
        rgba(199, 31, 58, 0.55) 22%,
        rgba(199, 31, 58, 0.85) 50%,
        rgba(199, 31, 58, 0.55) 78%,
        rgba(199, 31, 58, 0) 100%
    );
    opacity: 0.9;
}

/* DASHBOARD CARDS (Transparência 20% restaurada) */
.dashboard-inline { display: flex; gap: 12px; align-items: center; }
.mini-card-wrapper { display: flex; flex-direction: column; align-items: center; width: 110px; }
.mini-card { 
    width: 100%; height: 50px; border-radius: 14px;
    display: flex; align-items: center; justify-content: flex-end; padding: 4px 12px;
    background-repeat: no-repeat !important; background-position: left 8px center !important; 
    background-size: 34px !important; border: 2px solid; box-sizing: border-box;
}
.card-qty { font-size: 22px; color: #fff; font-weight: 800; letter-spacing: -0.2px; }
.card-legend { font-size: 9px; color: #4d4e50; margin-top: 2px; text-transform: uppercase; font-weight: 400; opacity: 0.9; }

.card-aberto { background-color: rgba(211, 47, 47, 0.2); border-color: rgba(211, 47, 47, 0.5); }
.card-andamento { background-color: rgba(243, 156, 18, 0.2); border-color: rgba(243, 156, 18, 0.5); }
.card-finalizado { background-color: rgba(39, 174, 96, 0.2); border-color: rgba(39, 174, 96, 0.5); }
.card-cancelado { background-color: rgba(99, 100, 102, 0.2); border-color: rgba(99, 100, 102, 0.5); }

/* ÁREA DE CONTEÚDO (GRID) */
.content-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; /* Padrão 50/50 */
    gap: 15px; 
    flex: 1; 
    min-height: 0;
    overflow: hidden; 
}

/* Ajuste específico para index.php (Histórico 60%, Formulário 40%) */
.app-layout-index .content-grid {
    grid-template-columns: 1.5fr 1fr;
}

.ios-frame {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    border: 2px solid #cccccc; 
    border-radius: 15px;
    padding: 15px; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

.section-title { font-size: 14px; color: #111; margin: 0 0 10px 0; font-weight: 700; text-transform: uppercase; }

/* TABELAS PADRONIZADAS */
.scroll-area, .scroll-area-form { flex: 1; overflow-y: auto; padding-right: 5px;}

table { width: 100%; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
table th { text-align: left; padding: 4px 8px; border-bottom: 1px solid rgba(0,0,0,0.1); color: #333; text-transform: uppercase; }
table td { 
    padding: 3px 8px !important; 
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* STATUS COLORS */
.status-text { padding: 2px 6px; border-radius: 4px; font-weight: bold; color: #fff; font-size: 9px; text-transform: uppercase;}
.status-em-aberto { background: #d32f2f; }
.status-em-andamento { background: #f39c12; }
.status-concluido { background: #27ae60; }
.status-cancelado { background: #636466; }

/* FORMULÁRIOS */
label { font-size: 9px; font-weight: bold; margin: 6px 0 2px 0; display: block; text-transform: uppercase; color: #222;}
input, select, textarea { 
    width: 100%; padding: 6px; border-radius: 8px; border: 1px solid #ccc; 
    background: rgba(255,255,255,0.4); font-size: 11px; box-sizing: border-box;
}
.dual-input { display: flex; gap: 8px; }
.in-group { flex: 1; }

/* BOTÕES PADRÃO (Cinza Escuro Arredondado) */
.btn-enviar-small, button:not(.btn-eye):not(.close-modal) { 
    background: #636466 !important; color: white !important; border: none; 
    padding: 8px 20px; min-height: 32px;
    border-radius: 10px; cursor: pointer; font-size: 10px; font-weight: bold;
    text-transform: uppercase; transition: background 0.2s;
}
button:not(.btn-eye):not(.close-modal):hover { background: #4d4e50 !important; }

/* Botão Olho (transparente) */
.btn-eye { background: none !important; border: none; cursor: pointer; padding: 0; font-size: 16px; width: auto;}

/* RODAPÉ */
.main-footer { 
    height: 30px; min-height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #444; font-weight: bold; text-transform: uppercase; padding: 8px; box-sizing: border-box;
}

/* =========================================
   MODAL (POP-UP CENTRALIZADO E ESMAECIDO)
   ========================================= */
.modal { 
    display: none; /* Escondido por padrão */
    position: fixed; 
    z-index: 9999; /* Por cima de tudo */
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); /* Fundo escuro esmaecido */
    backdrop-filter: blur(10px); /* Efeito de desfoque no fundo */
    align-items: center; /* Centraliza verticalmente */
    justify-content: center; /* Centraliza horizontalmente */
}

.ios-frame-modal { 
    background: rgba(255, 255, 255, 0.98); /* Quase opaco */
    padding: 25px; 
    width: 600px; 
    max-width: 90%; /* Responsivo */
    max-height: 85vh; /* Não ultrapassa a altura da tela */
    border-radius: 25px; 
    border: 2px solid #ccc; 
    position: relative; 
    overflow-y: auto; /* Scroll interno se necessário */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: block; /* Sobrescreve flex do ios-frame padrão */
}

.close-modal { 
    position: absolute; 
    right: 20px; 
    top: 15px; 
    font-size: 28px; 
    font-weight: bold;
    cursor: pointer; 
    color: #aaa;
    transition: 0.2s;
}
.close-modal:hover { color: #333; }

/* =========================
   CARDS PADRÃO (IGUAL INDEX)
   ========================= */

.card-linhas {
    background-color: rgba(39, 174, 96, 0.2); /* verde */
    border-color: rgba(39, 174, 96, 0.5);
    background-image: url('operadoras.png');
}

.card-claro {
    background-color: rgba(211, 47, 47, 0.2); /* vermelho */
    border-color: rgba(211, 47, 47, 0.5);
    background-image: url('operadoras.png');
}

.card-tim {
    background-color: rgba(41, 128, 185, 0.2); /* azul */
    border-color: rgba(41, 128, 185, 0.5);
    background-image: url('operadoras.png');
}

/* GARANTE POSIÇÃO IGUAL AO INDEX */
.mini-card {
    background-repeat: no-repeat !important;
    background-position: left 8px center !important;
    background-size: 24px !important;
}