/* =================================
   SHARED STYLES - Nodisa Labs
   Used across all tools
   ================================= */

/* CSS Reset & Base Styles */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body {
  font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #3F4C5C;
  background-color: #F6F8F9;
  padding: 20px;
  max-width: 8.5in;
  margin: 0 auto;
}

/* Header & Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 3px solid #2D7D7D;
  margin-bottom: 20px;
  top: 0;
  background: #fff;
  z-index: 100;
}

header .brand { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

header img { 
  height: 50px; 
}

header h1 { 
  margin: 0; 
  font-size: 1.5rem; 
  color: #2D7D7D; 
}

nav { 
  display: flex; 
  gap: 20px; 
}

nav a {
  text-decoration: none;
  color: #3F4C5C;
  font-weight: 500;
  transition: color 0.3s;
  padding: 8px 12px;
  border-radius: 4px;
}

nav a:hover { 
  color: #FF6B47;
  background-color: rgba(255, 107, 71, 0.1);
}

nav a.active {
  font-weight: 700;
  color: #FF6B47;
  border-bottom: 2px solid #FF6B47;
  padding-bottom: 6px;
  background-color: rgba(255, 107, 71, 0.05);
}

/* Coming Soon Navigation Links */
nav a.coming-soon {
  opacity: 0.6;
  position: relative;
  cursor: not-allowed;
  color: #6B7280;
}

nav a.coming-soon:hover {
  color: #6B7280;
  background-color: transparent;
}

/* Common Buttons */
.btn { 
  padding: 10px 14px; 
  border: 0; 
  border-radius: 8px; 
  background: #2D7D7D; 
  color: #fff; 
  cursor: pointer; 
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center; 
  gap: 8px;
  text-align: center; 
}

.btn:hover {
  background: #1E5A5A;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(45, 125, 125, 0.2);
}

.btn.secondary { 
  background: #f3f4f6; 
  color: #3F4C5C; 
  border: 1px solid #d1d5db; 
}

.btn.secondary:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
  transform: none;
  box-shadow: none;
}

.btn:focus {
  outline: 3px solid rgba(45, 125, 125, 0.3);
  outline-offset: 2px;
}

/* Loading spinner for buttons */
.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Footer */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid #E5F4F4;
  text-align: center;
  color: #6B7280;
  font-size: 12px;
}

.footer a {
  color: #2D7D7D;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  text-decoration: underline;
  color: #FF6B47;
}

/* Common Help Text */
.help-text { 
  font-size: 12px; 
  color: #6B7280; 
  font-style: italic; 
  margin-top: 4px; 
  line-height: 1.4;
}

/* =================================
   NOTIFICATION SYSTEM
   Used by SharedUtils.showNotification()
   ================================= */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  max-width: 500px;
  padding: 15px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.notification-close:hover {
  background-color: rgba(255,255,255,0.2);
}

.notification-info { 
  background: linear-gradient(135deg, #2D7D7D, #3498db); 
}

.notification-success { 
  background: linear-gradient(135deg, #27ae60, #2ecc71); 
}

.notification-error { 
  background: linear-gradient(135deg, #e74c3c, #c0392b); 
}

.notification-warning { 
  background: linear-gradient(135deg, #f39c12, #e67e22); 
}

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

/* =================================
   LOADING STATES
   Used by SharedUtils.showLoading()
   ================================= */

.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading-message {
  font-size: 0.9em;
}

/* =================================
   CONFIRMATION MODAL
   Used by SharedUtils.confirm()
   ================================= */

.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn 0.2s ease;
}

.confirm-modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  max-width: 400px;
  width: 90%;
  animation: slideInUp 0.3s ease;
}

.confirm-modal-header {
  padding: 20px 20px 0 20px;
}

.confirm-modal-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.2em;
}

.confirm-modal-body {
  padding: 15px 20px;
  color: #34495e;
  line-height: 1.5;
}

.confirm-modal-footer {
  padding: 0 20px 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-modal .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
}

.confirm-modal .btn-secondary {
  background: #95a5a6;
  color: white;
}

.confirm-modal .btn-secondary:hover {
  background: #7f8c8d;
}

.confirm-modal .btn-primary {
  background: #3498db;
  color: white;
}

.confirm-modal .btn-primary:hover {
  background: #2980b9;
}

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

@keyframes slideInUp {
  from { 
    transform: translateY(30px); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0); 
    opacity: 1; 
  }
}

/* Draft Banner Styles */
.draft-banner {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 1px solid #F59E0B;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  animation: fadeInDown 0.3s ease;
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.1);
}

.draft-content {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.draft-content span {
  flex: 1;
  min-width: 200px;
  font-weight: 500;
}

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

/* Common Loading States */
.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #2D7D7D;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Focus Indicators for Accessibility */
*:focus {
  outline: 3px solid rgba(45, 125, 125, 0.3);
  outline-offset: 2px;
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #2D7D7D;
  color: white;
  padding: 8px 12px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
  font-weight: 600;
}

.skip-link:focus {
  top: 6px;
}

/* Screen Reader Only Content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Common Link Styles */
a {
  color: #2D7D7D;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #FF6B47;
}

a:focus {
  outline: 2px solid #FF6B47;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  body { 
    padding: 10px; 
    font-size: 12px; 
    background: white;
    color: black;
  }
  
  header, 
  .notification, 
  .draft-banner,
  .btn { 
    display: none; 
  }
  
  .footer { 
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #000;
    font-size: 10px;
  }
  
  /* Ensure content doesn't break across pages */
  .section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  header {
    flex-direction: column;
    gap: 15px;
    padding: 15px 10px;
  }
  
  nav {
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  nav a {
    padding: 6px 10px;
    font-size: 14px;
  }
  
  header h1 {
    font-size: 1.3rem;
  }
  
  header img {
    height: 40px;
  }
  
  .notification {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    min-width: auto;
    max-width: none;
  }
  
  .draft-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .draft-content span {
    min-width: auto;
  }
  
  .confirm-modal {
    margin: 20px;
    width: auto;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  nav a:hover,
  nav a.active {
    background-color: #FF6B47;
    color: white;
  }
  
  .btn:focus {
    outline: 3px solid #FF6B47;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .btn:hover {
    transform: none;
  }
}