/**
 * Novel Education Partners - Shared UI Styles
 * Base layout, sidebar, header, user dropdown, and common components.
 */

/* Reset */
* { box-sizing: border-box; }

/* Body alignment for 250px sidebar */
html body {
  padding-left: 250px !important;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  color: #333 !important;
}

/* Content area typography - consistent across all Novel pages */
#novel-main,
#novel-main *:not(svg):not(svg *) {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

#novel-main h1 {
  font-size: 1.75rem !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin: 0 0 16px 0 !important;
  line-height: 1.3 !important;
}

#novel-main h2 {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin: 32px 0 16px 0 !important;
  line-height: 1.3 !important;
}

#novel-main h3 {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin: 24px 0 12px 0 !important;
  line-height: 1.3 !important;
}

#novel-main p {
  font-size: 0.95rem !important;
  line-height: 1.7 !important;
  color: #555 !important;
  margin-bottom: 16px !important;
}

#novel-main ul,
#novel-main ol {
  margin: 16px 0 !important;
  padding-left: 24px !important;
}

#novel-main li {
  margin-bottom: 8px !important;
  color: #555 !important;
  font-size: 0.95rem !important;
  line-height: 1.7 !important;
}

#novel-main a {
  color: #1470AF !important;
  text-decoration: none !important;
}

#novel-main a:hover {
  color: #2d5a87 !important;
  text-decoration: underline !important;
}

/* Button links should have white text, not blue */
#novel-main a.novel-btn-primary,
#novel-main a.novel-support-btn,
#novel-main a.novel-urgent-btn,
#novel-main a.novel-account-btn.primary {
  color: #fff !important;
  text-decoration: none !important;
}

#novel-main a.novel-btn-primary:hover,
#novel-main a.novel-support-btn:hover,
#novel-main a.novel-urgent-btn:hover,
#novel-main a.novel-account-btn:hover,
#novel-main a.novel-account-btn.primary:hover {
  color: #fff !important;
  text-decoration: none !important;
}

/* Sidebar background - force #1470AF on all pages */
#novel-sidebar,
.novel-sidebar {
  background: #1470AF !important;
  background-color: #1470AF !important;
}

/* Header navbar */
#novel-header {
  position: fixed;
  top: 0;
  left: 250px;
  right: 0;
  height: 74px;
  min-height: 74px;
  background: #1470AF;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
}

#novel-header a {
  color: #fff;
  text-decoration: none;
}

#novel-header .header-left .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

#novel-header .header-left .back-btn:hover {
  background: rgba(255,255,255,0.2);
}

#novel-header .site-name {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
}

#novel-header .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 100;
}

/* Novel User Dropdown */
#novel-header .novel-user-dropdown,
.novel-user-dropdown {
  position: relative !important;
  display: block !important;
}

/* Invisible overlay to catch outside clicks */
.novel-user-dropdown__overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999998;
}

.novel-user-dropdown.active .novel-user-dropdown__overlay {
  display: block;
}

/* Force font consistency */
html body .novel-user-dropdown,
html body .novel-user-dropdown *,
html body .novel-user-dropdown__name,
html body .novel-user-dropdown__email,
html body #novel-header .novel-user-dropdown,
html body #novel-header .novel-user-dropdown *,
html body #novel-header .novel-user-dropdown__name,
html body #novel-header .novel-user-dropdown__email {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

#novel-header .novel-user-dropdown__trigger,
.novel-user-dropdown__trigger {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  transition: background-color 0.2s ease;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 1 !important;
}

#novel-header .novel-user-dropdown__trigger:hover,
.novel-user-dropdown__trigger:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.novel-user-dropdown__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.novel-user-dropdown__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

html body .novel-user-dropdown__name,
html body #novel-header .novel-user-dropdown__name {
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  line-height: 1.3 !important;
}

html body .novel-user-dropdown__email,
html body #novel-header .novel-user-dropdown__email {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

.novel-user-dropdown__arrow {
  color: #ffffff;
  font-size: 1.2rem;
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.novel-user-dropdown.active .novel-user-dropdown__arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu - using specific selectors to prevent override */
#novel-header .novel-user-dropdown__menu,
.novel-user-dropdown__menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 8px !important;
  background: #ffffff !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  min-width: 200px !important;
  padding: 8px 0 !important;
  display: none !important;
  z-index: 999999 !important;
  list-style: none !important;
  margin: 8px 0 0 0 !important;
}

#novel-header .novel-user-dropdown.active .novel-user-dropdown__menu,
.novel-user-dropdown.active .novel-user-dropdown__menu {
  display: block !important;
}

#novel-header .novel-user-dropdown__menu li,
.novel-user-dropdown__menu li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

.novel-user-dropdown__menu li a,
#novel-header .novel-user-dropdown__menu li a {
  display: block !important;
  padding: 12px 20px !important;
  color: #333333 !important;
  text-decoration: none !important;
  font-size: 15px !important;
  transition: background-color 0.15s ease;
  background: transparent !important;
  line-height: 1.4 !important;
}

.novel-user-dropdown__menu li a:hover,
#novel-header .novel-user-dropdown__menu li a:hover {
  background: #f5f5f5 !important;
  color: #1470AF !important;
}

/* Hide info on smaller screens */
@media (max-width: 768px) {
  .novel-user-dropdown__info {
    display: none;
  }
  .novel-user-dropdown__arrow {
    display: none;
  }
}

/* Main content area */
#novel-main {
  margin-top: 65px;
  padding: 32px 40px;
  min-height: calc(100vh - 65px);
  background: #fff;
}

/* Common button styles */
.novel-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #1470AF;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.novel-btn-primary:hover {
  background: #2d5a87;
  color: #fff;
}

/* Messages and errors */
.novel-message {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.novel-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.novel-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ─── Announcements Banner ─────────────────────────────────────────── */
/* Using #novel-main prefix for higher specificity (Safari compatibility) */
#novel-main .novel-announcements-banner,
.novel-announcements-banner {
  display: block !important;
  background: #f8fafc !important;
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 16px 20px !important;
  margin-bottom: 24px !important;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

#novel-main .novel-announcements-banner .announcements-header,
.novel-announcements-banner .announcements-header {
  display: -webkit-flex !important;
  display: flex !important;
  -webkit-align-items: center;
  align-items: center !important;
  gap: 8px;
  margin-bottom: 12px !important;
  padding-bottom: 12px !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

#novel-main .novel-announcements-banner .announcements-icon,
.novel-announcements-banner .announcements-icon {
  color: #1470AF !important;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

#novel-main .novel-announcements-banner .announcements-title,
.novel-announcements-banner .announcements-title {
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  color: #333 !important;
}

#novel-main .novel-announcements-banner .announcements-count,
.novel-announcements-banner .announcements-count {
  display: inline-block !important;
  background: #1470AF !important;
  background-color: #1470AF !important;
  color: #fff !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 2px 8px !important;
  border-radius: 12px !important;
  margin-left: 4px !important;
}

#novel-main .novel-announcements-banner .announcements-items,
.novel-announcements-banner .announcements-items {
  display: -webkit-flex !important;
  display: flex !important;
  -webkit-flex-direction: column;
  flex-direction: column !important;
  gap: 12px;
}

#novel-main .novel-announcements-banner .announcement-item,
.novel-announcements-banner .announcement-item {
  display: block !important;
  padding: 12px 16px !important;
  background: #fff !important;
  background-color: #fff !important;
  border-radius: 6px !important;
  border-left: 3px solid #1470AF !important;
  -webkit-transition: box-shadow 0.15s ease;
  transition: box-shadow 0.15s ease;
  margin-bottom: 12px;
}

#novel-main .novel-announcements-banner .announcement-item:last-child {
  margin-bottom: 0;
}

#novel-main .novel-announcements-banner .announcement-item:hover,
.novel-announcements-banner .announcement-item:hover {
  -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#novel-main .novel-announcements-banner .announcement-item.priority-urgent,
.novel-announcements-banner .announcement-item.priority-urgent {
  border-left-color: #dc3545 !important;
  background: #fff5f5 !important;
  background-color: #fff5f5 !important;
}

#novel-main .novel-announcements-banner .announcement-content h4,
.novel-announcements-banner .announcement-content h4 {
  margin: 0 0 6px 0 !important;
  padding: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

#novel-main .novel-announcements-banner .announcement-content h4 a,
.novel-announcements-banner .announcement-content h4 a {
  color: #333 !important;
  text-decoration: none !important;
}

#novel-main .novel-announcements-banner .announcement-content h4 a:hover,
.novel-announcements-banner .announcement-content h4 a:hover {
  color: #1470AF !important;
}

#novel-main .novel-announcements-banner .announcement-meta,
.novel-announcements-banner .announcement-meta {
  display: -webkit-flex !important;
  display: flex !important;
  -webkit-align-items: center;
  align-items: center !important;
  gap: 8px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

#novel-main .novel-announcements-banner .announcement-date,
.novel-announcements-banner .announcement-date {
  font-size: 0.8rem !important;
  color: #666 !important;
}

#novel-main .novel-announcements-banner .announcement-badge,
.novel-announcements-banner .announcement-badge {
  display: inline-block !important;
  font-size: 0.7rem !important;
  background: #e8f4fc !important;
  background-color: #e8f4fc !important;
  color: #1470AF !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-weight: 500 !important;
}

#novel-main .novel-announcements-banner .announcements-view-all,
#novel-main a.announcements-view-all,
.novel-announcements-banner .announcements-view-all {
  display: inline-block !important;
  margin-top: 12px !important;
  padding-top: 12px !important;
  border-top: 1px solid #e2e8f0 !important;
  width: 100% !important;
  font-size: 0.85rem !important;
  color: #1470AF !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}

#novel-main .novel-announcements-banner .announcements-view-all:hover,
#novel-main a.announcements-view-all:hover,
.novel-announcements-banner .announcements-view-all:hover {
  text-decoration: underline !important;
}
