/* assets/css/style.css
   Sistema Helpdesk MCTD - Estilos Completos
   Versão: 2.0.0
*/

/* ============================================
   VARIÁVEIS GLOBAIS
   ============================================ */
:root {
    --primary: #0066B3;
    --primary-dark: #004d8c;
    --primary-light: #4da3d4;
    --secondary: #00A859;
    --secondary-dark: #008040;
    --danger: #DC3545;
    --warning: #FFC107;
    --info: #17A2B8;
    --light: #F8F9FA;
    --dark: #343A40;
    --gray: #6C757D;
    --gray-light: #E9ECEF;
    --gray-dark: #495057;
    --success: #28A745;
    --white: #FFFFFF;
    --black: #000000;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
    --transition: all 0.2s ease;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-sm: 4px;
}

/* ============================================
   RESET E BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.5;
    font-size: 14px;
}

/* Tema Escuro */
body[data-theme="dark"] {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .navbar,
body[data-theme="dark"] .dropdown-content,
body[data-theme="dark"] .modal-content {
    background: #1e1e2e;
    color: #e0e0e0;
}

body[data-theme="dark"] .card-header {
    background: linear-gradient(135deg, #0f3460, #16213e);
}

body[data-theme="dark"] .form-control {
    background: #2d2d3d;
    color: #e0e0e0;
    border-color: #3d3d4d;
}

body[data-theme="dark"] .table th {
    background: #2d2d3d;
    color: #e0e0e0;
}

body[data-theme="dark"] .table td {
    border-color: #3d3d4d;
}

body[data-theme="dark"] .sidebar-card,
body[data-theme="dark"] .solution-card,
body[data-theme="dark"] .article-card {
    background: #1e1e2e;
    color: #e0e0e0;
}

/* ============================================
   LAYOUT
   ============================================ */
.main-content {
    min-height: calc(100vh - 60px);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1rem !important;
}

.container > :first-child {
    margin-top: 0 !important;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    background: none;
    -webkit-text-fill-color: var(--primary);
    margin-right: 0.4rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-dark);
    padding: 0.4rem 0.7rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--primary);
    color: var(--white);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: var(--secondary-dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.card-header i {
    margin-right: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--light);
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-light);
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,179,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   TABELAS
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
    font-size: 0.85rem;
}

.table th {
    background: var(--light);
    font-weight: 600;
}

.table tr:hover {
    background: var(--light);
}

/* ============================================
   BADGES
   ============================================ */
.status-badge,
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-aberto { background: #FFE5B4; color: #FF8C00; }
.status-analise { background: #CCE5FF; color: #004085; }
.status-resolvido { background: #D4EDDA; color: #155724; }
.status-fechado { background: #E2E3E5; color: #383D41; }

.priority-baixa { background: #D4EDDA; color: #155724; }
.priority-media { background: #FFF3CD; color: #856404; }
.priority-alta { background: #F8D7DA; color: #721C24; }
.priority-critica { background: #DC3545; color: white; }

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.alert-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.alert-danger { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.alert-warning { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.alert-info { background: #CCE5FF; color: #004085; border: 1px solid #B8DAFF; }

.alert .close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    max-width: 90%;
    width: 600px;
    max-height: 90%;
    overflow: auto;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal .close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ============================================
   DROPDOWNS
   ============================================ */
.notifications-dropdown,
.user-dropdown {
    position: relative;
}

.notifications-btn,
.user-btn,
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--gray-dark);
}

.notifications-btn:hover,
.user-btn:hover,
.theme-toggle:hover {
    background: var(--light);
}

.notifications-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 2px 5px;
    font-size: 9px;
    min-width: 16px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    min-width: 280px;
    box-shadow: var(--shadow-hover);
    border-radius: var(--border-radius);
    z-index: 1000;
    margin-top: 0.3rem;
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
}

.dropdown-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    background: var(--light);
}

.dropdown-body {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    display: flex;
    gap: 0.6rem;
}

.notification-item:hover {
    background: var(--light);
}

.notification-item.unread {
    background: #E3F2FD;
}

.notification-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.notification-message {
    font-size: 0.75rem;
    color: var(--gray);
}

.notification-time {
    font-size: 0.65rem;
    color: var(--gray-light);
}

.user-dropdown .dropdown-content {
    min-width: 180px;
}

.user-dropdown .dropdown-content a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-dark);
    font-size: 0.85rem;
}

.user-dropdown .dropdown-content a:hover {
    background: var(--light);
}

/* ============================================
   GRIDS
   ============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ============================================
   BASE DE CONHECIMENTO
   ============================================ */
.kb-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 1.5rem;
}

.kb-search-box {
    max-width: 500px;
    margin: 1rem auto 0;
    position: relative;
}

.kb-search-box input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: none;
    border-radius: 50px;
    font-size: 0.85rem;
}

.kb-search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.kb-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.kb-sidebar-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.kb-sidebar-card h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.kb-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.kb-category-link {
    padding: 0.3rem 0.7rem;
    background: var(--light);
    border-radius: 20px;
    text-decoration: none;
    color: var(--dark);
    font-size: 0.75rem;
    transition: var(--transition);
}

.kb-category-link:hover,
.kb-category-link.active {
    background: var(--primary);
    color: white;
}

.kb-articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.kb-article-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.kb-article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.kb-article-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.kb-article-excerpt {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.kb-article-meta {
    display: flex;
    gap: 0.8rem;
    font-size: 0.7rem;
    color: var(--gray-light);
}

.kb-pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1.5rem;
}

.kb-page-link {
    padding: 0.3rem 0.7rem;
    background: white;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--dark);
    font-size: 0.8rem;
}

.kb-page-link.active,
.kb-page-link:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 992px) {
    .nav-links a span { display: none; }
    .nav-links a { padding: 0.4rem 0.6rem; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 0.5rem;
        background: white;
        border-radius: var(--border-radius);
        padding: 0.5rem;
    }
    
    .nav-links.show { display: flex; }
    .nav-links a span { display: inline; }
    
    .container { padding: 0.5rem !important; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .kb-layout { grid-template-columns: 1fr; }
    .kb-articles-grid { grid-template-columns: 1fr; }
}

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fade-in { animation: fadeIn 0.3s ease; }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}