:root {
  --primary: #4285f4;
  --background: #f8f9fa;
  --surface: #ffffff;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --success: #34a853;
  --warning: #fbbc04;
  --error: #ea4335;
  --border: #dadce0;
  --shadow: rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Google Sans", Roboto, Arial, sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
}

.container { display: flex; width: 100%; }

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--surface);
  padding: 24px 16px;
  box-shadow: 0 4px 12px var(--shadow);
  display: flex;
  flex-direction: column;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.logo h3 { font-size: 18px; font-weight: 500; }

.nav-links { list-style: none; margin-top: 24px; }
.nav-links li { margin-bottom: 8px; }
.nav-links a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; text-decoration: none;
  color: var(--text-secondary); border-radius: 8px;
  transition: all 0.2s ease;
}
.nav-links a:hover, .nav-links li.active a {
  background-color: #e8f0fe; color: var(--primary);
}

/* Main Content */
.main-content { flex: 1; padding: 24px; overflow-y: auto; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.user-actions { display: flex; align-items: center; gap: 16px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background-color: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center; font-weight: bold;
}

/* Progress Bar */
.progress-container {
  width: 100%; height: 4px; background-color: #e0e0e0;
  border-radius: 2px; overflow: hidden; margin-bottom: 24px;
}
.progress-bar {
  height: 100%; width: 0%; background-color: var(--primary);
  transition: width 0.3s ease;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--surface); padding: 20px; border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow); display: flex;
  align-items: center; gap: 16px; cursor: pointer; transition: all 0.2s;
}
.summary-card:hover {
  transform: translateY(-4px); box-shadow: 0 4px 16px var(--shadow);
}
.summary-card .material-icons { font-size: 36px; color: var(--primary); }
.summary-card div p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.summary-card div h3 { font-size: 24px; margin: 4px 0 0; color: var(--text-primary); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%; animation: loading 1.5s infinite;
}
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton .material-icons, .skeleton h3, .skeleton p { color: transparent !important; }

/* Table View */
.table-view { margin-top: 20px; }
.table-controls {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.search-box {
  position: relative; max-width: 300px; flex: 1;
}
.search-box input {
  width: 100%; padding: 10px 36px 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.search-box .material-icons {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-secondary); font-size: 20px;
}

.pagination-controls {
  display: flex; align-items: center; gap: 8px;
}
.pagination-controls select, .pagination-controls button {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: white; font-size: 14px;
}
.pagination-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
#page-info { min-width: 80px; text-align: center; font-weight: 500; }

/* Table */
.table-container {
  max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}
#data-table {
  width: 100%; border-collapse: collapse; min-width: 800px;
}
#data-table thead {
  position: sticky; top: 0; background: var(--surface); z-index: 10;
  box-shadow: 0 2px 4px var(--shadow);
}
#data-table th, #data-table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
#data-table th { font-weight: 600; color: var(--text-primary); background: #f1f3f4; }
#data-table tbody tr:hover { background-color: #f8f9fa; }
#data-table img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

/* ... (todos os estilos anteriores) ... */

/* E-books Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow);
  text-align: center;
  font-size: 14px;
}

.stat-card h4 {
  margin: 8px 0 4px;
  font-size: 20px;
  color: var(--primary);
}

.stat-card p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 13px;
}

.btn-pdf {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-pdf:hover {
  background: #3367d6;
}

.btn-pdf .material-icons {
  font-size: 16px;
}

/* ... (todos os estilos anteriores) ... */

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.5);
  overflow: auto;
}

.modal-content {
  background: var(--surface);
  margin: 5% auto;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px var(--shadow);
}

.modal-content.pdf {
  padding: 0;
  max-width: 90%;
  height: 90vh;
}

.close {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
}

.close:hover { color: var(--error); }

.modal h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Cards dentro do modal */
.modal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.modal-card {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border);
}

.modal-card h4 {
  margin: 8px 0;
  font-size: 18px;
  color: var(--primary);
}

.modal-card p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0;
}

/* PDF Viewer */
#pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 14px;
  margin-top: 8px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.results-info {
  margin: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.results-info strong {
  color: var(--text-primary);
}

/* === DROPDOWN MENU LATERAL === */
.nav-links .dropdown {
  position: relative;
}

.nav-links .dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: 0.2s;
}

.nav-links .dropdown-toggle:hover {
  background: var(--hover);
  color: var(--primary);
}

.dropdown-arrow {
  font-size: 18px !important;
  transition: transform 0.2s;
}

.dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 100;
}

.dropdown:hover .dropdown-menu {
  max-height: 300px;
  opacity: 1;
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: 0.2s;
}

.dropdown-menu a:hover {
  background: var(--hover);
  color: var(--primary);
}

.dropdown-menu .material-icons {
  font-size: 18px;
}

.dropdown.open .dropdown-menu {
  max-height: 300px !important;
  opacity: 1 !important;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: 0.2s;
  cursor: pointer;
}

.dropdown-link:hover {
  background: var(--hover);
  color: var(--primary);
}

.modal-content.pdf {
  padding: 0;
  max-width: 90%;
  height: 90vh;
}

.modal-content.pdf iframe,
.modal-content.pdf img {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  object-fit: contain; /* não corta imagem */
}

.modal-content.pdf {
  padding: 0 !important;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden; /* evita vazamento da imagem/pdf */
}
