/* =========================================
   ESTRUTURA GERAL E CONTAINER
========================================= */


.gestao-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px clamp(20px, 2vw, 40px);
}

/* =========================================
   CABEÇALHO DA PÁGINA
========================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 20px;
}

.page-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h2::before {
    content: '';
    display: block;
    width: 8px;
    height: 28px;
    background: linear-gradient(180deg, #e53935, #8b1c1c);
    border-radius: 4px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-link {
    color: #bbb;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.btn-link:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,0,0,0.3);
}

/* =========================================
   CARDS PREMIUM (ESTILO OP-CARD)
========================================= */
.admin-card {
    background: linear-gradient(145deg, #181818, #0d0d0d);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
}

.admin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #ff2a2a, transparent);
    opacity: 0.6;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.admin-card h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================
   FORMULÁRIOS E INPUTS
========================================= */
.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 30px;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaa;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    background: linear-gradient(145deg, #141414, #0d0d0d);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
    transition: all 0.25s ease;
    outline: none;
    appearance: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #111 inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e53935' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.form-group select option {
    background: #121212;
    color: #fff;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15), inset 0 0 10px rgba(0,0,0,0.7);
    transform: translateY(-1px);
}

/* =========================================
   OLHO DA SENHA (TOGGLE)
========================================= */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 45px;
}

.eye-icon {
    position: absolute;
    right: 14px;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    height: 100%;
}

.eye-icon:hover {
    color: #e53935;
}

/* =========================================
   CHECKBOXES CUSTOMIZADOS
========================================= */
.acessos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.custom-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s ease;
    user-select: none;
}

.custom-checkbox:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.custom-checkbox input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1px solid #555;
    border-radius: 3px;
    background: #111;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    margin: 0;
}

.custom-checkbox input[type="checkbox"]:checked {
    background: #e53935;
    border-color: #e53935;
    box-shadow: 0 0 8px rgba(229, 57, 53, 0.4);
}

.custom-checkbox input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 11px;
}

.custom-checkbox span {
    font-size: 0.85rem;
    color: #ddd;
}

/* =========================================
   BOTÕES
========================================= */
.btn-action {
    padding: 12px 24px;
    background: linear-gradient(135deg, #8b1c1c, #e53935);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    transition: all 0.3s ease;
}

.btn-action:hover {
    background: linear-gradient(135deg, #a62222, #ff5252);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(229, 57, 53, 0.35);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    background: linear-gradient(135deg, #4a0d0d, #b81e1e);
}

/* =========================================
   TABELA PREMIUM
========================================= */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    margin-top: 10px;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(0, 0, 0, 0.4);
    color: #aaa;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

td {
    font-size: 0.95rem;
    color: #ddd;
}

/* Badges de Papel */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.role-ti { border-color: rgba(229, 57, 53, 0.4); color: #ff5252; background: rgba(229, 57, 53, 0.1); }
.role-dono { border-color: rgba(243, 156, 18, 0.4); color: #f1c40f; background: rgba(243, 156, 18, 0.1); }
.role-gerente { border-color: rgba(155, 89, 182, 0.4); color: #9b59b6; background: rgba(155, 89, 182, 0.1); }
.role-vendedor { border-color: rgba(52, 152, 219, 0.4); color: #3498db; background: rgba(52, 152, 219, 0.1); }
.role-estoquista { border-color: rgba(46, 204, 113, 0.4); color: #2ecc71; background: rgba(46, 204, 113, 0.1); }

/* =========================================
   RESPONSIVO GERAL (MOBILE & TABLET)
========================================= */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .gestao-container {
        padding: 20px 10px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-actions {
        width: 100%;
    }
    .header-actions .btn-link {
        display: block;
        width: 100%;
        text-align: center;
        padding: 12px;
        background: rgba(255,255,255,0.05);
        border-radius: 8px;
    }
    .admin-card {
        padding: 20px 15px;
    }
    .form-grid {
        flex-direction: column;
        gap: 15px;
    }
    .form-group {
        width: 100%;
    }
    
    /* =========================================
       TABELAS COMO CARDS (Usuários e Colaboradores)
    ========================================= */
    .table-container {
        overflow-x: visible;
        background: transparent;
        border: none;
        padding: 0;
    }
    table thead {
        display: none;
    }
    table, table tbody, table tr, table td {
        display: block;
        width: 100%;
    }
    table tr {
        background: #111;
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 12px;
    }
    table td {
        padding: 8px 4px;
        text-align: left !important;
        border-bottom: 1px dashed rgba(255,255,255,0.1);
        white-space: normal !important;
        word-break: break-word;
    }
    table td:last-child {
        border-bottom: none;
        padding-top: 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start;
    }
    
    /* Identificadores visuais da tabela transformados */
    table td:nth-child(1) {
        font-size: 1.15rem;
        color: #fff;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        padding-bottom: 10px;
        margin-bottom: 5px;
    }
    table td:nth-child(2)::before,
    table td:nth-child(3)::before,
    table td:nth-child(4)::before {
        color: #888;
        font-size: 0.75rem;
        display: block;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Ajustando botões dentro da tabela */
    table td .btn-action, table td button {
        flex: 1;
        min-width: 100px;
        text-align: center;
        justify-content: center;
    }
    
    /* Botões de Salvar principais */
    .btn-salvar, .action-btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   TABS MENU
========================================= */
.tabs-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    color: #ddd;
    background: rgba(255,255,255,0.02);
}

.tab-btn.active {
    color: #e53935;
    border-bottom: 3px solid #e53935;
}

.tab-content {
    animation: fadeIn 0.4s ease;
}

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

/* =========================================
   RESPONSIVO DAS ABAS (MOBILE)
========================================= */
@media (max-width: 768px) {
    .tabs-menu {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: none;  /* IE/Edge */
        scrollbar-width: none;  /* Firefox */
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .tabs-menu::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        flex-shrink: 0; /* Impede esmagamento do botão */
    }

    .tab-btn svg {
        width: 16px;
        height: 16px;
    }
}
