/* ===================================
   OpenPDF App - CSS Migliorato
   Stile coerente con Homepage
   =================================== */

:root {
  /* Colori principali - Rosso e Bianco come Homepage */
  --of-red: #dc2626;
  --of-red-dark: #b91c1c;
  --of-red-light: #fef2f2;
  --of-red-lighter: #fee2e2;
  
  /* Colori neutri */
  --of-white: #ffffff;
  --of-gray-50: #f9fafb;
  --of-gray-100: #f3f4f6;
  --of-gray-200: #e5e7eb;
  --of-gray-300: #d1d5db;
  --of-gray-400: #9ca3af;
  --of-gray-500: #6b7280;
  --of-gray-600: #4b5563;
  --of-gray-700: #374151;
  --of-gray-800: #1f2937;
  --of-gray-900: #111827;
  
  /* Colori funzionali */
  --of-success: #10b981;
  --of-success-light: #ecfdf5;
  --of-danger: #ef4444;
  --of-danger-light: #fef2f2;
  --of-warning: #f59e0b;
  --of-warning-light: #fffbeb;
  --of-info: #3b82f6;
  --of-info-light: #eff6ff;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Reset e Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.of-body {
  margin: 0;
  background: var(--of-gray-50);
  color: var(--of-gray-800);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Links */
a {
  color: var(--of-red);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  color: var(--of-red-dark);
  text-decoration: none;
}

/* Container */
.of-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

@media (max-width: 768px) {
  .of-container {
    margin: 20px auto;
    padding: 0 15px;
  }
}

/* ===================================
   HEADER - Nuovo Design
   =================================== */
.of-header {
  background: var(--of-white);
  border-bottom: 1px solid var(--of-gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.98);
}

.of-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  height: 72px;
}

/* Logo */
.of-logo {
  font-weight: 800;
  font-size: 28px;
  color: var(--of-gray-800);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: transform var(--transition-base);
}

.of-logo:hover {
  transform: scale(1.05);
  text-decoration: none;
}

.of-logo span {
  color: var(--of-red);
}

/* Navigation */
.of-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.of-nav a {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--of-gray-600);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.of-nav a:hover {
  color: var(--of-red);
  background: var(--of-red-light);
  transform: translateY(-1px);
}

.of-nav a.active {
  color: var(--of-red);
  background: var(--of-red-light);
  font-weight: 600;
}

/* Header Actions */
.of-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ===================================
   BUTTONS - Stile Homepage
   =================================== */
.of-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none !important;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Primary Button */
.of-btn {
  background: var(--of-red);
  color: var(--of-white);
  border-color: var(--of-red);
  box-shadow: 0 4px 6px rgba(220, 38, 38, 0.25);
}

.of-btn:hover {
  background: var(--of-red-dark);
  border-color: var(--of-red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(220, 38, 38, 0.35);
  color: var(--of-white);
}

/* Ghost Button */
.of-btn--ghost {
  background: transparent;
  color: var(--of-red);
  border-color: var(--of-red);
  box-shadow: none;
}

.of-btn--ghost:hover {
  background: var(--of-red);
  color: var(--of-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Danger Button */
.of-btn--danger {
  background: var(--of-danger);
  border-color: var(--of-danger);
  color: var(--of-white);
}

.of-btn--danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Success Button */
.of-btn--success {
  background: var(--of-success);
  border-color: var(--of-success);
  color: var(--of-white);
}

/* Large Button */
.of-btn--xl {
  padding: 16px 32px;
  font-size: 17px;
  border-radius: var(--radius-lg);
}

/* Small Button */
.of-btn--sm {
  padding: 8px 16px;
  font-size: 14px;
}

/* Icon in button */
.of-btn-icon {
  font-size: 1.2em;
}

/* ===================================
   CARDS - Nuovo Design
   =================================== */
.of-card {
  background: var(--of-white);
  border: 1px solid var(--of-gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.of-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Card con bordo colorato */
.of-card--accent {
  border-top: 3px solid var(--of-red);
}

/* Card Header */
.of-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--of-gray-100);
}

.of-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--of-gray-800);
  margin: 0;
}

/* Card Body */
.of-card__body {
  color: var(--of-gray-600);
}

/* Card Footer */
.of-card__footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--of-gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===================================
   TABLES - Design Moderno
   =================================== */
.of-table-wrapper {
  overflow-x: auto;
  background: var(--of-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.of-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.of-table thead {
  background: var(--of-gray-50);
}

.of-table th {
  font-weight: 600;
  font-size: 13px;
  color: var(--of-gray-700);
  text-align: left;
  padding: 14px 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--of-gray-200);
}

.of-table td {
  padding: 16px;
  border-bottom: 1px solid var(--of-gray-100);
  color: var(--of-gray-700);
}

.of-table tbody tr {
  transition: all var(--transition-fast);
}

.of-table tbody tr:hover {
  background: var(--of-red-light);
}

.of-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Actions */
.of-table__actions {
  display: flex;
  gap: 8px;
}

.of-table__actions .of-btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* ===================================
   FORMS - Design Pulito
   =================================== */
.of-form {
  max-width: 600px;
}

.of-form-group {
  margin-bottom: 24px;
}

.of-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--of-gray-700);
  font-size: 14px;
}

.of-form label span.required {
  color: var(--of-red);
}

.of-input,
.of-select,
.of-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--of-gray-200);
  border-radius: var(--radius-md);
  background: var(--of-white);
  font-size: 15px;
  transition: all var(--transition-fast);
  color: var(--of-gray-800);
}

.of-input:focus,
.of-select:focus,
.of-textarea:focus {
  outline: none;
  border-color: var(--of-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.of-input::placeholder,
.of-textarea::placeholder {
  color: var(--of-gray-400);
}

.of-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

/* Form Help Text */
.of-form-help {
  margin-top: 6px;
  font-size: 13px;
  color: var(--of-gray-500);
}

/* Form Error */
.of-form-error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--of-danger);
}

.of-input--error {
  border-color: var(--of-danger);
}

/* ===================================
   FILE UPLOAD - Design Moderno
   =================================== */
.of-file {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.of-file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--of-red) 0%, var(--of-red-dark) 100%);
  color: var(--of-white);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 6px rgba(220, 38, 38, 0.25);
  border: none;
}

.of-file-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(220, 38, 38, 0.35);
  text-decoration: none;
  color: var(--of-white);
}

.of-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.of-file-icon {
  font-size: 20px;
}

.of-file-name {
  color: var(--of-gray-600);
  font-size: 14px;
  padding: 8px 16px;
  background: var(--of-gray-100);
  border-radius: var(--radius-md);
}

/* ===================================
   FLASH MESSAGES - Alerts Moderni
   =================================== */
.of-flash {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
  position: relative;
  font-weight: 500;
}

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

.of-flash--ok {
  background: var(--of-success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.of-flash--error {
  background: var(--of-danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.of-flash--warning {
  background: var(--of-warning-light);
  color: #92400e;
  border: 1px solid #fed7aa;
}

.of-flash--info {
  background: var(--of-info-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.of-flash::before {
  font-size: 20px;
}

.of-flash--ok::before {
  content: '✓';
  color: var(--of-success);
}

.of-flash--error::before {
  content: '⚠';
  color: var(--of-danger);
}

/* ===================================
   FOOTER - Stile Homepage
   =================================== */
.of-footer {
  margin-top: 80px;
  border-top: 1px solid var(--of-gray-200);
  background: linear-gradient(180deg, var(--of-white) 0%, var(--of-gray-50) 100%);
  padding: 40px 0;
}

.of-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.of-footer__inner p {
  color: var(--of-gray-600);
  margin: 0;
}

.of-footer__inner a {
  color: var(--of-gray-600);
  transition: color var(--transition-fast);
}

.of-footer__inner a:hover {
  color: var(--of-red);
}

/* ===================================
   UTILITY CLASSES
   =================================== */

/* Spacing */
.of-mt-1 { margin-top: 8px; }
.of-mt-2 { margin-top: 16px; }
.of-mt-3 { margin-top: 24px; }
.of-mt-4 { margin-top: 32px; }
.of-mb-1 { margin-bottom: 8px; }
.of-mb-2 { margin-bottom: 16px; }
.of-mb-3 { margin-bottom: 24px; }
.of-mb-4 { margin-bottom: 32px; }

/* Text Utilities */
.of-text-center { text-align: center; }
.of-text-right { text-align: right; }
.of-text-muted { color: var(--of-gray-500); }
.of-text-danger { color: var(--of-danger); }
.of-text-success { color: var(--of-success); }

/* Display */
.of-d-flex { display: flex; }
.of-d-grid { display: grid; }
.of-d-none { display: none; }
.of-d-block { display: block; }

/* Flex Utilities */
.of-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.of-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.of-gap-1 { gap: 8px; }
.of-gap-2 { gap: 16px; }
.of-gap-3 { gap: 24px; }

/* Grid Layout */
.of-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.of-col {
  flex: 1 1 300px;
}

.of-col-full {
  flex: 1 1 100%;
}

.of-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.of-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

/* Badges */
.of-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.of-badge--red {
  background: var(--of-red-light);
  color: var(--of-red-dark);
}

.of-badge--success {
  background: var(--of-success-light);
  color: #065f46;
}

.of-badge--warning {
  background: var(--of-warning-light);
  color: #92400e;
}

/* Progress Bar */
.of-progress {
  height: 8px;
  background: var(--of-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 16px 0;
}

.of-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--of-red) 0%, var(--of-red-dark) 100%);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Loading Spinner */
.of-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--of-gray-300);
  border-top-color: var(--of-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Stats Cards */
.of-stat {
  background: var(--of-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.of-stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.of-stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--of-red);
  margin-bottom: 8px;
}

.of-stat-label {
  color: var(--of-gray-600);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  .of-header__inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 15px;
  }
  
  .of-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 12px;
    border-top: 1px solid var(--of-gray-200);
    margin-top: 12px;
  }
  
  .of-actions {
    flex-wrap: nowrap;
  }
  
  .of-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .of-row {
    flex-direction: column;
  }
  
  .of-col {
    flex: 1 1 100%;
  }
  
  .of-footer__inner {
    flex-direction: column;
    text-align: center;
  }
  
  .of-table-wrapper {
    margin: 0 -15px;
    border-radius: 0;
  }
}

/* ===================================
   ANIMAZIONI AGGIUNTIVE
   =================================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.of-pulse {
  animation: pulse 2s infinite;
}

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

.of-fade-in {
  animation: fadeIn 0.5s ease;
}

/* ===================================
   DARK MODE (Opzionale)
   =================================== */
@media (prefers-color-scheme: dark) {
  /* Puoi aggiungere supporto dark mode qui se necessario */
}

/* Toggle password button */
.of-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.of-password-toggle:hover {
  opacity: 1;
}

.of-password-wrapper {
  position: relative;
}

.of-password-wrapper input {
  padding-right: 40px;
}


