/**
 * PRNT Platform — Global Styles (main.css)
 * 
 * Header, Navbar, Footer, Buttons, Forms, Badges, Notifications, Typography,
 * and Universal Custom Dropdown System.
 * @package PRNT
 */

/* ═══════════════════════════════════════════
   GLOBAL TYPOGRAPHY & BASE STYLES
   ═══════════════════════════════════════════ */
body {
  font-family: var(--font-primary);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: var(--lh-normal);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
}

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

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

/* ═══════════════════════════════════════════
   CONTAINER & SECTION UTILITIES
   ═══════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section {
  padding: 5rem 0;
  position: relative;
}

.section-header {
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* ═══════════════════════════════════════════
   HEADER & NAVBAR
   ═══════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  width: 100%;
  height: var(--navbar-height);
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: all var(--transition-normal);
}

.navbar__inner {
  max-width: var(--container-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-primary);
  text-decoration: none;
}

.navbar__logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: var(--fw-extrabold);
  box-shadow: var(--shadow-sm);
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.navbar__link {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
  padding: 0.5rem 0;
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--accent-primary);
}

.navbar__link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

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

/* ── Theme Toggle Button ── */
.theme-toggle {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
[data-theme="dark"] .theme-toggle__icon--sun { display: inline-flex; color: #fbbf24; }

[data-theme="light"] .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: inline-flex; color: var(--accent-primary); }

/* ── Mobile Hamburger ── */
.navbar__hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.navbar__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-fast);
}

.navbar__mobile-menu {
  display: none;
  position: absolute;
  top: var(--navbar-height);
  left: 0;
  width: 100%;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  gap: 1rem;
}

.navbar__mobile-menu.is-open {
  display: flex;
}

.navbar__mobile-link {
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  padding: 0.5rem 0;
  text-decoration: none;
}

@media (max-width: 992px) {
  .navbar__links { display: none; }
  .navbar__hamburger { display: flex; }
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent-gradient);
  color: #ffffff !important;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
  color: #ffffff !important;
}

.btn--secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color);
  color: var(--text-primary) !important;
}

.btn--secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-accent);
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary) !important;
}

.btn--ghost:hover {
  background: var(--bg-surface-elevated);
}

.btn--sm {
  padding: 0.45rem 0.95rem;
  font-size: var(--fs-xs);
}

.btn--lg {
  padding: 0.85rem 2rem;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════
   FORMS & INPUTS
   ═══════════════════════════════════════════ */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  background: var(--bg-body);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-helper {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ═══════════════════════════════════════════
   UNIVERSAL CUSTOM DROPDOWN COMPONENT
   ═══════════════════════════════════════════ */
.custom-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
  user-select: none;
}

.custom-dropdown__trigger {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.custom-dropdown__trigger:hover {
  border-color: var(--border-hover);
}

.custom-dropdown.is-open .custom-dropdown__trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  background: var(--bg-body);
}

.custom-dropdown__label {
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-weight: var(--fw-medium);
  text-align: left;
}

.custom-dropdown__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.custom-dropdown.is-open .custom-dropdown__chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

/* ── Floating Dropdown Menu ── */
.custom-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 190px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-surface-elevated);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

.custom-dropdown.is-open .custom-dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Smart Auto-Flip (Dropup Mode) ── */
.custom-dropdown.is-dropup .custom-dropdown__menu {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateY(6px) scale(0.98);
}

.custom-dropdown.is-dropup.is-open .custom-dropdown__menu {
  transform: translateY(0) scale(1);
}

/* ── Dropdown Item ── */
.custom-dropdown__item {
  padding: 0.65rem 0.85rem;
  font-size: var(--fs-sm);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.custom-dropdown__item:hover {
  background: var(--border-subtle);
  color: var(--accent-primary);
}

.custom-dropdown__item.is-selected {
  background: var(--bg-card);
  color: var(--accent-primary);
  font-weight: var(--fw-bold);
  border: 1px solid var(--border-accent);
}

.custom-dropdown__check {
  display: inline-flex;
  align-items: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   BADGES & ALERTS
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.3px;
  line-height: 1;
}

.badge-ok {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

.badge-err {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger);
}

.badge-warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
}

.badge-info {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info);
}

/* ── Flash Notifications ── */
.flash-alert {
  max-width: var(--container-max);
  margin: 1.5rem auto 0;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-sm);
}

.flash-alert--success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

.flash-alert--error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger);
}

.flash-alert--info {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info);
}

.flash-alert__close {
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  opacity: 0.75;
  transition: opacity var(--transition-fast);
}

.flash-alert__close:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 4.5rem 0 2rem;
  margin-top: auto;
}

.footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

@media (max-width: 992px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 576px) {
  .footer__grid {
    grid-template-columns: 1fr;
  }
}

.footer__brand-desc {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-top: 1rem;
  max-width: 320px;
  line-height: 1.6;
}

.footer__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer__link {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--accent-primary);
}

.footer__bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 1rem;
}