/* ==================== VARIÁVEIS CSS ==================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --background: #ffffff;
    --surface: #f9fafb;
    --surface-dark: #f3f4f6;
    --foreground: #1f2937;
    --foreground-light: #6b7280;
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition: all 0.3s ease;
    --sidebar-width: 280px;
    --topbar-height: 70px;
}

/* ==================== RESET E BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface);
    color: var(--foreground);
    line-height: 1.6;
    font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== LAYOUT PRINCIPAL ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.footer {
    background-color: var(--foreground);
    color: #ffffff;
    padding: 3rem 2rem 1rem;
    margin-top: auto;

    margin-left: var(--sidebar-width); 
    transition: var(--transition);
}

/* ==================== SIDEBAR ==================== */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 1.75rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--foreground);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
}

.nav-section-title {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--foreground-light);
    letter-spacing: 0.05em;
}

.nav-item {
    padding: 0.5rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--foreground-light);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--surface);
    color: var(--primary);
}

.nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-link i {
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--danger);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-logout:hover {
    background-color: var(--danger);
    color: #ffffff;
}

/* ==================== TOPBAR ==================== */
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--foreground);
}

.breadcrumb {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
}

.topbar-item {
    position: relative;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--foreground-light);
    position: relative;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--primary);
}

.badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background-color: var(--danger);
    color: #ffffff;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    color: var(--foreground);
}

.btn-profile:hover {
    background-color: var(--surface);
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--surface);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    color: var(--foreground);
}

/* ==================== DROPDOWN MENU ==================== */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    margin-top: 0.5rem;
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.dropdown-menu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.dropdown-header {
    padding: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--foreground);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--surface);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.5rem 0;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.notification-item:hover {
    background-color: var(--surface);
}

.notification-item i {
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.notification-title {
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--foreground-light);
}

/* ==================== CARDS ==================== */
.card {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-dark);
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.card-description {
    font-size: 0.875rem;
    color: var(--foreground-light);
}

.card-content {
    margin-top: 1rem;
}

/* ==================== BOTÕES ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-dark);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ==================== INPUTS E FORMS ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    background-color: var(--background);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* ==================== TABELAS ==================== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--background);
}

.table thead {
    background-color: var(--surface);
    border-bottom: 2px solid var(--border);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--surface);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== GRID E LAYOUT ==================== */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ==================== UTILITÁRIOS ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--foreground-light); }

.bg-primary { background-color: var(--primary-light); }
.bg-success { background-color: #d1fae5; }
.bg-warning { background-color: #fef3c7; }
.bg-danger { background-color: #fee2e2; }

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-success { background-color: #d1fae5; color: var(--success); }
.badge-warning { background-color: #fef3c7; color: var(--warning); }
.badge-danger { background-color: #fee2e2; color: var(--danger); }

/* ==================== ANIMAÇÕES ==================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-slide-down {
    animation: slideDown 0.3s ease;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 250px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
        --topbar-height: 60px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 250px;
        height: 100vh;
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 1001;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        display: none;
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content {
        padding: 1rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.75rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    .footer {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .topbar {
        flex-direction: column;
        gap: 1rem;
        height: auto;
        padding: 1rem;
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .breadcrumb {
        font-size: 0.875rem;
    }

    .card {
        padding: 1rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.7rem;
    }

    .btn-profile span {
        display: none;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}
