/* assets/css/style.css */

:root {
    --cor-primaria: #4f46e5;
    --cor-secundaria: #0891b2;
    --cor-sidebar: #1e293b;
    --cor-texto: #1f2937;
    --cor-texto-claro: #6b7280;
    --cor-borda: #e5e7eb;
    --cor-fundo: #f9fafb;
    --cor-branco: #ffffff;
    --cor-sucesso: #10b981;
    --cor-erro: #ef4444;
    --cor-aviso: #f59e0b;
    --cor-info: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.6;
    font-size: 16px;
}

/* ========== LAYOUT PRINCIPAL ========== */

.layout {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */

.sidebar {
    width: 260px;
    background: var(--cor-sidebar);
    color: var(--cor-branco);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    max-width: 40px;
    height: auto;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cor-branco);
}

.nav-item.active {
    background: var(--cor-primaria);
    color: var(--cor-branco);
    border-left: 3px solid var(--cor-branco);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ========== MAIN CONTENT ========== */

.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
}

.topbar {
    background: var(--cor-branco);
    border-bottom: 1px solid var(--cor-borda);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--cor-texto);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--cor-texto-claro);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--cor-erro);
    color: var(--cor-branco);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.btn-logout:hover {
    opacity: 0.9;
}

.content {
    padding: 2rem;
}

/* ========== CARDS ========== */

.card {
    background: var(--cor-branco);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--cor-borda);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cor-texto);
}

.card-body {
    padding: 0;
}

/* ========== DASHBOARD STATS ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--cor-branco);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--cor-primaria);
}

.stat-card.success {
    border-left-color: var(--cor-sucesso);
}

.stat-card.warning {
    border-left-color: var(--cor-aviso);
}

.stat-card.danger {
    border-left-color: var(--cor-erro);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--cor-texto-claro);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--cor-texto);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.stat-change.up {
    color: var(--cor-sucesso);
}

.stat-change.down {
    color: var(--cor-erro);
}

/* ========== FORMS ========== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--cor-texto);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--cor-borda);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control:disabled {
    background: var(--cor-fundo);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--cor-texto-claro);
}

/* ========== BUTTONS ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    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: #4338ca;
}

.btn-secondary {
    background: var(--cor-secundaria);
    color: var(--cor-branco);
}

.btn-secondary:hover:not(:disabled) {
    background: #0e7490;
}

.btn-success {
    background: var(--cor-sucesso);
    color: var(--cor-branco);
}

.btn-danger {
    background: var(--cor-erro);
    color: var(--cor-branco);
}

.btn-warning {
    background: var(--cor-aviso);
    color: var(--cor-branco);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--cor-borda);
    color: var(--cor-texto);
}

.btn-outline:hover {
    background: var(--cor-fundo);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ========== TABLES ========== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: var(--cor-fundo);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--cor-texto);
    border-bottom: 2px solid var(--cor-borda);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--cor-borda);
}

.table tbody tr:hover {
    background: var(--cor-fundo);
}

/* ========== BADGES ========== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary { background:#e5e7eb; color:#374151; }
.portal-shortcuts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; }
.portal-shortcuts > [class*="col-"] { width:auto; max-width:none; padding:0; }
.portal-page-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.portal-page-header h1 { margin:0; font-size:2rem; font-weight:700; line-height:1.2; overflow-wrap:anywhere; }
.portal-page-actions { display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; }
.support-description { overflow-wrap:anywhere; white-space:normal; }
.support-filter-grid { display:grid; grid-template-columns:180px minmax(220px,1fr) 130px; gap:1rem; align-items:end; }
.support-filter-action { padding-bottom:0; }
.support-pagination { display:flex; gap:.4rem; flex-wrap:wrap; justify-content:center; margin-top:1rem; }

/* ========== ALERTS ========== */

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--cor-sucesso);
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: var(--cor-erro);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--cor-aviso);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--cor-info);
    color: #1e40af;
}

/* ========== LOGIN PAGE ========== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-secundaria) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--cor-branco);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 120px;
    height: auto;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cor-texto);
}

/* ========== FOOTER ========== */

.footer {
    background: var(--cor-branco);
    border-top: 1px solid var(--cor-borda);
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--cor-texto-claro);
    margin-top: auto;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content {
        padding: 1rem;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
    }
    
    .table-responsive {
        margin: 0 -1rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .portal-page-header { align-items:stretch; flex-direction:column; }
    .portal-page-header h1 { font-size:1.55rem; }
    .portal-page-actions { display:grid; grid-template-columns:1fr 1fr; width:100%; }
    .portal-shortcuts { grid-template-columns:1fr 1fr; gap:.65rem; }
    .portal-page-actions .btn { width:100%; padding:.65rem .5rem; }
    .topbar-user .user-info { display:none; }
    .topbar { gap:.5rem; }
    .btn-logout { padding:.45rem .7rem; }
    img, iframe, video { max-width:100%; }
    .portal-responsive-list { margin:0; overflow:visible; }
    .portal-responsive-list table, .portal-responsive-list tbody, .portal-responsive-list tr, .portal-responsive-list td { display:block; width:100%; }
    .portal-responsive-list thead { display:none; }
    .portal-responsive-list tr:not(.portal-empty) { padding:1rem; border-bottom:1px solid var(--cor-borda); }
    .portal-responsive-list td { border:0; padding:.35rem 0; overflow-wrap:anywhere; }
    .portal-responsive-list td[data-label]::before { content:attr(data-label); display:block; color:var(--cor-texto-claro); font-size:.68rem; font-weight:700; text-transform:uppercase; }
    .portal-responsive-list .portal-list-action .btn { width:100%; margin-top:.4rem; }
    .portal-empty td { padding:2rem 1rem; }
    .support-filter-grid { grid-template-columns:1fr; gap:.75rem; }
    .support-filter-action .btn { min-height:44px; }
    .support-pagination .btn { min-width:44px; min-height:44px; }
}

/* ========== UTILITIES ========== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--cor-texto-claro); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
