* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; }
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: #1a1a2e; color: #fff; display: flex;
  flex-direction: column; position: fixed; height: 100vh;
  transition: width 0.2s ease;
}
.sidebar-header {
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 12px;
}
.hamburger-btn {
  background: transparent; border: none; color: #ccc; font-size: 1.3rem;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-title h2 { font-size: 1.4rem; margin-bottom: 4px; }
.admin-badge {
  display: inline-block; background: #0f3460; padding: 2px 10px;
  border-radius: 10px; font-size: 0.75rem;
}
.nav-menu { list-style: none; padding: 16px 0; flex: 1; }
.nav-item {
  padding: 12px 20px; cursor: pointer; display: flex; align-items: center;
  gap: 10px; font-size: 0.95rem; transition: background 0.2s; color: #ccc;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: #0f3460; color: #fff; }
.nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: #aaa;
}
.logout-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #ccc;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.logout-icon { display: none; font-size: 1rem; line-height: 1; }

/* Content */
.content {
  flex: 1; margin-left: 240px; padding: 24px;
  transition: margin-left 0.2s ease;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Collapsed sidebar */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-text,
.sidebar.collapsed #adminName,
.sidebar.collapsed .logout-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-icon { font-size: 1.3rem; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 16px 8px; }
.sidebar.collapsed .logout-btn { padding: 6px 8px; }
.sidebar.collapsed .logout-icon { display: inline; }
.content.collapsed { margin-left: 60px; }

/* Toolbar */
.toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
  background: #fff; padding: 14px 20px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.toolbar-right { margin-left: auto; display: flex; gap: 10px; }

/* Buttons */
.btn {
  padding: 8px 18px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; transition: opacity 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #0f3460; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1a1a2e; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover:not(:disabled) { background: #219a52; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c0392b; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #7f8c8d; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d68910; }
.btn-small { padding: 5px 12px; font-size: 0.82rem; }

/* Table */
.table-container {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f8f9fa; padding: 12px 16px; text-align: left;
  font-size: 0.82rem; text-transform: uppercase; color: #888;
  border-bottom: 2px solid #eee;
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
  font-size: 0.92rem;
}
.data-table tr:hover td { background: #fafbfc; }
.col-check { width: 40px; text-align: center; }
.col-actions { width: 80px; text-align: center; }
.data-table input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* Modals */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-width: 90vw;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-small { width: 400px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid #eee;
}
.modal-header h3 { font-size: 1.2rem; color: #1a1a2e; }
.modal-close {
  background: none; border: none; font-size: 1.6rem; cursor: pointer; color: #888;
  padding: 0 4px;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #eee; display: flex;
  justify-content: flex-end; gap: 10px;
}

/* Form groups in modals */
.modal-body .form-group { margin-bottom: 18px; }
.modal-body .form-group label {
  display: block; margin-bottom: 6px; font-weight: 600; color: #444; font-size: 0.88rem;
}
.modal-body .form-group input,
.modal-body .form-group select {
  width: 100%; padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 6px;
  font-size: 0.95rem; outline: none; transition: border-color 0.2s;
}
.modal-body .form-group input:focus,
.modal-body .form-group select:focus { border-color: #0f3460; }
.modal-body .form-group input:disabled {
  background: #f5f5f5; color: #888; cursor: not-allowed;
}

/* Page checkbox list */
.page-checkbox-list {
  border: 2px solid #e0e0e0; border-radius: 6px; max-height: 200px;
  overflow-y: auto; margin-top: 8px;
}
.page-checkbox-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0; font-size: 0.9rem;
}
.page-checkbox-item:last-child { border-bottom: none; }
.page-checkbox-item input { width: 16px; height: 16px; cursor: pointer; }

/* Upload zone */
.upload-zone {
  border: 2px dashed #ccc; border-radius: 8px; padding: 30px; text-align: center;
  cursor: pointer; transition: border-color 0.3s, background 0.3s; color: #888;
}
.upload-zone:hover { border-color: #0f3460; background: #f8f9fa; }
.upload-zone p { font-size: 0.9rem; }
.upload-info { margin-top: 8px; font-size: 0.85rem; color: #666; }

/* Modal inline actions */
.modal-actions-inline { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }

/* Readonly list */
.readonly-list {
  border: 2px solid #e0e0e0; border-radius: 6px; padding: 10px;
  max-height: 150px; overflow-y: auto; font-size: 0.9rem; color: #555;
  min-height: 40px;
}
.readonly-list span { display: inline-block; background: #f0f2f5; padding: 3px 10px; border-radius: 4px; margin: 2px; font-size: 0.85rem; }

.empty-state { text-align: center; padding: 40px; color: #aaa; font-size: 0.95rem; }

/* View Tab */
.view-layout { display: flex; gap: 16px; height: calc(100vh - 48px); }
.view-sidebar {
  width: 240px; background: #242442; color: #fff; border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
  transition: width 0.2s ease;
}
.view-sidebar-header {
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.95rem;
}
.view-header-icon { display: none; font-size: 1.1rem; line-height: 1; }
.view-page-list { list-style: none; padding: 8px 0; flex: 1; overflow-y: auto; }
.view-page-item {
  padding: 12px 20px; cursor: pointer; display: flex; align-items: center;
  gap: 10px; font-size: 0.95rem; transition: background 0.2s; color: #ccc;
  white-space: nowrap; overflow: hidden;
}
.view-page-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.view-page-item.active { background: #0f3460; color: #fff; }
.view-page-icon { font-size: 1.1rem; flex-shrink: 0; }
.view-page-size { margin-left: auto; font-size: 0.75rem; color: #888; }
.view-sidebar.collapsed { width: 60px; }
.view-sidebar.collapsed .view-sidebar-header { justify-content: center; padding: 16px 0; }
.view-sidebar.collapsed .view-header-text,
.view-sidebar.collapsed .view-page-name,
.view-sidebar.collapsed .view-page-size { display: none; }
.view-sidebar.collapsed .view-header-icon { display: inline; }
.view-sidebar.collapsed .view-page-item { justify-content: center; padding: 12px 0; }
.view-sidebar.collapsed .view-page-icon { font-size: 1.3rem; }
.view-main {
  flex: 1; background: #fff; border-radius: 10px; position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden;
}
.view-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: #aaa;
}
.view-welcome h1 { font-size: 1.6rem; margin-bottom: 8px; color: #888; }
.view-frame { display: none; width: 100%; height: 100%; border: none; }
.view-frame.active { display: block; }
.view-empty { padding: 20px; text-align: center; color: #aaa; font-size: 0.9rem; }

.error-msg {
  color: #e74c3c; text-align: center; margin-top: 12px; font-size: 0.88rem;
  display: none;
}
