
/* =========================================================
   DEPLOYPILOT PDF VIEWER
   Main stylesheet
   ========================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;

    --background: #f1f5f9;
    --surface: #ffffff;
    --surface-secondary: #f8fafc;

    --text-primary: #172033;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border: #e2e8f0;

    --success: #16a34a;
    --success-light: #f0fdf4;

    --danger: #dc2626;
    --danger-light: #fef2f2;

    --warning: #d97706;

    --header-background: #111827;

    --shadow:
        0 20px 50px rgba(15, 23, 42, 0.15);

    --radius: 14px;
}


/* =========================================================
   GLOBAL RESET
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text-primary);

    font-family: 'Inter', Arial, sans-serif;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input {
    font-family: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.hidden {
    display: none !important;
}


/* =========================================================
   APPLICATION LAYOUT
   ========================================================= */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
}


/* =========================================================
   HEADER
   ========================================================= */

.app-header {
    height: 76px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 34px;

    background: var(--header-background);
    color: white;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);

    position: relative;
    z-index: 5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.11);

    border-radius: 11px;

    color: white;
}

.brand-icon svg {
    width: 25px;
    height: 25px;
}

.brand-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-name {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 11px;
    color: #9ca3af;
    letter-spacing: 0.5px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 12px;
    color: #d1d5db;
}

.status-indicator {
    width: 8px;
    height: 8px;

    background: #22c55e;

    border-radius: 50%;

    box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}


/* =========================================================
   DOCUMENT TOOLBAR
   ========================================================= */

.document-toolbar {
    min-height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 30px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);

    gap: 15px;

    position: relative;
    z-index: 3;
}

.document-information {
    display: flex;
    align-items: center;
    gap: 12px;

    min-width: 0;
}

.document-icon {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--primary);

    background: var(--primary-light);

    border-radius: 10px;

    flex-shrink: 0;
}

.document-icon svg {
    width: 22px;
    height: 22px;
}

.document-information > div:last-child {
    min-width: 0;
}

.document-name {
    font-size: 13px;
    font-weight: 700;

    max-width: 260px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-status {
    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 11px;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 8px;
}

.toolbar-button {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);

    border-radius: 7px;

    background: white;

    color: #475569;

    font-size: 18px;

    transition: all 0.2s ease;
}

.toolbar-button:hover:not(:disabled) {
    background: var(--primary-light);

    color: var(--primary);

    border-color: var(--primary);
}

.page-counter {
    font-size: 12px;
    color: var(--text-secondary);

    min-width: 45px;
    text-align: center;
}

.zoom-level {
    font-size: 11px;
    font-weight: 600;

    color: var(--text-secondary);

    min-width: 42px;
    text-align: center;
}

.toolbar-divider {
    width: 1px;
    height: 25px;

    background: var(--border);

    margin: 0 5px;
}


/* =========================================================
   PDF VIEWER
   ========================================================= */

.viewer-container {
    flex: 1;

    display: flex;
    flex-direction: column;

    min-height: 0;

    background: #e8edf3;
}

.pdf-scroll-container {
    flex: 1;

    overflow-y: auto;
    overflow-x: auto;

    padding: 30px 20px;

    scroll-behavior: smooth;
}

.pdf-scroll-container::-webkit-scrollbar {
    width: 9px;
}

.pdf-scroll-container::-webkit-scrollbar-track {
    background: #e2e8f0;
}

.pdf-scroll-container::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

.pdf-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.pdf-pages {
    width: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 25px;
}

.pdf-page {
    position: relative;

    background: white;

    box-shadow:
        0 3px 8px rgba(15, 23, 42, 0.10),
        0 15px 35px rgba(15, 23, 42, 0.08);

    overflow: hidden;

    flex-shrink: 0;
}

.pdf-page canvas {
    display: block;

    max-width: 100%;
    height: auto;
}

.pdf-page canvas.annotation-canvas {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;
}


/* =========================================================
   VIEWER FOOTER
   ========================================================= */

.viewer-footer {
    height: 42px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: white;

    border-top: 1px solid var(--border);

    color: var(--text-secondary);

    font-size: 10px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-dot {
    width: 6px;
    height: 6px;

    background: var(--success);

    border-radius: 50%;
}

.footer-right {
    color: var(--text-muted);
}


/* =========================================================
   FULL SCREEN LOADER
   ========================================================= */

.screen-loader {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(248, 250, 252, 0.98);

    backdrop-filter: blur(10px);
}

.loader-content {
    width: 100%;
    max-width: 430px;

    padding: 40px 30px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;

    background: white;

    border: 1px solid var(--border);

    border-radius: 20px;

    box-shadow: var(--shadow);
}

.loader-spinner {
    width: 52px;
    height: 52px;

    border: 4px solid #dbeafe;

    border-top-color: var(--primary);

    border-radius: 50%;

    animation: spinnerRotate 0.85s linear infinite;

    margin-bottom: 26px;
}

@keyframes spinnerRotate {
    to {
        transform: rotate(360deg);
    }
}

.loader-content h2 {
    font-size: 20px;
    font-weight: 700;

    margin-bottom: 12px;
}

.loader-content p {
    font-size: 13px;
    line-height: 1.7;

    color: var(--text-secondary);

    max-width: 340px;
}

.loader-progress-track,
.download-progress-track {
    width: 100%;
    height: 7px;

    background: #e2e8f0;

    border-radius: 20px;

    overflow: hidden;

    margin-top: 25px;
}

.loader-progress-bar,
.download-progress-bar {
    width: 0%;
    height: 100%;

    background: var(--primary);

    border-radius: 20px;

    transition: width 0.25s ease;
}

/* =========================================================
   INDETERMINATE DOWNLOAD LOADER
   ========================================================= */

.download-progress-bar.indeterminate {
    width: 35%;
    animation: downloadIndeterminate 1.4s ease-in-out infinite;
}

@keyframes downloadIndeterminate {
    0% {
        transform: translateX(-110%);
    }

    50% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(310%);
    }
}

#initialLoaderText,
#downloadStatusText {
    display: block;

    margin-top: 16px;

    color: var(--text-secondary);

    font-size: 11px;
}


/* =========================================================
   DOWNLOAD STATISTICS
   ========================================================= */

.download-statistics {
    width: 100%;

    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 8px;

    margin-top: 25px;
}

.download-stat {
    display: flex;
    flex-direction: column;

    gap: 8px;

    padding: 12px 5px;

    background: var(--surface-secondary);

    border: 1px solid var(--border);

    border-radius: 9px;
}

.download-stat span {
    font-size: 10px;
    color: var(--text-secondary);
}

.download-stat strong {
    font-size: 12px;
    font-weight: 700;
}


/* =========================================================
   MODAL OVERLAY
   ========================================================= */

.modal-overlay {
    position: fixed;

    inset: 0;

    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(15, 23, 42, 0.72);

    backdrop-filter: blur(7px);

    animation: overlayFade 0.25s ease;
}

@keyframes overlayFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =========================================================
   MODAL CARD
   ========================================================= */

.modal-card {
    width: 100%;
    max-width: 480px;

    max-height: 90vh;

    overflow-y: auto;

    padding: 36px 32px;

    background: white;

    border-radius: 19px;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.25);

    text-align: center;

    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-icon {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 22px;

    border-radius: 16px;
}

.modal-icon svg {
    width: 30px;
    height: 30px;
}

.authorization-icon {
    color: var(--primary);

    background: var(--primary-light);
}

.signature-icon {
    color: var(--success);

    background: var(--success-light);
}

.success-icon {
    color: var(--success);

    background: var(--success-light);
}

.error-icon {
    color: var(--danger);

    background: var(--danger-light);

    font-size: 30px;
    font-weight: 700;
}

.modal-card h2 {
    font-size: 21px;

    font-weight: 800;

    letter-spacing: -0.5px;

    margin-bottom: 13px;
}

.modal-card > p {
    font-size: 12px;

    line-height: 1.8;

    color: var(--text-secondary);

    margin-bottom: 22px;
}


/* =========================================================
   AUTHORIZATION INFORMATION
   ========================================================= */

.authorization-information {
    padding: 15px;

    margin: 22px 0;

    background: var(--surface-secondary);

    border: 1px solid var(--border);

    border-radius: 10px;
}

.information-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding: 8px 0;

    font-size: 11px;
}

.information-row + .information-row {
    border-top: 1px solid var(--border);
}

.information-row span {
    color: var(--text-secondary);
}

.information-row strong {
    color: var(--text-primary);

    text-align: right;

    overflow-wrap: anywhere;
}


/* =========================================================
   PRIMARY BUTTON
   ========================================================= */

.primary-button {
    width: 100%;

    min-height: 49px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    padding: 13px 20px;

    background: var(--primary);

    color: white;

    border: none;

    border-radius: 9px;

    font-size: 12px;

    font-weight: 700;

    transition: all 0.2s ease;
}

.primary-button:hover:not(:disabled) {
    background: var(--primary-dark);

    transform: translateY(-1px);

    box-shadow:
        0 6px 15px rgba(37, 99, 235, 0.22);
}

.primary-button:active:not(:disabled) {
    transform: translateY(0);
}

.primary-button span {
    font-size: 18px;
}

.modal-disclaimer {
    margin-top: 18px !important;

    margin-bottom: 0 !important;

    font-size: 10px !important;

    line-height: 1.7 !important;

    color: var(--text-muted) !important;
}


/* =========================================================
   SIGNATURE FORM
   ========================================================= */

.signature-card {
    max-width: 520px;

    text-align: left;
}

.signature-card .modal-icon {
    margin-left: auto;
    margin-right: auto;
}

.signature-card h2,
.signature-card > p {
    text-align: center;
}

.completion-label {
    margin-bottom: 12px;

    text-align: center;

    font-size: 9px;

    font-weight: 800;

    letter-spacing: 1px;

    color: var(--success);
}

.form-group {
    margin-top: 20px;
}

.form-group > label,
.signature-label-row > label {
    display: block;

    margin-bottom: 9px;

    font-size: 11px;

    font-weight: 700;

    color: var(--text-primary);
}

.form-group input[type="text"] {
    width: 100%;

    height: 46px;

    padding: 0 14px;

    background: white;

    border: 1px solid #cbd5e1;

    border-radius: 8px;

    outline: none;

    color: var(--text-primary);

    font-size: 12px;

    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.09);
}

.form-group input[type="text"]::placeholder {
    color: var(--text-muted);
}


/* =========================================================
   SIGNATURE CANVAS
   ========================================================= */

.signature-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.signature-label-row > span {
    font-size: 10px;

    color: var(--text-muted);
}

.signature-canvas-container {
    width: 100%;

    height: 145px;

    position: relative;

    background: #fafcff;

    border: 1px dashed #94a3b8;

    border-radius: 9px;

    overflow: hidden;
}

#signatureCanvas {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    cursor: crosshair;

    touch-action: none;

    z-index: 2;
}

.signature-line {
    position: absolute;

    left: 8%;
    right: 8%;

    bottom: 28px;

    height: 1px;

    background: #cbd5e1;

    pointer-events: none;

    z-index: 1;
}

.clear-signature-button {
    display: block;

    margin: 9px 0 0 auto;

    padding: 5px 0;

    border: none;

    background: transparent;

    color: var(--primary);

    font-size: 10px;

    font-weight: 600;
}

.clear-signature-button:hover {
    color: var(--primary-dark);

    text-decoration: underline;
}


/* =========================================================
   SIGNATURE CONSENT
   ========================================================= */

.signature-consent {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    margin: 21px 0;

    padding: 13px;

    background: var(--surface-secondary);

    border: 1px solid var(--border);

    border-radius: 9px;
}

.signature-consent input {
    width: 15px;
    height: 15px;

    margin-top: 2px;

    flex-shrink: 0;

    accent-color: var(--primary);
}

.signature-consent label {
    font-size: 10px;

    line-height: 1.7;

    color: var(--text-secondary);

    cursor: pointer;
}


/* =========================================================
   SUCCESS INFORMATION
   ========================================================= */

.success-information {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 15px;

    margin: 20px 0;

    background: var(--success-light);

    border: 1px solid #bbf7d0;

    border-radius: 9px;

    font-size: 11px;
}

.success-information span {
    color: #166534;
}

.success-information strong {
    color: var(--success);
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);

    outline-offset: 3px;
}


/* =========================================================
   TABLET RESPONSIVENESS
   ========================================================= */

@media (max-width: 768px) {

    .app-header {
        height: 66px;

        padding: 0 18px;
    }

    .brand-name {
        font-size: 17px;
    }

    .document-toolbar {
        padding: 12px 15px;

        flex-wrap: wrap;
    }

    .document-information {
        flex: 1;
    }

    .toolbar-controls {
        width: 100%;

        justify-content: flex-end;
    }

    .pdf-scroll-container {
        padding: 18px 10px;
    }

    .viewer-footer {
        padding: 0 15px;
    }

    .modal-card {
        padding: 30px 24px;
    }

}


/* =========================================================
   MOBILE RESPONSIVENESS
   ========================================================= */

@media (max-width: 480px) {

    .app-header {
        height: 62px;

        padding: 0 13px;
    }

    .brand-icon {
        width: 36px;
        height: 36px;
    }

    .brand-icon svg {
        width: 21px;
        height: 21px;
    }

    .brand-name {
        font-size: 15px;
    }

    .brand-subtitle {
        font-size: 9px;
    }

    .header-status {
        font-size: 9px;

        gap: 6px;
    }

    .document-toolbar {
        min-height: 65px;

        padding: 10px;
    }

    .document-name {
        font-size: 11px;

        max-width: 190px;
    }

    .document-status {
        font-size: 9px;
    }

    .document-icon {
        width: 34px;
        height: 34px;
    }

    .toolbar-controls {
        gap: 5px;
    }

    .toolbar-button {
        width: 31px;
        height: 31px;
    }

    .zoom-level,
    .page-counter {
        font-size: 10px;
    }

    .pdf-scroll-container {
        padding: 12px 5px;
    }

    .pdf-pages {
        gap: 15px;
    }

    .viewer-footer {
        height: 36px;

        padding: 0 10px;

        font-size: 8px;
    }

    .footer-right {
        font-size: 8px;
    }

    .loader-content {
        padding: 32px 20px;
    }

    .loader-content h2 {
        font-size: 17px;
    }

    .loader-content p {
        font-size: 11px;
    }

    .download-statistics {
        gap: 5px;
    }

    .download-stat {
        padding: 10px 3px;
    }

    .download-stat span {
        font-size: 8px;
    }

    .download-stat strong {
        font-size: 10px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-card {
        padding: 27px 19px;

        border-radius: 15px;

        max-height: 94vh;
    }

    .modal-card h2 {
        font-size: 18px;
    }

    .modal-card > p {
        font-size: 11px;
    }

    .signature-canvas-container {
        height: 130px;
    }

    .primary-button {
        min-height: 46px;

        font-size: 11px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }

}
