/* ===================================
   UI COMPONENTS
   Consolidates: nav-styles.css, loading.css, toast.css
   Plus: Modern component enhancements
   =================================== */

/* ===================================
   NAVIGATION COMPONENTS
   =================================== */

/* Navigation Bar */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--card-background);
  padding: 15px 20px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-logo {
  height: 40px;
  width: auto;
  transition: transform var(--transition-fast);
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-links {
  display: flex;
  gap: 15px;
  align-items: center;
}

.nav-link-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-link.active {
  background-color: var(--secondary-color);
  box-shadow: var(--shadow-sm);
}

/* Navigation Dropdown */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: var(--card-background);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 5px 0;
  min-width: 220px;
  z-index: calc(var(--z-dropdown) + 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-link-wrapper:hover .nav-dropdown {
  display: block;
  animation: slideDown 0.2s ease-out;
}

.nav-dropdown:hover {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color var(--transition-fast);
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  background-color: rgba(221, 114, 0, 0.2);
}

/* Quick Page Toggle Button */
.page-toggle-button {
  position: fixed;
  top: 75px;
  right: 20px;
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  z-index: 999;
  text-decoration: none;
}

.page-toggle-button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.page-toggle-button.show {
  display: flex;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-user-info {
  color: var(--text-color);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-menu-btn {
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-base);
  font-weight: 500;
}

.profile-menu-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: fixed;
  top: 60px;
  right: 20px;
  background: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 10px 0;
  min-width: 200px;
  display: none;
  z-index: calc(var(--z-dropdown) + 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-dropdown.show {
  display: block;
  animation: slideDown 0.2s ease-out;
}

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

.profile-dropdown-item:hover {
  background-color: rgba(221, 114, 0, 0.2);
}

.profile-dropdown-divider {
  height: 1px;
  background-color: var(--divider-color);
  margin: 5px 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  cursor: pointer;
}

/* ===================================
   MODAL COMPONENTS
   =================================== */

.nav-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.nav-modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.nav-modal-content {
  background: var(--card-background);
  padding: 30px;
  border-radius: var(--radius-xl);
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.nav-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.nav-modal-header h2 {
  color: var(--text-color);
  margin: 0;
  font-size: 20px;
}

.nav-modal-close {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-modal-close:hover {
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-modal-content .form-group {
  margin-bottom: 20px;
}

.nav-modal-content .form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
}

.nav-modal-content .form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  box-sizing: border-box;
  background: white;
  color: #333;
  transition: border-color var(--transition-fast);
}

.nav-modal-content .form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(221, 114, 0, 0.1);
}

.nav-modal-btn {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 600;
}

.nav-modal-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-modal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.nav-modal-content .message {
  padding: 10px;
  border-radius: var(--radius-md);
  margin-top: 15px;
  font-size: 14px;
  display: none;
}

.nav-modal-content .error-message {
  color: var(--error-color);
  background: var(--error-bg);
  border: 1px solid var(--error-color);
  display: block;
}

.nav-modal-content .success-message {
  color: var(--success-color);
  background: var(--success-bg);
  border: 1px solid var(--success-color);
  display: block;
}

.nav-modal-content .help-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
}

/* ===================================
   LOADING COMPONENTS
   =================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%,
  20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%,
  100% {
    content: '...';
  }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

.loading-message {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background-color: rgba(221, 114, 0, 0.1);
  border-left: 3px solid var(--primary-color);
  border-radius: var(--radius-md);
  margin: 10px 0;
}

.loading-message .spinner-small {
  margin-left: 0;
}

/* ===================================
   TOAST NOTIFICATION SYSTEM
   =================================== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 500px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: all;
  animation: slideInRight 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

.toast.removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  margin: 0;
}

.toast-message {
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #333;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: currentColor;
  opacity: 0.3;
  animation: progress linear forwards;
}

@keyframes progress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Toast Types */
.toast.success {
  border-left: 4px solid #10b981;
}

.toast.success .toast-icon {
  color: #10b981;
}

.toast.success .toast-progress {
  color: #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.error .toast-icon {
  color: #ef4444;
}

.toast.error .toast-progress {
  color: #ef4444;
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

.toast.warning .toast-icon {
  color: #f59e0b;
}

.toast.warning .toast-progress {
  color: #f59e0b;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

.toast.info .toast-icon {
  color: #3b82f6;
}

.toast.info .toast-progress {
  color: #3b82f6;
}

.toast:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.toast:not(:last-child) {
  margin-bottom: 0;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Content spacing for fixed nav */
body {
  padding-top: 70px;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--card-background);
    padding: 10px;
    box-shadow: var(--shadow-lg);
  }

  .nav-user-info {
    font-size: 12px;
  }

  .toast-container {
    top: 70px;
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}
