/* ==========================================================================
   REVOAGRO BRAND DESIGN SYSTEM & GLOBAL STYLES
   ========================================================================== */

:root {
  /* Brand Colors */
  --color-brand-primary: #0a4628;    /* Dark Green */
  --color-brand-secondary: #3b8a51;  /* Light Green */
  --color-brand-accent: #f5b025;     /* Golden Yellow / Orange */
  
  /* UI Colors - Dark Mode Theme */
  --color-bg-darkest: #0c120e;
  --color-bg-dark: #121a15;
  --color-bg-card: #1b261f;
  --color-border: #2a3a30;
  --color-text-primary: #f0f5f2;
  --color-text-secondary: #9aafaa;
  
  /* System States */
  --color-success: #2ec4b6;
  --color-danger: #e71d36;
  --color-warning: #ff9f1c;
  --color-info: #00b4d8;
  
  /* Fonts */
  --font-family-display: 'Outfit', sans-serif;
  --font-family-sans: 'Inter', sans-serif;
  
  /* Layout details */
  --sidebar-width: 280px;
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --glass-effect: rgba(27, 38, 31, 0.7);
  --glass-border: rgba(59, 138, 81, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--color-bg-darkest);
  color: var(--color-text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg-darkest);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-brand-secondary);
}

/* Utility classes */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.bold {
  font-weight: 700;
}

/* Button systems */
button {
  cursor: pointer;
  font-family: var(--font-family-sans);
  border: none;
  background: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
  color: white;
  border-radius: var(--border-radius-md);
  padding: 12px 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(10, 70, 40, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(10, 70, 40, 0.6);
  filter: brightness(1.1);
}
.btn-primary:active {
  transform: translateY(0);
}

/* ==========================================================================
   1. LOGIN SCREEN STYLING
   ========================================================================== */

#login-screen {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: radial-gradient(circle at center, #1b3525 0%, var(--color-bg-darkest) 100%);
}

#login-screen.active {
  display: flex;
}

.login-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('logo.jpg') no-repeat center center;
  background-size: cover;
  opacity: 0.03;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass-effect);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 35px;
}

.login-logo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-brand-secondary);
  padding: 3px;
  background: white;
  margin-bottom: 15px;
  box-shadow: 0 4px 15px rgba(59, 138, 81, 0.3);
}

.login-header h2 {
  font-family: var(--font-family-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff, var(--color-brand-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
}

.login-header p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.login-card .form-group {
  margin-bottom: 22px;
}

.login-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.login-card label i {
  width: 14px;
  height: 14px;
  color: var(--color-brand-secondary);
}

.login-card input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  color: white;
  font-family: var(--font-family-sans);
  font-size: 15px;
  transition: all var(--transition-fast);
}

.login-card input:focus {
  border-color: var(--color-brand-secondary);
  box-shadow: 0 0 0 3px rgba(59, 138, 81, 0.25);
  background: rgba(0, 0, 0, 0.5);
}

.error-message {
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 15px;
  min-height: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.login-btn {
  width: 100%;
  margin-top: 10px;
}

.login-footer {
  text-align: center;
  margin-top: 35px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
}

.login-footer p {
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

/* ==========================================================================
   2. APP SCREEN (DASHBOARD & MAIN VIEW)
   ========================================================================== */

#app-screen {
  display: none;
  min-height: 100vh;
}

#app-screen.active {
  display: flex;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-bg-dark);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
}

.brand-logo {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  border: 1px solid var(--color-brand-secondary);
  padding: 2px;
}

.brand-text h3 {
  font-family: var(--font-family-display);
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.brand-text span {
  font-size: 10px;
  color: var(--color-brand-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.sidebar-menu {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--color-text-secondary);
  border-radius: var(--border-radius-md);
  font-weight: 500;
  font-size: 15px;
  text-align: left;
  transition: all var(--transition-fast);
}

.menu-item i {
  width: 20px;
  height: 20px;
}

.menu-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
  color: white;
  background: linear-gradient(90deg, rgba(10, 70, 40, 0.3) 0%, rgba(59, 138, 81, 0.1) 100%);
  border-left: 3px solid var(--color-brand-secondary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand-secondary);
}

.user-avatar i {
  width: 18px;
  height: 18px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

#user-display-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.user-role {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: rgba(231, 29, 54, 0.1);
  color: var(--color-danger);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.btn-logout:hover {
  background: var(--color-danger);
  color: white;
}

/* Content Area Layout */
.content-area {
  margin-left: var(--sidebar-width);
  padding: 40px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

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

.header-title h1 {
  font-family: var(--font-family-display);
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 5px;
}

.header-title p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.date-badge {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-badge i {
  width: 14px;
  height: 14px;
  color: var(--color-brand-secondary);
}

/* App Sections System */
.app-section {
  display: none;
  animation: sectionFadeIn 0.4s ease forwards;
}

.app-section.active {
  display: block;
}

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

/* ==========================================================================
   3. NEW NOTE SECTION (EDITOR & CONTROLS)
   ========================================================================== */

.note-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  align-items: start;
}

.note-controls {
  position: sticky;
  top: 40px;
}

.control-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-card h3 {
  font-family: var(--font-family-display);
  font-size: 18px;
  font-weight: 600;
  color: white;
}

.control-card p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.control-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-action {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
  filter: brightness(1.1);
}

.btn-success {
  background: linear-gradient(135deg, #1b6d3a, var(--color-brand-secondary));
  color: white;
}

.btn-secondary {
  background: var(--color-border);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(231, 29, 54, 0.15);
  color: #ff4d6d;
  border: 1px solid rgba(231, 29, 54, 0.2);
}

.btn-dark {
  background: #232d26;
  color: white;
  border: 1px solid var(--color-border);
}

.helper-info {
  border-top: 1px solid var(--color-border);
  padding-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.helper-item {
  display: flex;
  gap: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.helper-item i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--color-info);
}

.helper-item.warning i {
  color: var(--color-warning);
}

/* ==========================================================================
   4. NOTE SHEET STYLING (HIGH FIDELITY VIEW)
   ========================================================================== */

.note-sheet-wrapper {
  overflow-x: auto;
  padding: 10px 0;
}

.note-sheet {
  width: 850px;
  min-height: 600px;
  background-color: #ffffff;
  color: #1a1a1a;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  margin: 0 auto;
}

.note-sheet-frame {
  border: 2px solid #004d26; /* Dark Green Frame */
  padding: 25px;
  min-height: calc(100% - 40px);
  position: relative;
}

/* Header Grid */
.note-sheet-header {
  display: grid;
  grid-template-columns: 240px 1fr 150px;
  align-items: center;
  margin-bottom: 20px;
}

.header-logo-container {
  display: flex;
  align-items: center;
}

.sheet-logo {
  height: 65px;
  max-width: 220px;
  object-fit: contain;
}

.header-title-container {
  text-align: center;
}

.header-title-container h2 {
  font-family: var(--font-family-display);
  font-size: 26px;
  font-weight: 800;
  color: #004d26;
  letter-spacing: 0.5px;
}

.header-number-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.note-number-label {
  font-family: var(--font-family-display);
  font-size: 22px;
  font-weight: 800;
  color: #004d26;
}

.note-number-value {
  font-family: var(--font-family-display);
  font-size: 22px;
  font-weight: 800;
  color: #004d26;
  border-bottom: 1px solid #1a1a1a;
  min-width: 70px;
  text-align: center;
}

/* Input Fields styling */
.input-line {
  border: none;
  border-bottom: 1px dotted #1a1a1a;
  background: transparent;
  color: #1a1a1a;
  font-family: var(--font-family-sans);
  font-size: 13px;
  padding: 2px 5px;
  transition: background-color var(--transition-fast);
}

.input-line:focus {
  background-color: #f1f8f3;
}

/* Date Row */
.note-sheet-date-row {
  margin-bottom: 20px;
  font-size: 13px;
}

.date-text-wrapper {
  display: flex;
  align-items: center;
}

.input-day {
  width: 35px;
  text-align: center;
}

.input-month {
  width: 140px;
  text-align: center;
}

.input-year {
  width: 25px;
  text-align: center;
}

/* Metadata Grid */
.note-sheet-meta-section {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.meta-left, .meta-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meta-row {
  display: flex;
  align-items: flex-end;
}

.meta-label {
  font-family: var(--font-family-display);
  font-size: 13px;
  font-weight: 800;
  color: #004d26;
  width: 75px;
  flex-shrink: 0;
}

.meta-right .meta-label {
  width: 90px;
}

.meta-row .input-line {
  flex: 1;
}

.meta-separator {
  background-color: #004d26;
  width: 1.5px;
  height: 90px;
  align-self: center;
}

/* Product table title */
.note-sheet-table-title {
  font-family: var(--font-family-display);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: #004d26;
  text-decoration: underline;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* Products Table Details */
.note-sheet-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.note-sheet-table th {
  border: 1px solid #004d26;
  color: #004d26;
  font-family: var(--font-family-display);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 4px;
  text-align: center;
  letter-spacing: 0.5px;
}

.note-sheet-table td {
  border: 1px solid #004d26;
  padding: 2px;
}

.input-table {
  width: 100%;
  border: none;
  background: transparent;
  padding: 5px 8px;
  font-family: var(--font-family-sans);
  font-size: 12px;
  color: #1a1a1a;
}

.input-table:focus {
  background-color: #f1f8f3;
}

/* Table columns sizing */
.col-item {
  width: 50px;
  text-align: center;
  font-size: 11px;
  color: #555;
  font-weight: 600;
}
.col-desc {
  width: 320px;
}
.col-lote {
  width: 110px;
}
.col-cant {
  width: 90px;
}
.col-unidad {
  width: 80px;
}
.col-total {
  width: 100px;
}

.total-label-cell {
  text-align: right;
  font-family: var(--font-family-display);
  font-size: 13px;
  font-weight: 800;
  color: #004d26;
  padding-right: 15px !important;
}

.total-value-cell {
  background-color: #fafafa;
}

.total-value-cell input {
  text-align: right;
  font-weight: 700;
}

/* Observations section */
.note-sheet-observations {
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.obs-row {
  display: flex;
  align-items: flex-end;
}

.obs-label {
  font-family: var(--font-family-sans);
  font-size: 13px;
  font-weight: 600;
  color: #004d26;
  width: 110px;
  flex-shrink: 0;
}

.input-obs {
  flex: 1;
}

/* Signatures section */
.note-sheet-signatures {
  margin-top: 45px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding: 0 10px;
}

.signature-block {
  display: flex;
  flex-direction: column;
}

.sig-line {
  border-top: 1px dotted #1a1a1a;
  width: 100%;
  margin-bottom: 8px;
}

.sig-title {
  font-family: var(--font-family-sans);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: #333;
  margin-bottom: 15px;
}

.sig-field {
  display: flex;
  align-items: flex-end;
  margin-bottom: 8px;
  font-size: 12px;
}

.sig-field span {
  width: 60px;
  color: #555;
}

.input-sig {
  flex: 1;
}

/* ==========================================================================
   5. HISTORY SECTION STYLING
   ========================================================================== */

.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--color-bg-card);
  padding: 16px 24px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-border);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 10px 16px;
  flex: 1;
  max-width: 500px;
}

.search-box i {
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
}

.search-box input {
  background: none;
  border: none;
  color: white;
  width: 100%;
  font-family: var(--font-family-sans);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--color-text-secondary);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: var(--border-radius-md);
}

.history-table-container {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  background: rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-brand-secondary);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-family-display);
  letter-spacing: 0.5px;
}

.history-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
  vertical-align: middle;
}

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

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.loading-cell {
  text-align: center;
  padding: 60px 0 !important;
  color: var(--color-text-secondary);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(59, 138, 81, 0.1);
  border-top-color: var(--color-brand-secondary);
  border-radius: 50%;
  margin: 0 auto 15px auto;
  animation: spin 1s linear infinite;
}

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

.note-badge {
  font-family: var(--font-family-display);
  font-weight: 700;
  color: var(--color-brand-secondary);
}

.print-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 176, 37, 0.12);
  color: var(--color-brand-accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(245, 176, 37, 0.2);
}

.history-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-history-action {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.btn-history-action i {
  width: 16px;
  height: 16px;
}

.btn-history-action.print:hover {
  background: rgba(245, 176, 37, 0.15);
  color: var(--color-brand-accent);
}

.btn-history-action.edit:hover {
  background: rgba(59, 138, 81, 0.15);
  color: var(--color-brand-secondary);
}

.btn-history-action.delete:hover {
  background: rgba(231, 29, 54, 0.15);
  color: var(--color-danger);
}

/* ==========================================================================
   6. PRINT SECURITY BLOCKER SCREEN STYLING (ON SCREEN SCREEN)
   ========================================================================== */

#print-blocker-message {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 18, 14, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#print-blocker-message.active {
  display: flex;
}

.blocker-content {
  background: var(--color-bg-card);
  border: 2px solid var(--color-danger);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  max-width: 550px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: loginFadeIn 0.3s ease-out;
}

.blocker-logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: white;
  padding: 2px;
  border: 2px solid var(--color-danger);
  margin-bottom: 20px;
}

.blocker-content h2 {
  font-family: var(--font-family-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-danger);
  margin-bottom: 15px;
  letter-spacing: 0.5px;
}

.blocker-content p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.instructions-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 20px;
  text-align: left;
  margin-bottom: 30px;
}

.instructions-box h3 {
  font-size: 14px;
  color: white;
  margin-bottom: 12px;
  font-weight: 600;
}

.instructions-box ol {
  padding-left: 20px;
  color: var(--color-text-secondary);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instructions-box li strong {
  color: var(--color-brand-secondary);
}

.blocker-content .btn-primary {
  margin: 0 auto;
  min-width: 150px;
}

/* ==========================================================================
   7. PRINT TEMPLATE STYLING (ON SCREEN AND ON PRINT)
   ========================================================================== */

#print-template {
  display: none;
}

/* ==========================================================================
   8. MEDIA PRINT SPECIFIC CSS
   ========================================================================== */

@media print {
  @page {
    size: A4;
    margin: 10mm 15mm;
  }

  /* Hide standard page contents when printing, regardless of state */
  #app-screen,
  #login-screen,
  .sidebar,
  .content-area,
  .note-controls,
  #print-blocker-message {
    display: none !important;
  }

  /* --------------------------------------------------
     CASE A: UNAUTHORIZED PRINTING (CTRL+P DEFAULT)
     -------------------------------------------------- */
  body:not(.printing-authorized) {
    background: #ffffff !important;
    color: #000000 !important;
    display: block !important;
    padding: 30px !important;
  }

  body:not(.printing-authorized) #print-template {
    display: none !important;
  }

  /* Force print blocker content onto the printed page! */
  body:not(.printing-authorized)::before {
    content: "";
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 30px auto;
    background-image: url('logo.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 3px solid #e71d36;
  }

  body:not(.printing-authorized)::after {
    content: "IMPRESIÓN BLOQUEADA\a\a Esta Nota de Entrega NO fue registrada oficialmente.\a\a Para imprimir este documento de forma válida y mantener el contador correlativo, por favor utilice el botón oficial 'Registrar e Imprimir' dentro de la aplicación.\a\a Las impresiones no registradas no tienen validez legal ni administrativa en REVOAGRO.";
    display: block;
    white-space: pre-wrap;
    text-align: center;
    font-family: sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #e71d36;
    margin-top: 20px;
    padding: 30px;
    border: 2px dashed #e71d36;
    border-radius: 8px;
    line-height: 1.6;
  }

  /* --------------------------------------------------
     CASE B: AUTHORIZED PRINTING (FROM PRINT BUTTON)
     -------------------------------------------------- */
  body.printing-authorized {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body.printing-authorized #print-template {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.printing-authorized #print-template .note-sheet {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
  }
  
  body.printing-authorized #print-template .note-sheet-frame {
    border: 2px solid #004d26 !important;
    padding: 15px !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body.printing-authorized #print-template .sheet-logo {
    height: 50px !important;
  }

  body.printing-authorized #print-template .header-title-container h2 {
    font-size: 22px !important;
  }

  body.printing-authorized #print-template .note-sheet-header {
    margin-bottom: 12px !important;
  }

  body.printing-authorized #print-template .note-sheet-date-row {
    margin-bottom: 12px !important;
    font-size: 12px !important;
  }

  body.printing-authorized #print-template .note-sheet-meta-section {
    margin-bottom: 15px !important;
    gap: 15px !important;
  }

  body.printing-authorized #print-template .meta-separator {
    height: 70px !important;
  }

  body.printing-authorized #print-template .meta-left, 
  body.printing-authorized #print-template .meta-right {
    gap: 8px !important;
  }

  body.printing-authorized #print-template .meta-label {
    font-size: 12px !important;
    width: 70px !important;
  }

  body.printing-authorized #print-template .meta-right .meta-label {
    width: 80px !important;
  }

  body.printing-authorized #print-template .note-sheet-table-title {
    margin-bottom: 8px !important;
    font-size: 12px !important;
  }

  body.printing-authorized #print-template .input-line {
    border-bottom: 1px dotted #1a1a1a !important;
    font-size: 12px !important;
  }

  body.printing-authorized #print-template input {
    background: transparent !important;
    color: #000000 !important;
    font-weight: 600 !important;
  }

  body.printing-authorized #print-template .note-sheet-table {
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  body.printing-authorized #print-template .note-sheet-table th {
    padding: 4px 2px !important;
    font-size: 9px !important;
    border: 1px solid #004d26 !important;
  }

  body.printing-authorized #print-template .note-sheet-table td {
    padding: 0px 2px !important;
    font-size: 11px !important;
    border: 1px solid #004d26 !important;
  }

  /* Percentage widths for fluid table layout on narrow A4 */
  body.printing-authorized #print-template .note-sheet-table th.col-item,
  body.printing-authorized #print-template .note-sheet-table td.col-item {
    width: 6% !important;
  }
  body.printing-authorized #print-template .note-sheet-table th.col-desc,
  body.printing-authorized #print-template .note-sheet-table td.col-desc {
    width: 44% !important;
  }
  body.printing-authorized #print-template .note-sheet-table th.col-lote,
  body.printing-authorized #print-template .note-sheet-table td.col-lote {
    width: 15% !important;
  }
  body.printing-authorized #print-template .note-sheet-table th.col-cant,
  body.printing-authorized #print-template .note-sheet-table td.col-cant {
    width: 11% !important;
  }
  body.printing-authorized #print-template .note-sheet-table th.col-unidad,
  body.printing-authorized #print-template .note-sheet-table td.col-unidad {
    width: 11% !important;
  }
  body.printing-authorized #print-template .note-sheet-table th.col-total,
  body.printing-authorized #print-template .note-sheet-table td.col-total {
    width: 13% !important;
  }

  body.printing-authorized #print-template .note-sheet-observations {
    margin-top: 15px !important;
    gap: 8px !important;
  }

  body.printing-authorized #print-template .obs-label {
    font-size: 12px !important;
    width: 100px !important;
  }

  body.printing-authorized #print-template .note-sheet-signatures {
    margin-top: 25px !important;
    gap: 40px !important;
  }

  body.printing-authorized #print-template .sig-title {
    margin-bottom: 8px !important;
    font-size: 11px !important;
  }

  body.printing-authorized #print-template .sig-field {
    font-size: 11px !important;
    margin-bottom: 6px !important;
  }

  /* Ensure background graphics print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
