/* Custom Premium Stylesheet for Preplam PTS System */

:root {
    --preplam-blue: #009EE0;
    --soft-blue: #BCE2F4;
    --neutral-dark: #444444;
    --gray-bg: #f8fafc;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --border-color: #e2e8f0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background: #f1f5f9;
    color: var(--slate-800);
}

/* Header design */
.app-header {
    background: var(--slate-800);
    color: white;
    border-bottom: 2px solid var(--preplam-blue);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.logo-badge {
    background: var(--preplam-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-item {
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    color: white;
    background: rgba(255,255,255,0.05);
}

.btn-danger-nav:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
}

.btn-primary {
    background: var(--preplam-blue);
    color: white !important;
}

.btn-primary:hover {
    background: #0087c2 !important;
}

/* Layout container */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.container-small {
    max-width: 600px;
}

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

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--slate-800);
}

.subtitle {
    margin: 0;
    color: #64748b;
    font-size: 1rem;
}

/* Premium Card and Table styling */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.table th, .table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table th {
    background: var(--gray-bg);
    color: var(--slate-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: #f8fafc;
}

.font-mono {
    font-family: 'Roboto Mono', monospace;
}

.font-bold {
    font-weight: 600;
}

.product-title {
    font-weight: 600;
    color: var(--slate-800);
    margin-bottom: 3px;
}

.text-muted {
    color: #64748b;
    font-size: 0.8rem;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 100px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-outline { border: 1px solid var(--border-color); color: #475569; }

.actions-cell {
    display: flex;
    gap: 8px;
}

/* Button UI elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-primary { background: var(--preplam-blue); color: white; }
.btn-primary:hover { background: #008cc7; }

.btn-secondary { background: #e2e8f0; color: var(--slate-700); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover { background: #0284c7; }

.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

/* Dialog confirm overlay */
.confirm-dialog {
    border: none;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    max-width: 400px;
    width: 100%;
}

.confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.confirm-dialog h3 {
    margin-top: 0;
    color: var(--slate-800);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Form Styles */
.form-card {
    padding: 30px;
}

.modern-form .form-group {
    margin-bottom: 20px;
}

.modern-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--preplam-blue);
    box-shadow: 0 0 0 3px rgba(0, 158, 224, 0.15);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* ==========================================
   A4 SIMULATOR & PDF WYSIWYG RENDERING 
   ========================================== */

.a4-page {
    position: relative;
    width: 210mm;
    height: 297mm;
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    padding: 40px 40px 140px 75px; /* leftMargin=62pt (82px), rightMargin=42pt (56px) approx */
    overflow: hidden;
    color: #444444;
    font-family: 'Arial', sans-serif;
    page-break-after: always;
}

.left-blue-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 30px; /* 30 pt */
    background: var(--preplam-blue);
    z-index: 10;
}

/* Content Border frame */
.content-border {
    border: 1px solid var(--soft-blue);
    border-radius: 4px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    background: white;
    padding: 12px;
}

/* Gray line at the bottom of page box */
.footer-gray-line {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    border-top: 0.5px solid var(--soft-blue);
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 7pt;
    color: #777777;
}

/* Footer Slogan outside the blue border */
.page-footer-slogan {
    position: absolute;
    bottom: 30px;
    left: 75px;
    right: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.footer-slogan-large {
    font-size: 15pt;
    color: var(--preplam-blue);
    text-align: center;
    margin-bottom: 5px;
}

.footer-page-number {
    position: absolute;
    right: 0;
    bottom: 0;
    font-size: 7.5pt;
    color: #444444;
}

/* WYSIWYG Header Table */
.pdf-header-table {
    display: flex;
    width: 100%;
    gap: 15px;
    margin-bottom: 8px;
}

.header-col {
    display: flex;
    flex-direction: column;
}

.col-photo {
    width: 110px;
    height: 110px;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.col-photo:hover .upload-hint {
    opacity: 1;
}

.upload-hint {
    position: absolute;
    background: rgba(15,23,42,0.85);
    color: white;
    font-size: 8px;
    text-align: center;
    padding: 4px;
    bottom: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.cad-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.col-details {
    flex: 1;
}

.pdf-header-title {
    font-size: 10pt;
    font-weight: bold;
    color: #666666;
    line-height: 1.3;
}

.pdf-header-subtitle {
    font-size: 14pt;
    font-weight: bold;
    color: var(--preplam-blue);
    line-height: 1.3;
    margin-bottom: 3px;
    border: 1px transparent dashed;
}

.pdf-header-subtitle:hover {
    border-color: var(--preplam-blue);
    background: rgba(0, 158, 224, 0.03);
}

.pdf-header-desc {
    font-size: 7.5pt;
    font-style: italic;
    color: #666666;
    margin-bottom: 4px;
}

.dim-section {
    margin-top: 4px;
}

.dim-title {
    font-size: 8.5pt;
    font-weight: bold;
    color: var(--preplam-blue);
    margin-bottom: 2px;
}

.dim-row {
    font-size: 8pt;
    color: #444444;
}

.dim-row span {
    border: 1px transparent dashed;
    padding: 0 2px;
}

.dim-row span:hover {
    border-color: var(--preplam-blue);
    background: rgba(0, 158, 224, 0.03);
}

.col-logo-draw {
    width: 140px;
    align-items: flex-end;
}

.kanta-draw-box {
    width: 120px;
    height: 75px;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.kanta-draw-box:hover .upload-hint {
    opacity: 1;
}

/* Horizontal Bands */
.band-section {
    display: flex;
    border-top: 0.5px solid var(--soft-blue);
    padding: 6px 0;
    width: 100%;
}

.band-left {
    width: 115px;
    font-size: 9pt;
    font-weight: bold;
    color: var(--preplam-blue);
    padding-right: 5px;
    box-sizing: border-box;
}

.band-right {
    flex: 1;
    font-size: 7.5pt;
    color: #444444;
}

/* Table styles inside document bands */
.data-subtable {
    width: 100%;
    border-collapse: collapse;
}

.data-subtable td {
    padding: 1px 0;
    font-size: 7.5pt;
    vertical-align: top;
    border: none;
}

.cell-label {
    width: 90px;
    font-weight: bold;
    color: #444444;
}

.cell-value {
    color: #444444;
    border: 1px transparent dashed !important;
}

.cell-value:hover {
    border-color: var(--preplam-blue) !important;
    background: rgba(0, 158, 224, 0.03);
}

.bullet-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bullet-list strong {
    border: 1px transparent dashed;
    padding: 0 2px;
}

.bullet-list strong:hover {
    border-color: var(--preplam-blue);
    background: rgba(0, 158, 224, 0.03);
}

.sub-bullets {
    padding-left: 10px;
    color: #666666;
}

/* Composition box section 3 */
.composition-box {
    border: 0.5px solid #cccccc;
    background: #f9f9f9;
    padding: 4px 6px;
    font-family: 'Arial', sans-serif;
    font-size: 7.5pt;
    line-height: 1.3;
    margin-bottom: 4px;
}

.pcr-transition-text {
    font-size: 7.5pt;
    line-height: 1.3;
}

/* RecyClass Evaluation box */
.recyclass-box {
    border: 0.5px solid var(--preplam-blue);
    background: #f2f6fa;
    padding: 4px 8px;
    margin-bottom: 6px;
    display: inline-block;
}

.recy-header {
    font-size: 7pt;
    font-weight: bold;
    color: var(--preplam-blue);
    margin-bottom: 2px;
}

.recy-body {
    font-size: 7pt;
    line-height: 1.2;
}

.recy-divider {
    letter-spacing: -1px;
    color: var(--preplam-blue);
}

.recy-result {
    font-weight: bold;
}

/* Page 2 Drawings grid */
.drawings-grid {
    display: flex;
    gap: 10px;
    width: 100%;
}

.drawings-col-left {
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawings-col-right {
    width: 185px;
    display: flex;
}

.draw-item {
    border: 1px transparent solid;
}

.draw-label {
    font-size: 7.5pt;
    font-weight: bold;
    color: #444444;
    margin-bottom: 2px;
}

.draw-img-wrapper {
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #fafafa;
}

.draw-img-wrapper:hover .upload-hint {
    opacity: 1;
}

.cad-img-large {
    max-width: 100%;
    max-height: 95px;
    object-fit: contain;
}

.cad-img-3d {
    max-width: 100%;
    max-height: 205px;
    object-fit: contain;
}

.flex-fill {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Page 3 Logistika & Declaration */
.doc-declaration-box {
    border: 0.5px solid #cccccc;
    background: #fafafa;
    padding: 4px 6px;
    font-size: 7.5pt;
    line-height: 1.35;
}

/* Approval grid */
.approval-grid {
    display: flex;
    gap: 15px;
    width: 100%;
}

.approval-col {
    flex: 1;
    border: 0.5px solid #cccccc;
    background: #fafafa;
    padding: 4px 6px;
    font-size: 7.5pt;
    min-height: 70px;
    display: flex;
    flex-direction: column;
}

.approval-col strong {
    font-size: 7.5pt;
}

.approval-col div[contenteditable="true"] {
    border: 1px transparent dashed;
}

.approval-col div[contenteditable="true"]:hover {
    border-color: var(--preplam-blue);
    background: rgba(0, 158, 224, 0.03);
}

.signature-line {
    margin-top: auto;
    font-size: 7.5pt;
}

/* Universal outline edit state for WYSIWYG */
[contenteditable="true"] {
    outline: none;
    transition: all 0.15s;
}

[contenteditable="true"]:focus {
    background: #f0f9ff !important;
    box-shadow: 0 0 0 2px var(--preplam-blue);
    border-radius: 2px;
}

/* Footer structure for base layout */
.app-footer {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    background: white;
    margin-top: 40px;
}

.app-content {
    min-height: calc(100vh - 160px);
}
