/* Layout Principal */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    background: #1e2942;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 250px;
}

/* Perfil do Usuário */
.sidebar-profile {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    margin-top: 0;
    flex-shrink: 0;
}

.sidebar-profile .user-name {
    color: #fff;
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

.sidebar-profile .user-email {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

/* Container do Menu com Scroll */
.sidebar .position-sticky {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0.5rem;
    padding-bottom: 4rem; /* Espaço para o botão de logout */
    height: calc(100vh - 100px); /* Altura total menos altura do perfil e logout */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Estilização da Scrollbar */
.sidebar .position-sticky::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.sidebar .position-sticky::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .position-sticky::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar .position-sticky::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Links do Menu */
.sidebar .nav-link {
    color: #b3b8d4;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff !important;
    background: #3498db !important;
    font-weight: 600;
}

.sidebar .nav-link i {
    margin-right: 10px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Submenu */
.submenu {
    background: rgba(0, 0, 0, 0.2);
    display: none;
    margin: 0;
    padding: 0;
}

.submenu.show {
    display: block;
}

.submenu .nav-link {
    padding-left: 3.5rem !important;
    font-size: 0.95rem;
}

.submenu .nav-link.active {
    color: #fff !important;
    background: #3498db !important;
    border-left: 4px solid #fff;
    padding-left: calc(3.5rem - 4px) !important;
}

/* Botão de Logout */
.logout-btn {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    margin-top: auto;
    flex-shrink: 0;
}

.logout-btn a {
    color: #b3b8d4;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.logout-btn a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.logout-btn i {
    margin-right: 10px;
}

/* Menu Toggle Icon */
.menu-toggle {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.menu-toggle.rotated {
    transform: rotate(180deg);
}

/* Ajustes para telas menores */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Main Content */
main {
    margin-left: 250px;
    padding: 2rem;
    background: #f8f9fa;
    min-height: 100vh;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

/* Tabelas */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    background: #f8f9fa;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
}

/* Botões */
.btn {
    padding: 0.5rem 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn i {
    font-size: 0.7rem;
}

/* Forms */
.form-control {
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Select2 Customização */
.select2-container--default .select2-selection--multiple {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Modais */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8f9fa;
}

/* Alertas */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
}

/* File Browser */
.file-browser {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.file-browser-header {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.file-browser-content {
    max-height: 400px;
    overflow-y: auto;
}

.file-browser .list-group-item {
    border: none;
    border-radius: 0;
    padding: 0.8rem 1rem;
}

.file-browser .list-group-item:hover {
    background: #f8f9fa;
}

/* Responsividade */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    main {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Utilitários */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate {
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Phone Format Preview */
.phone-format {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.phone-format span {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

.phone-format .ddi {
    background-color: #0d6efd;
    color: white;
}

.phone-format .ddd {
    background-color: #6c757d;
    color: white;
}

.phone-format .number {
    background-color: #0dcaf0;
    color: white;
}

#phonePreview {
    font-family: monospace;
}

tr[draggable="true"] {
    cursor: move;
}

tr.dragging {
    opacity: 0.5;
    background-color: #f8f9fa;
}

tr.drag-over {
    border-top: 2px solid #3498db;
}

.sortable-row {
    cursor: move;
}

.sortable-row.dragging {
    opacity: 0.5;
    background-color: #f8f9fa;
}

.sortable-row.drag-over {
    border-top: 2px solid #3498db;
}

.sortable-row td:first-child {
    padding-left: 1rem;
}

.sortable-row.dragging td {
    background-color: #f8f9fa !important;
}
