/**
 * MDWeb Gestão - Estilos Principais
 * Sistema de Gestão de Projetos e Tarefas
 * Paleta de cores: #2D80C3, #4CB080, #F5F6FA
 */

/* ============================================
   RESET E CONFIGURAÇÕES GERAIS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores Primárias */
    --cor-primaria: #2D80C3;
    --cor-secundaria: #4CB080;
    --cor-fundo: #F5F6FA;
    --cor-texto-primario: #333333;
    --cor-texto-secundario: #555555;
    
    /* Estados */
    --cor-erro: #E54B4B;
    --cor-aviso: #F5A623;
    --cor-sucesso: #3BA55C;
    
    /* Cores Adicionais */
    --cor-branco: #FFFFFF;
    --cor-cinza-claro: #E8E8E8;
    --cor-cinza-medio: #999999;
    --cor-cinza-escuro: #666666;
    --cor-borda: #DDDDDD;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    
    /* Sombras */
    --sombra-leve: 0 2px 4px rgba(0, 0, 0, 0.1);
    --sombra-media: 0 4px 8px rgba(0, 0, 0, 0.15);
    --sombra-forte: 0 8px 16px rgba(0, 0, 0, 0.2);
    
    /* Transições */
    --transicao-rapida: 0.2s ease;
    --transicao-media: 0.3s ease;
}

body {
    font-family: 'Inter', 'Roboto', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: var(--cor-texto-primario);
    background-color: var(--cor-fundo);
    line-height: 1.6;
}

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

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1a5a8a 0%, var(--cor-primaria) 100%);
    color: var(--cor-branco);
    transition: width var(--transicao-media);
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: var(--sombra-forte);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Logo */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity var(--transicao-media);
}

.sidebar.collapsed .sidebar-header h1 {
    opacity: 0;
}

/* Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: -15px;
    background: var(--cor-primaria);
    border: 2px solid var(--cor-branco);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cor-branco);
    transition: all var(--transicao-rapida);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: #1a5a8a;
    transform: scale(1.1);
}

/* Menu de Navegação */
.sidebar-nav {
    padding: 10px 0;
}

.nav-section {
    margin-bottom: 5px;
}

.nav-section-title {
    padding: 15px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    transition: opacity var(--transicao-media);
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.9);
    transition: all var(--transicao-rapida);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cor-branco);
    border-left-color: var(--cor-secundaria);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--cor-branco);
    border-left-color: var(--cor-secundaria);
    font-weight: 600;
}

.nav-link i {
    font-size: 18px;
    min-width: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link span {
    flex: 1;
    white-space: nowrap;
    transition: opacity var(--transicao-media);
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
}

.nav-link .badge {
    background: var(--cor-erro);
    color: var(--cor-branco);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transicao-media);
    background: rgba(0, 0, 0, 0.15);
}

.nav-item.open .nav-submenu {
    max-height: 500px;
}

.nav-submenu .nav-link {
    padding-left: 56px;
    font-size: 14px;
}

.sidebar.collapsed .nav-submenu {
    display: none;
}

.nav-link .arrow {
    margin-left: auto;
    transition: transform var(--transicao-rapida);
}

.nav-item.open .nav-link .arrow {
    transform: rotate(90deg);
}

/* ============================================
   ÁREA PRINCIPAL
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transicao-media);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--cor-branco);
    border-bottom: 1px solid var(--cor-borda);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--sombra-leve);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--cor-texto-primario);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-search {
    position: relative;
}

.topbar-search input {
    padding: 8px 35px 8px 15px;
    border: 1px solid var(--cor-borda);
    border-radius: 20px;
    width: 250px;
    font-size: 14px;
    transition: all var(--transicao-rapida);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(45, 128, 195, 0.1);
}

.topbar-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cor-cinza-medio);
}

.topbar-notifications,
.topbar-user {
    position: relative;
    cursor: pointer;
}

.notification-icon {
    font-size: 20px;
    color: var(--cor-texto-secundario);
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cor-erro);
    color: var(--cor-branco);
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 600;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--cor-primaria);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cor-texto-primario);
}

.user-role {
    font-size: 12px;
    color: var(--cor-texto-secundario);
}

/* Conteúdo da Página */
.page-content {
    flex: 1;
    padding: 30px;
}

/* ============================================
   COMPONENTES REUTILIZÁVEIS
   ============================================ */

/* Cards */
.card {
    background: var(--cor-branco);
    border-radius: 8px;
    box-shadow: var(--sombra-leve);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--cor-borda);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--cor-texto-primario);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: var(--cor-fundo);
    border-top: 1px solid var(--cor-borda);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transicao-rapida);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--cor-primaria);
    color: var(--cor-branco);
}

.btn-primary:hover:not(:disabled) {
    background: #1a5a8a;
    transform: translateY(-1px);
    box-shadow: var(--sombra-media);
}

.btn-secondary {
    background: var(--cor-secundaria);
    color: var(--cor-branco);
}

.btn-secondary:hover:not(:disabled) {
    background: #3a9070;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--cor-erro);
    color: var(--cor-branco);
}

.btn-danger:hover:not(:disabled) {
    background: #d43b3b;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--cor-primaria);
    color: var(--cor-primaria);
}

.btn-outline:hover:not(:disabled) {
    background: var(--cor-primaria);
    color: var(--cor-branco);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--cor-texto-primario);
}

.form-label.required::after {
    content: ' *';
    color: var(--cor-erro);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid var(--cor-borda);
    border-radius: 6px;
    transition: all var(--transicao-rapida);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(45, 128, 195, 0.1);
}

.form-control:disabled {
    background: var(--cor-cinza-claro);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: var(--cor-erro);
    font-size: 13px;
    margin-top: 5px;
}

.form-help {
    color: var(--cor-texto-secundario);
    font-size: 13px;
    margin-top: 5px;
}

/* Tabelas */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--cor-borda);
}

.table th {
    background: var(--cor-fundo);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cor-texto-secundario);
}

.table tbody tr:hover {
    background: rgba(45, 128, 195, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--cor-primaria);
    color: var(--cor-branco);
}

.badge-success {
    background: var(--cor-sucesso);
    color: var(--cor-branco);
}

.badge-warning {
    background: var(--cor-aviso);
    color: var(--cor-branco);
}

.badge-danger {
    background: var(--cor-erro);
    color: var(--cor-branco);
}

.badge-secondary {
    background: var(--cor-cinza-medio);
    color: var(--cor-branco);
}

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(59, 165, 92, 0.1);
    color: var(--cor-sucesso);
    border-left: 4px solid var(--cor-sucesso);
}

.alert-error {
    background: rgba(229, 75, 75, 0.1);
    color: var(--cor-erro);
    border-left: 4px solid var(--cor-erro);
}

.alert-warning {
    background: rgba(245, 166, 35, 0.1);
    color: var(--cor-aviso);
    border-left: 4px solid var(--cor-aviso);
}

.alert-info {
    background: rgba(45, 128, 195, 0.1);
    color: var(--cor-primaria);
    border-left: 4px solid var(--cor-primaria);
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cor-branco);
    font-size: 28px;
    box-shadow: var(--sombra-forte);
    cursor: pointer;
    transition: all var(--transicao-rapida);
    z-index: 999;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.4);
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 15px;
    }
    
    .topbar-search input {
        width: 150px;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .user-info {
        display: none;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }
