/* ============================================
   Albanian Airport Permit - Frontend CSS
   Official Government Document Styling
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Cinzel:wght@400;600;700&family=Source+Code+Pro:wght@400;600&family=Source+Sans+3:wght@300;400;600&display=swap');

/* ---- CSS Variables ---- */
:root {
  --alb-red:        #c8102e;
  --alb-red-dark:   #8B1A1A;
  --alb-red-light:  #f5e0e0;
  --alb-black:      #0a0a0a;
  --alb-gold:       #d4a017;
  --alb-gold-light: #f5e8c0;
  --alb-cream:      #fdf6e3;
  --alb-parchment:  #f8f0d8;
  --alb-border:     #c4a882;
  --alb-text:       #1a1a1a;
  --alb-text-muted: #5a4a3a;
  --alb-section-bg: rgba(200, 16, 46, 0.04);
  --permit-width:   820px;
  --field-bg:       rgba(255,255,255,0.85);
}

/* ---- Wrapper ---- */
.aap-permit-wrapper {
  max-width: var(--permit-width);
  margin: 0 auto;
  font-family: 'Source Sans 3', 'Georgia', serif;
  color: var(--alb-text);
}

/* ---- Main Document ---- */
.aap-permit-document {
  position: relative;
  background: var(--alb-parchment);
  border: 2px solid var(--alb-border);
  border-top: 6px solid var(--alb-red);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), inset 0 0 80px rgba(200,16,46,0.03);
  overflow: hidden;
}

/* Diagonal Security Lines Background */
.aap-permit-document::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 28px,
      rgba(200,16,46,0.025) 28px,
      rgba(200,16,46,0.025) 29px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 28px,
      rgba(200,16,46,0.018) 28px,
      rgba(200,16,46,0.018) 29px
    );
  pointer-events: none;
  z-index: 0;
}

/* Watermark eagle */
.aap-bg-pattern {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}
.aap-bg-eagle {
  width: 480px;
  height: 480px;
  opacity: 1;
}

/* All inner content above watermark */
.aap-permit-document > * {
  position: relative;
  z-index: 1;
}

/* ---- Header Stripe ---- */
.aap-header-stripe {
  height: 8px;
  background: linear-gradient(90deg,
    var(--alb-red) 0%,
    var(--alb-red) 40%,
    var(--alb-black) 40%,
    var(--alb-black) 60%,
    var(--alb-red) 60%,
    var(--alb-red) 100%
  );
}

/* ---- Document Header ---- */
.aap-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 2px solid var(--alb-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, transparent 100%);
  gap: 16px;
}

.aap-header-left {
  flex-shrink: 0;
}

.aap-coat-of-arms {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.aap-header-center {
  flex: 1;
  text-align: center;
  padding: 0 12px;
}

.aap-country-name-sq {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--alb-red-dark);
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1.2;
}

.aap-country-name-en {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--alb-text-muted);
  letter-spacing: 2px;
  margin-top: 2px;
}

.aap-ministry {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: var(--alb-text-muted);
  text-transform: uppercase;
  margin: 8px 0;
  padding: 4px 0;
  border-top: 0.5px solid var(--alb-border);
  border-bottom: 0.5px solid var(--alb-border);
}

.aap-doc-title-sq {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--alb-red);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 8px;
}

.aap-doc-title-en {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--alb-text-muted);
  letter-spacing: 1.5px;
}

/* ---- Photo Container ---- */
.aap-header-right {
  flex-shrink: 0;
  text-align: center;
}

.aap-photo-container {
  width: 88px;
}

.aap-customer-photo {
  width: 88px;
  height: 110px;
  object-fit: cover;
  border: 2px solid var(--alb-border);
  display: block;
}

.aap-photo-placeholder {
  width: 88px;
  height: 110px;
  border: 2px solid var(--alb-border);
  background: var(--alb-gold-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.aap-photo-text {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--alb-text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.aap-photo-label {
  font-size: 7.5px;
  letter-spacing: 0.5px;
  color: var(--alb-text-muted);
  text-align: center;
  margin-top: 4px;
  text-transform: uppercase;
}

/* ---- Permit Number Bar ---- */
.aap-permit-number-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--alb-red);
  padding: 10px 24px;
  gap: 16px;
}

.aap-permit-num-left,
.aap-permit-num-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aap-permit-num-right {
  text-align: right;
}

.aap-permit-label {
  font-size: 8.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.aap-permit-value {
  font-family: 'Source Code Pro', monospace;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 1px;
}

.aap-live-datetime {
  font-size: 13px !important;
  letter-spacing: 0.5px !important;
}

/* ---- Permit Body ---- */
.aap-permit-body {
  padding: 0 0 8px;
}

/* ---- Sections ---- */
.aap-section {
  margin: 0;
  border-bottom: 1px solid var(--alb-border);
}

.aap-section:last-child {
  border-bottom: none;
}

.aap-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 8px;
  background: linear-gradient(90deg, rgba(200,16,46,0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(200,16,46,0.15);
}

.aap-section-num {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: rgba(200,16,46,0.2);
  line-height: 1;
  min-width: 30px;
}

.aap-section-title-sq {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--alb-red-dark);
  text-transform: uppercase;
}

.aap-section-title-en {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--alb-text-muted);
  text-transform: uppercase;
  border-left: 1px solid var(--alb-border);
  padding-left: 10px;
  margin-left: 4px;
}

/* ---- Fields Grid ---- */
.aap-fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 12px 20px 14px;
}

.aap-field {
  padding: 8px 12px;
  border-right: 0.5px solid var(--alb-border);
  border-bottom: 0.5px solid rgba(196,168,130,0.3);
}

.aap-field:nth-child(3n) {
  border-right: none;
}

.aap-field-wide {
  grid-column: span 2;
}

.aap-field-full {
  grid-column: span 3;
}

.aap-field-label {
  margin-bottom: 4px;
  line-height: 1.3;
}

.aap-field-label .sq {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--alb-red-dark);
}

.aap-field-label .en {
  display: block;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--alb-text-muted);
  text-transform: uppercase;
}

.aap-field-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--alb-text);
  min-height: 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(196,168,130,0.5);
  background: transparent;
  line-height: 1.4;
}

.aap-value-primary {
  font-family: 'EB Garamond', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--alb-black);
}

.aap-value-mono {
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ---- Badges ---- */
.aap-entry-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--alb-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.aap-status-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.aap-status-active {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.aap-status-expired {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.aap-status-pending {
  background: var(--alb-gold-light);
  color: #856404;
  border: 1px solid var(--alb-gold);
}

/* ---- Authentication Bar ---- */
.aap-auth-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, var(--alb-cream) 100%);
  border-top: 2px solid var(--alb-border);
  border-bottom: 1px solid var(--alb-border);
}

.aap-auth-left {
  flex-shrink: 0;
}

.aap-auth-seal {
  opacity: 0.85;
}

.aap-auth-center {
  flex: 1;
  padding: 0 16px;
  border-left: 1px solid var(--alb-border);
  border-right: 1px solid var(--alb-border);
}

.aap-auth-notice-sq {
  font-family: 'EB Garamond', serif;
  font-size: 11px;
  font-style: italic;
  color: var(--alb-text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
}

.aap-auth-notice-en {
  font-size: 9.5px;
  color: var(--alb-text-muted);
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.aap-auth-right {
  flex-shrink: 0;
  min-width: 150px;
}

.aap-signature-block {
  text-align: center;
}

.aap-signature-line {
  width: 140px;
  height: 40px;
  border-bottom: 1.5px solid var(--alb-text-muted);
  margin: 0 auto 6px;
}

.aap-signature-label-sq {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--alb-text-muted);
  text-transform: uppercase;
}

.aap-signature-label-en {
  font-size: 8px;
  color: var(--alb-text-muted);
  letter-spacing: 0.3px;
}

.aap-signature-dept {
  font-size: 8px;
  color: var(--alb-red-dark);
  margin-top: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.aap-signature-dept-en {
  font-size: 7.5px;
  color: var(--alb-text-muted);
}

/* ---- MRZ Zone ---- */
.aap-mrz {
  padding: 12px 24px;
  background: rgba(255,255,255,0.6);
  border-top: 1px dashed var(--alb-border);
}

.aap-mrz-label {
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--alb-text-muted);
  margin-bottom: 6px;
}

.aap-mrz-line {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--alb-text);
  line-height: 1.8;
  word-break: break-all;
  background: rgba(255,255,255,0.7);
  padding: 2px 6px;
}

/* ---- Footer Stripe ---- */
.aap-footer-stripe {
  display: flex;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--alb-black);
  color: rgba(255,255,255,0.75);
  font-size: 8.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 400;
}

/* ---- Action Buttons ---- */
.aap-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.aap-btn {
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.aap-btn-primary {
  background: var(--alb-red);
  color: #fff;
}

.aap-btn-primary:hover {
  background: var(--alb-red-dark);
}

.aap-btn-secondary {
  background: var(--alb-black);
  color: #fff;
}

.aap-btn-secondary:hover {
  background: #333;
}

/* ============================================
   ADMIN Styles
   ============================================ */
.aap-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.aap-status-active {
  background: #d4edda;
  color: #155724;
}

.aap-status-inactive {
  background: #f8d7da;
  color: #721c24;
}

/* ---- Form Styles ---- */
.aap-form-wrapper {
  max-width: 820px;
  margin: 0 auto;
  background: var(--alb-cream, #fdf6e3);
  border: 1px solid #c4a882;
  padding: 32px;
}

.aap-form-title {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: #8B1A1A;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.aap-form-section {
  margin-bottom: 24px;
}

.aap-form-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c8102e;
  border-bottom: 2px solid #c8102e;
  padding-bottom: 6px;
  margin-bottom: 16px;
}

.aap-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.aap-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aap-form-field.full {
  grid-column: span 2;
}

.aap-form-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #5a4a3a;
}

.aap-form-field input,
.aap-form-field select,
.aap-form-field textarea {
  padding: 8px 12px;
  border: 1px solid #c4a882;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.aap-form-field input:focus,
.aap-form-field select:focus,
.aap-form-field textarea:focus {
  border-color: #c8102e;
}

.aap-form-submit {
  width: 100%;
  padding: 14px;
  background: #c8102e;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.aap-form-submit:hover {
  background: #8B1A1A;
}

.aap-photo-upload-preview {
  width: 88px;
  height: 110px;
  border: 2px dashed #c4a882;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 6px;
  overflow: hidden;
  background: #f8f0d8;
}

.aap-photo-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body { margin: 0; padding: 0; }
  .no-print { display: none !important; }
  .aap-permit-wrapper { max-width: 100%; }
  .aap-permit-document {
    box-shadow: none;
    border: 1px solid #999;
  }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .aap-doc-header { flex-direction: column; align-items: center; }
  .aap-fields-grid { grid-template-columns: 1fr 1fr; }
  .aap-field-wide { grid-column: span 2; }
  .aap-permit-number-bar { flex-direction: column; gap: 8px; text-align: center; }
  .aap-auth-bar { flex-direction: column; text-align: center; }
  .aap-auth-center { border: none; padding: 12px 0; }
  .aap-footer-stripe { flex-direction: column; gap: 4px; text-align: center; }
  .aap-form-grid { grid-template-columns: 1fr; }
  .aap-form-field.full { grid-column: span 1; }
}
