/* ==========================================================================
   PGT TELEFONIA & FATURAMENTO - STYLESHEET
   Design System Responsivo, Tema Executivo Navy PGT com Glassmorphism
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
    /* Cores Institucionais PGT / MPT */
    --primary: #0f2b48;
    --primary-light: #1c436c;
    --primary-dark: #0a1c30;
    --accent: #d4af37; /* Dourado institucional */
    --accent-hover: #b89628;

    /* Cores Semânticas de Status */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    /* Cores Neutras & Modos Light/Dark */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Efeitos de Vidro / Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(226, 232, 240, 0.7);
    --glass-shadow: 0 10px 30px -10px rgba(15, 43, 72, 0.08);

    /* Tipografia e Raios */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Escuro Opcional */
body.dark-mode {
    --bg-body: #0b131e;
    --bg-surface: #132235;
    --bg-surface-elevated: #1a2d44;
    --border-color: #1e3654;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --glass-bg: rgba(19, 34, 53, 0.88);
    --glass-border: rgba(30, 54, 84, 0.7);
    --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 0.95rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-main);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

/* Layout Principal */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 270px;
    background: var(--primary-dark);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent), #f3e5ab);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.sidebar-title h2 {
    color: #ffffff;
    font-size: 1.05rem;
    line-height: 1.2;
}

.sidebar-title span {
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    margin-top: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-md);
    margin-bottom: 0.3rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.25), rgba(255, 255, 255, 0.05));
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.sidebar-user {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.88rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Área de Conteúdo Conteúdo */
.app-main {
    margin-left: 270px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar Header */
.app-header {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--glass-shadow);
}

.header-title h1 {
    font-size: 1.35rem;
    color: var(--primary);
}

body.dark-mode .header-title h1 {
    color: #ffffff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Botões Modernos */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 43, 72, 0.2);
}

.btn-primary:hover {
    background: var(--primary-light);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Container de Conteúdo */
.content-container {
    padding: 2rem;
    flex: 1;
}

/* Cards & Grid Executivos */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(15, 43, 72, 0.12);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-danger::before { background: var(--danger); }
.stat-card.stat-info::before { background: var(--info); }
.stat-card.stat-accent::before { background: var(--accent); }

.stat-info .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
    font-family: var(--font-heading);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--bg-body);
    color: var(--primary);
}

.stat-card.stat-success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.stat-warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.stat-info .stat-icon { background: var(--info-bg); color: var(--info); }

/* Painéis de Conteúdo */
.card-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--glass-shadow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tabelas Modernas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.custom-table th {
    background: var(--bg-body);
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.custom-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background: rgba(15, 43, 72, 0.025);
}

body.dark-mode .custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Badges de Status */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--bg-body); color: var(--text-muted); }

/* Formulários & Filtros */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    font-family: var(--font-main);
    color: var(--text-main);
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 43, 72, 0.15);
}

/* Grid de Filtros Rápidos */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-body);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-item {
    flex: 1;
    min-width: 180px;
}

/* Drag & Drop Upload Zone */
.dropzone-area {
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-body);
    cursor: pointer;
    transition: var(--transition);
}

.dropzone-area:hover, .dropzone-area.dragover {
    background: rgba(15, 43, 72, 0.05);
    border-color: var(--accent);
}

.dropzone-icon {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 28, 48, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-body);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--primary-dark);
    color: #ffffff;
    font-size: 0.88rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive Rules */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}
