/**
 * AC Morais - Sistema de Gestão de Tarefas
 * Estilos CSS com suporte a Tema Claro e Escuro
 */

/* ==========================================
   VARIÁVEIS DE CORES - TEMA CLARO
   ========================================== */
:root {
    /* Cores principais */
    --cor-primaria: #1e3a5f;
    --cor-primaria-hover: #2d4a6f;
    --cor-secundaria: #3498db;
    --cor-sucesso: #27ae60;
    --cor-perigo: #e74c3c;
    --cor-aviso: #f39c12;
    
    /* Cores de fundo */
    --fundo-principal: #f5f7fa;
    --fundo-card: #ffffff;
    --fundo-sidebar: #1e3a5f;
    --fundo-input: #ffffff;
    --fundo-tabela-header: #f8f9fa;
    --fundo-tabela-hover: #f1f3f5;
    
    /* Cores de texto */
    --texto-principal: #2c3e50;
    --texto-secundario: #7f8c8d;
    --texto-claro: #ffffff;
    --texto-input: #2c3e50;
    
    /* Bordas */
    --borda-cor: #e0e0e0;
    --borda-input: #ced4da;
    
    /* Sombras */
    --sombra-card: 0 2px 10px rgba(0, 0, 0, 0.08);
    --sombra-dropdown: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   VARIÁVEIS DE CORES - TEMA ESCURO
   ========================================== */
[data-tema="escuro"] {
    --cor-primaria: #3498db;
    --cor-primaria-hover: #5dade2;
    
    --fundo-principal: #1a1a2e;
    --fundo-card: #16213e;
    --fundo-sidebar: #0f0f1a;
    --fundo-input: #1a1a2e;
    --fundo-tabela-header: #1a1a2e;
    --fundo-tabela-hover: #1f2940;
    
    --texto-principal: #e0e0e0;
    --texto-secundario: #a0a0a0;
    --texto-input: #e0e0e0;
    
    --borda-cor: #2d3748;
    --borda-input: #4a5568;
    
    --sombra-card: 0 2px 10px rgba(0, 0, 0, 0.3);
    --sombra-dropdown: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   RESET E BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--fundo-principal);
    color: var(--texto-principal);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--cor-secundaria);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================
   PÁGINA DE LOGIN
   ========================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--cor-primaria) 0%, #2d4a6f 100%);
}

.login-box {
    background: var(--fundo-card);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--sombra-card);
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 200px;
    height: auto;
}

.login-titulo {
    text-align: center;
    color: var(--texto-principal);
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 600;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--fundo-sidebar);
    color: var(--texto-claro);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 150px;
    height: auto;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.ativo {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--cor-secundaria);
    text-decoration: none;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cor-secundaria);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.user-nome {
    font-weight: 500;
}

.user-tipo {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Conteúdo principal */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    transition: margin-left 0.3s ease;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-titulo {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--texto-principal);
}

.header-acoes {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ==========================================
   BOTÕES
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primario {
    background: var(--cor-primaria);
    color: var(--texto-claro);
}

.btn-primario:hover {
    background: var(--cor-primaria-hover);
    text-decoration: none;
    color: var(--texto-claro);
}

.btn-secundario {
    background: var(--cor-secundaria);
    color: var(--texto-claro);
}

.btn-sucesso {
    background: var(--cor-sucesso);
    color: var(--texto-claro);
}

.btn-perigo {
    background: var(--cor-perigo);
    color: var(--texto-claro);
}

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

.btn-outline:hover {
    background: var(--fundo-tabela-hover);
}

.btn-pequeno {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icone {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 8px;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--fundo-card);
    border-radius: 10px;
    box-shadow: var(--sombra-card);
    margin-bottom: 25px;
    transition: background-color 0.3s ease;
}

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

.card-titulo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--texto-principal);
}

.card-body {
    padding: 25px;
}

/* ==========================================
   FORMULÁRIOS
   ========================================== */
.form-grupo {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--texto-principal);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--borda-input);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--fundo-input);
    color: var(--texto-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--cor-secundaria);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-control::placeholder {
    color: var(--texto-secundario);
}

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

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-erro {
    color: var(--cor-perigo);
    font-size: 0.85rem;
    margin-top: 5px;
}

.form-ajuda {
    color: var(--texto-secundario);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* ==========================================
   TABELAS
   ========================================== */
.tabela-container {
    overflow-x: auto;
}

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

.tabela th,
.tabela td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--borda-cor);
}

.tabela th {
    background: var(--fundo-tabela-header);
    font-weight: 600;
    color: var(--texto-principal);
    white-space: nowrap;
}

.tabela tbody tr {
    transition: background-color 0.2s ease;
}

.tabela tbody tr:hover {
    background: var(--fundo-tabela-hover);
}

/* ==========================================
   BADGES DE URGÊNCIA
   ========================================== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.urgencia-alta {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.urgencia-media {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
}

.urgencia-baixa {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.badge-master {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

.badge-normal {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.badge-terminada {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.badge-pendente {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
}

/* ==========================================
   ALERTAS / MENSAGENS
   ========================================== */
.alerta {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerta-sucesso {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.alerta-erro {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.alerta-aviso {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.alerta-info {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* ==========================================
   HISTÓRICO
   ========================================== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--borda-cor);
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cor-secundaria);
    border: 2px solid var(--fundo-card);
}

.timeline-data {
    font-size: 0.85rem;
    color: var(--texto-secundario);
    margin-bottom: 5px;
}

.timeline-acao {
    font-weight: 500;
    color: var(--texto-principal);
}

.timeline-detalhes {
    font-size: 0.9rem;
    color: var(--texto-secundario);
    margin-top: 5px;
}

/* ==========================================
   TOGGLE TEMA
   ========================================== */
.tema-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tema-toggle-btn {
    width: 50px;
    height: 26px;
    background: var(--borda-cor);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: none;
}

.tema-toggle-btn::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--fundo-card);
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-tema="escuro"] .tema-toggle-btn {
    background: var(--cor-secundaria);
}

[data-tema="escuro"] .tema-toggle-btn::after {
    transform: translateX(24px);
}

.tema-toggle-icone {
    font-size: 1.2rem;
}

/* ==========================================
   FILTROS E PESQUISA
   ========================================== */
.filtros {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filtros .form-control {
    width: auto;
    min-width: 180px;
}

.pesquisa-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.pesquisa-box input {
    padding-left: 40px;
}

.pesquisa-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-secundario);
}

/* ==========================================
   ESTATÍSTICAS / DASHBOARD
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--fundo-card);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--sombra-card);
    text-align: center;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-numero {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cor-primaria);
    line-height: 1;
}

.stat-label {
    color: var(--texto-secundario);
    margin-top: 8px;
    font-size: 0.95rem;
}

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.ativo {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--fundo-card);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.ativo .modal {
    transform: scale(1);
}

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

.modal-titulo {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-fechar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--texto-secundario);
    transition: color 0.2s ease;
}

.modal-fechar:hover {
    color: var(--texto-principal);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--borda-cor);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================
   RESPONSIVO
   ========================================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.aberto {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-acoes {
        width: 100%;
        justify-content: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filtros {
        flex-direction: column;
    }
    
    .filtros .form-control,
    .pesquisa-box {
        width: 100%;
        min-width: unset;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 25px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tabela th,
    .tabela td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ==========================================
   MENU MOBILE
   ========================================== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--cor-primaria);
    color: var(--texto-claro);
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 992px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ==========================================
   ANIMAÇÕES
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ==========================================
   LOADING
   ========================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--borda-cor);
    border-top-color: var(--cor-secundaria);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   AÇÕES DA TABELA
   ========================================== */
.acoes-tabela {
    display: flex;
    gap: 8px;
}

.acoes-tabela .btn {
    padding: 6px 10px;
}

/* ==========================================
   VAZIO / SEM DADOS
   ========================================== */
.vazio {
    text-align: center;
    padding: 60px 20px;
    color: var(--texto-secundario);
}

.vazio-icone {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.vazio-texto {
    font-size: 1.1rem;
}
