/*
===================
FlatRead Modern Global Styles
===================
Modern utility classes and notifications
-------------------
Name: FlatRead Modern
Author: Marc Thibeault (Modernized)
Version: 2.0
Module: globals.css
*/

/* Utility Classes */
.alignleft { 
  float: left;
  margin-right: var(--space-md);
}

.alignright { 
  float: right;
  margin-left: var(--space-md);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.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;
}

/* Modern Notifications */
.msgs, ul.msgs {
  margin: var(--space-lg) 0;
  padding: 0;
  list-style: none;
}

.msgs li,
.notification {
  margin-bottom: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--border-radius-md);
  border-left: 4px solid;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.errors,
.notification-error {
  color: #b91c1c;
  background-color: #fef2f2;
  border-left-color: #ef4444;
  border: 1px solid #fecaca;
}

.errors a,
.notification-error a {
  color: #b91c1c;
  text-decoration: underline;
  font-weight: 600;
}

.errors a:hover,
.notification-error a:hover {
  color: #991b1b;
}

.notifications,
.enabled,
.notification-success {
  color: #065f46;
  background-color: #f0fdf4;
  border-left-color: #10b981;
  border: 1px solid #bbf7d0;
}

.notifications a,
.enabled a,
.notification-success a {
  color: #065f46;
  text-decoration: underline;
  font-weight: 600;
}

.warnings,
.notification-warning {
  color: #92400e;
  background-color: #fffbeb;
  border-left-color: #f59e0b;
  border: 1px solid #fed7aa;
}

.warnings a,
.notification-warning a {
  color: #92400e;
  text-decoration: underline;
  font-weight: 600;
}

.notification-info {
  color: #1e40af;
  background-color: #eff6ff;
  border-left-color: #3b82f6;
  border: 1px solid #bfdbfe;
}

.notification-info a {
  color: #1e40af;
  text-decoration: underline;
  font-weight: 600;
}

/* Form Field Errors */
.field-error {
  border: 2px solid var(--color-error) !important;
  background-color: #fef2f2;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error:focus {
  outline: 2px solid var(--color-error);
  outline-offset: 2px;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Status Indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-sm);
}

.status-online { background-color: var(--color-success); }
.status-offline { background-color: var(--color-error); }
.status-away { background-color: var(--color-warning); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background-color: var(--color-primary);
  color: white;
}

.badge-secondary {
  background-color: var(--color-background-tertiary);
  color: var(--color-text-secondary);
}

.badge-success {
  background-color: var(--color-success);
  color: white;
}

.badge-warning {
  background-color: var(--color-warning);
  color: white;
}

.badge-error {
  background-color: var(--color-error);
  color: white;
}

/* Responsive Utilities */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}

/* Focus Management */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  z-index: 1000;
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-text: #000000;
    --color-background: #ffffff;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
