/* ===== NOC Certificate - EXACT Photocopy/Scan Replica ===== */
/* Matched pixel-perfectly to original scanned PDF coordinates */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400&family=Noto+Sans:wght@400;600;700;900&display=swap');

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

body {
    background: #5a5a5a;
    font-family: 'Noto Serif', 'Times New Roman', Times, serif;
    font-size: 12.1px;
    line-height: 1.41;
    color: #181b24;
    /* 10% Blue-tinted navy ink */
    -webkit-font-smoothing: subpixel-antialiased;
}

/* ===== A4 Page - Exact Paper Bounds ===== */
.page {
    width: 210mm;
    height: 297mm;
    margin: 0 auto;
    /* Top margin 24mm, left 27mm to perfectly match background */
    padding: 24mm 21mm 4mm 27mm;
    position: relative;
    overflow: hidden;
    /* Full-page background with inpainted text, signatures & header line (20% Darker) */
    background-color: #c6c2cb;
    background-image: url('/page_1_bg_v6.jpg');
    background-size: 100% 100% !important;
    background-position: top left;
    background-repeat: no-repeat;
    filter: brightness(1.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

/* ===== Large Diagonal Background Watermark (10% Blue Faint Tint) ===== */
.watermark-overlay {
    position: absolute;
    top: 49%;
    left: 46%;
    transform: translate(-50%, -50%) rotate(-56deg);
    font-family: 'Noto Sans', Arial, sans-serif;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 3px;
    color: rgba(45, 55, 75, 0.13);
    -webkit-text-stroke: 0.3px rgba(45, 55, 75, 0.11);
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
    filter: blur(0.45px);
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 1px;
    position: relative;
    z-index: 1;
    visibility: hidden !important;
}

.header-center {
    flex: 1;
    text-align: center;
}

/* Black-blue dot above title */
.header-dot {
    width: 4px;
    height: 4px;
    background: #161922;
    border-radius: 50%;
    margin: 0 auto 2px auto;
}

.header-center .office-title {
    font-family: 'Noto Sans', Arial, sans-serif;
    font-size: 13.8px;
    font-weight: 700;
    color: #161922;
    letter-spacing: 0.2px;
    margin-bottom: 1px;
    filter: blur(0.46px);
    text-shadow: 0 0 0.55px rgba(22, 26, 36, 0.70), 0.3px 0.2px 0.4px rgba(22, 26, 36, 0.50);
}

.header-center .office-address {
    font-size: 9.6px;
    color: #232734;
    line-height: 1.28;
    filter: blur(0.46px);
    text-shadow: 0 0 0.55px rgba(22, 26, 36, 0.70), 0.3px 0.2px 0.4px rgba(22, 26, 36, 0.50);
}

.header-center .office-address a {
    color: #232734;
    text-decoration: none;
}

/* ===== Header line (removed) ===== */
.header-line {
    display: none;
}

/* ===== To Section ===== */
.to-section {
    margin-top: 24px;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    visibility: hidden !important;
}

.to-label {
    font-family: 'Noto Sans', Arial, sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #161922;
    visibility: hidden !important;
}

.to-address {
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 12px;
    margin-left: 85px;
    color: #1c202a;
    position: relative;
    z-index: 1;
    line-height: 1.42;
    visibility: hidden !important;
}

/* ===== Memo Line ===== */
.memo-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    white-space: nowrap;
    margin: 2px 80px 22px 112px;
    position: relative;
    z-index: 1;
    font-family: 'Noto Serif', 'Times New Roman', serif;
    filter: blur(0.2px);
    text-shadow: 0 0 0.2px rgba(22, 26, 36, 0.4), 0.1px 0.1px 0.2px rgba(22, 26, 36, 0.3);
}

.memo-no {
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 13px;
    color: #1c202a;
    white-space: nowrap;
    filter: blur(0.2px);
    text-shadow: 0 0 0.2px rgba(22, 26, 36, 0.4), 0.1px 0.1px 0.2px rgba(22, 26, 36, 0.3);
}

.memo-date {
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 13px;
    color: #1c202a;
    white-space: nowrap;
    filter: blur(0.2px);
    text-shadow: 0 0 0.2px rgba(22, 26, 36, 0.4), 0.1px 0.1px 0.2px rgba(22, 26, 36, 0.3);
}

/* ===== Subject ===== */
.subject {
    text-align: left;
    margin: 10px 0 10px 85px;
    position: relative;
    z-index: 1;
    visibility: hidden !important;
}

.subject-text {
    font-family: 'Noto Sans', Arial, sans-serif;
    font-size: 12.2px;
    font-weight: 700;
    line-height: 1.40;
    color: #161922;
    padding: 0;
    text-align: left;
    visibility: hidden !important;
}

/* ===== Agriculture Banner ===== */
.agri-banner-wrap {
    margin: 10px 0 12px 0px;
    position: relative;
    z-index: 1;
    visibility: hidden !important;
}

.agri-banner {
    text-align: center;
    padding: 2.5px 0;
    border: 1px solid #161922;
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    visibility: hidden !important;
}

.agri-banner span {
    font-family: 'Noto Sans', Arial, sans-serif;
    font-size: 12.2px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #161922;
    visibility: hidden !important;
}

/* ===== Body Content (Subtle Ink Bleed Blur Softness) ===== */
.body-content {
    position: relative;
    z-index: 1;
    text-align: justify;
    filter: blur(0.2px);
    text-shadow: 0 0 0.2px rgba(22, 26, 36, 0.4), 0.1px 0.1px 0.2px rgba(22, 26, 36, 0.3);
}

.body-content .para {
    margin-bottom: 10px;
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 11.5px;
    line-height: 1.62;
    text-align: justify;
    color: #1c202a;
    word-spacing: -0.1px;
}

/* ===== Signature Section 1 ===== */
.signature-section {
    margin-top: -25px;
    margin-bottom: 1px;
    text-align: right;
    position: relative;
    z-index: 1;
    padding-right: 5px;
}

.signature-img-wrap {
    display: inline-block;
    text-align: center;
}

.signature-img {
    display: block;
    height: auto;
    width: 175px;
    margin: 0 0 0 auto;
    mix-blend-mode: multiply;
    filter: blur(0.25px) contrast(1.1) brightness(0.9);
    opacity: 1.0;
}

/* ===== Endorsement (Subtle Ink Bleed Blur Softness) ===== */
.endorsement {
    margin-top: 1px;
    position: relative;
    z-index: 1;
    filter: blur(0.2px);
    text-shadow: 0 0 0.2px rgba(22, 26, 36, 0.4), 0.1px 0.1px 0.2px rgba(22, 26, 36, 0.3);
}

.endst-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 11.5px;
    font-weight: 400;
    color: #11141e;
}

.endst-body {
    font-family: 'Noto Serif', 'Times New Roman', serif;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.65;
    text-align: justify;
    color: #11141e;
}

.endst-body p {
    margin: 0 0 10px 0;
    font-family: 'Noto Serif', 'Times New Roman', serif;
    line-height: 1.65;
    text-align: justify;
    font-weight: 400;
    color: #11141e;
}

.endst-signature {
    margin-top: -35px;
    text-align: right;
    padding-right: 5px;
}

/* ===== Text Layer Rotation (To match scanned tilt) ===== */
.text-layer {
    transform: rotate(0.9deg);
    transform-origin: top left;
}

/* ===== Footer Info / Print Rules ===== */
@media print {
    body {
        background: none;
        margin: 0;
        padding: 0;
    }

    .page {
        width: 100%;
        height: auto;
        margin: 0;
        padding: 19mm 26mm 4mm 27mm;
        box-shadow: none;
    }

    .header,
    .to-section,
    .to-address,
    .memo-line,
    .subject,
    .agri-banner-wrap,
    .body-content,
    .endorsement {
        filter: blur(0.35px);
    }
}

@page {
    size: A4;
    margin: 0;
}

/* ============================================================
   APP STYLES — Login, Form, Dashboard, Admin Panel
   (Certificate styles above are 100% UNTOUCHED)
   ============================================================ */

/* ===== QR Code Boxes in Header ===== */
/* 1. Crisp Top-Right QR Box (Shifted right to cover background QR) */
.qr-top-right-box {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 122px;
    height: 122px;
    background: #ffffff;
    padding: 12px;
    box-sizing: border-box;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-top-right-box canvas,
.qr-top-right-box img {
    width: 98px !important;
    height: 98px !important;
    display: block;
}

/* 2. Middle-Right Header QR Box (66px White Border Box with 52px Inner QR) */
.qr-middle-right-box {
    position: absolute;
    top: 78px;
    right: 160px;
    width: 66px;
    height: 66px;
    background: #ffffff;
    padding: 7px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.qr-middle-right-box canvas,
.qr-middle-right-box img[src] {
    width: 52px !important;
    height: 52px !important;
    max-width: 52px;
    max-height: 52px;
    display: block;
    filter: blur(0.28px) contrast(0.94);
    opacity: 0.96;
}

.header-left {
    width: 85px;
    flex-shrink: 0;
}

.header-right {
    width: 85px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

/* ===== Auth Body (Login Page) ===== */
.auth-body {
    background: linear-gradient(135deg, #0f1724 0%, #1a2a40 40%, #1e3450 100%) !important;
    font-family: 'Noto Sans', Arial, sans-serif !important;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

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

.login-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.login-header h1 {
    color: #e2e8f0;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: #8ba4c4;
    font-size: 13px;
}

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

.login-footer p {
    color: #5a7594;
    font-size: 11px;
}

/* ===== App Body (Dashboard, Form, Admin) ===== */
.app-body {
    background: #0e1520 !important;
    font-family: 'Noto Sans', Arial, sans-serif !important;
    font-size: 14px;
    min-height: 100vh;
    color: #c8d6e5;
}

/* ===== Top Navigation ===== */
.topnav {
    background: rgba(15, 22, 36, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.topnav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.topnav-brand {
    font-size: 16px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.3px;
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topnav-links a {
    color: #8ba4c4;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s;
}

.topnav-links a:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.topnav-links a.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.btn-logout {
    color: #f87171 !important;
    font-size: 12px !important;
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.1) !important;
}

/* ===== Forms — Shared ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8ba4c4;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: 'Noto Sans', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #4a5f78;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: #5a7594;
    margin-top: 4px;
}

.form-hint code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Noto Sans', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #8ba4c4;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-view {
    color: #60a5fa;
}

.btn-link {
    color: #34d399;
}

.btn-info {
    color: #60a5fa;
}

.btn-warn {
    color: #fbbf24;
}

.btn-success {
    color: #34d399;
}

.btn-danger {
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.15);
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

/* ===== Dashboard ===== */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.dashboard-container h2 {
    color: #e2e8f0;
    font-size: 22px;
    margin-bottom: 24px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    margin-bottom: 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #5a7594;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* ===== Data Table ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #8ba4c4;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #c8d6e5;
}

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

.data-table .mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #94b8d9;
}

.data-table .actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.row-inactive {
    opacity: 0.45;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-admin {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.badge-operator {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.badge-active {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.badge-inactive {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* ===== Form Container ===== */
.form-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 24px;
}

.form-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 32px;
}

.form-title {
    color: #e2e8f0;
    font-size: 20px;
    margin-bottom: 6px;
}

.form-subtitle {
    color: #5a7594;
    font-size: 13px;
    margin-bottom: 28px;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-title {
    color: #94b8d9;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 18px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.inline-form .form-row {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
    .inline-form .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===== Admin Stats ===== */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: #60a5fa;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #5a7594;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Admin Link Cards ===== */
.admin-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.admin-link-card {
    display: block;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 28px 24px;
    text-decoration: none;
    transition: all 0.2s;
}

.admin-link-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(96, 165, 250, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.admin-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

.admin-link-card h3 {
    color: #e2e8f0;
    font-size: 16px;
    margin-bottom: 6px;
}

.admin-link-card p {
    color: #5a7594;
    font-size: 13px;
}

@media (max-width: 768px) {

    .admin-stats,
    .admin-links {
        grid-template-columns: 1fr;
    }
}