/* ===== SOP Divisi TI — YPN Karangturi — Shared Styles ===== */
:root {
    --primary: #1a3a5c;
    --primary-light: #2c5f8a;
    --primary-dark: #0f2440;
    --accent: #e8a838;
    --accent-light: #f5c563;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --success: #38a169;
    --warning: #d69e2e;
    --danger: #e53e3e;
    --info: #3182ce;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --transition: all 0.25s ease;
    --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font-sans); color: var(--text); background: var(--bg); line-height: 1.7; }

/* ===== Top Bar ===== */
.top-bar { background: #fff; height: 56px; padding: 0 32px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-left a { color: var(--primary); text-decoration: none; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.top-bar-left a:hover { color: var(--primary-light); }
.breadcrumb { font-size: 0.85rem; color: var(--text-light); }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.print-btn { background: var(--primary); color: #fff; border: none; padding: 7px 18px; border-radius: var(--radius); cursor: pointer; font-size: 0.82rem; font-family: var(--font-sans); font-weight: 500; transition: var(--transition); }
.print-btn:hover { background: var(--primary-light); }
.doc-version { font-size: 0.72rem; background: var(--bg); color: var(--text-light); padding: 4px 12px; border-radius: 20px; font-weight: 600; border: 1px solid var(--border); }

/* ===== Page Header ===== */
.page-header { background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, var(--primary-light)); color: #fff; padding: 48px 40px 40px; text-align: center; }
.page-header h1 { font-size: 1.7rem; margin-bottom: 6px; font-weight: 700; }
.page-header p { font-size: 0.95rem; opacity: 0.8; }
.page-header .meta { display: flex; justify-content: center; gap: 24px; margin-top: 20px; flex-wrap: wrap; font-size: 0.82rem; }
.page-header .meta-item label { display: block; font-size: 0.68rem; opacity: 0.55; text-transform: uppercase; letter-spacing: 1px; }

/* ===== Content ===== */
.content { padding: 40px 48px; max-width: 960px; margin: 0 auto; }

/* ===== Typography ===== */
.section { margin-bottom: 40px; scroll-margin-top: 72px; }
.section-title { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; padding-bottom: 10px; border-bottom: 3px solid var(--accent); }
.subsection-title { font-size: 1.15rem; font-weight: 600; color: var(--primary-light); margin: 24px 0 10px; }
.sub3-title { font-size: 1rem; font-weight: 600; color: var(--text); margin: 18px 0 8px; }
p { margin-bottom: 12px; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Cards ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-accent { border-left: 4px solid var(--accent); }
.card-info { border-left: 4px solid var(--info); background: #ebf4ff; }
.card-warning { border-left: 4px solid var(--warning); background: #fffbeb; }
.card-danger { border-left: 4px solid var(--danger); background: #fff5f5; }
.card-success { border-left: 4px solid var(--success); background: #f0fff4; }
.card h4 { color: var(--primary); margin-bottom: 8px; font-size: 1rem; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.88rem; }
thead { background: var(--primary); color: #fff; }
th { padding: 11px 16px; text-align: left; font-weight: 600; font-size: 0.82rem; }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:hover { background: #f7fafc; }
tbody tr:nth-child(even) { background: #fafbfc; }

/* ===== Lists ===== */
.styled-list { list-style: none; padding: 0; }
.styled-list li { padding: 6px 0 6px 24px; position: relative; }
.styled-list li::before { content: '\25B8'; position: absolute; left: 6px; color: var(--accent); font-weight: 700; }
ol.numbered-list { padding-left: 24px; }
ol.numbered-list li { padding: 5px 0; }
ul.check-list { list-style: none; padding: 0; }
ul.check-list li { padding: 5px 0 5px 26px; position: relative; }
ul.check-list li::before { content: '\2713'; position: absolute; left: 4px; color: var(--success); font-weight: 700; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.73rem; font-weight: 600; }
.badge-primary { background: #dbeafe; color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ===== Flowchart ===== */
.flowchart { display: flex; flex-direction: column; align-items: center; padding: 20px 8px; gap: 0; overflow-x: auto; }
.flow-node { padding: 11px 20px; border-radius: var(--radius); text-align: center; font-size: 0.82rem; font-weight: 500; min-width: 180px; max-width: 320px; }
.flow-start { background: var(--primary); color: #fff; border-radius: 24px; }
.flow-process { background: #dbeafe; color: var(--primary); border: 2px solid var(--info); }
.flow-decision-box { background: #fef3c7; color: #92400e; border: none; font-style: italic; font-weight: 600; padding: 0; min-width: auto; max-width: none; }
.flow-decision-box .diamond { display: inline-block; padding: 16px 28px; background: #fef3c7; border: 2px solid var(--warning); transform: rotate(45deg); margin: 12px auto; }
.flow-decision-box .diamond-text { display: block; transform: rotate(-45deg); white-space: nowrap; font-size: 0.78rem; padding: 4px; }
.flow-diamond { background: #fef3c7; color: #92400e; border: 2px solid var(--warning); font-style: italic; font-weight: 600; font-size: 0.78rem; width: 120px; height: 120px; transform: rotate(45deg); display: flex; align-items: center; justify-content: center; margin: 8px auto; border-radius: 4px; }
.flow-diamond span { display: block; transform: rotate(-45deg); text-align: center; line-height: 1.3; max-width: 140px; }
.flow-end { background: var(--success); color: #fff; border-radius: 24px; }
.flow-arrow { width: 2px; height: 24px; background: var(--text-light); position: relative; }
.flow-arrow::after { content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--text-light); }
.flow-arrow-label { font-size: 0.72rem; color: var(--text-light); margin: 3px 0; font-style: italic; font-weight: 600; }
.flow-branch { display: flex; gap: 28px; align-items: flex-start; justify-content: center; width: 100%; }
.flow-branch-item { display: flex; flex-direction: column; align-items: center; }

/* ===== Org Chart ===== */
.org-chart { display: flex; flex-direction: column; align-items: center; padding: 20px; gap: 0; }
.org-node { background: var(--primary); color: #fff; padding: 12px 24px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); font-weight: 600; font-size: 0.9rem; }
.org-node small { display: block; font-weight: 400; opacity: 0.8; font-size: 0.78rem; }
.org-connector { width: 2px; height: 20px; background: var(--primary-light); }
.org-branch { display: flex; gap: 36px; position: relative; }
.org-branch::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: calc(100% - 140px); height: 2px; background: var(--primary-light); }
.org-branch-item { display: flex; flex-direction: column; align-items: center; }
.org-branch-item .org-connector-h { width: 2px; height: 20px; background: var(--primary-light); }
.org-node-sub { background: var(--primary-light); color: #fff; padding: 10px 20px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); font-weight: 500; font-size: 0.85rem; }
.org-node-sub small { display: block; font-weight: 400; opacity: 0.8; font-size: 0.73rem; }

/* ===== SOP Box ===== */
.sop-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; padding: 18px 24px; border-radius: var(--radius) var(--radius) 0 0; }
.sop-header h3 { margin: 0; font-size: 1.05rem; }
.sop-header p { margin: 3px 0 0; font-size: 0.78rem; opacity: 0.85; }
.sop-body { background: #fff; padding: 24px; border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.sop-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.sop-meta-item label { display: block; font-size: 0.7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 1px; }
.sop-meta-item span { font-size: 0.88rem; font-weight: 500; }

/* ===== Tabs ===== */
.tabs { display: flex; margin-bottom: 20px; overflow-x: auto; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 4px; gap: 3px; }
.tab-btn { flex: 1; padding: 9px 16px; background: transparent; border: none; border-radius: 6px; cursor: pointer; font-size: 0.87rem; color: var(--text-light); font-weight: 600; white-space: nowrap; transition: var(--transition); font-family: var(--font-sans); text-align: center; }
.tab-btn:hover { background: #e8edf4; color: var(--primary); }
.tab-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(26,58,92,0.18); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Links ===== */
.sys-link { display: inline-flex; align-items: center; padding: 3px 10px; background: #ebf4ff; border-radius: 4px; font-size: 0.82rem; font-family: var(--font-mono); margin: 2px 0; }

/* ===== Portal Cards ===== */
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin: 24px 0; }
.portal-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transition: var(--transition); text-decoration: none; color: var(--text); display: block; }
.portal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); text-decoration: none; }
.portal-card .card-icon { font-size: 1.6rem; margin-bottom: 10px; }
.portal-card h3 { font-size: 1rem; color: var(--primary); margin-bottom: 6px; }
.portal-card p { font-size: 0.83rem; color: var(--text-light); margin: 0; line-height: 1.5; }
.portal-card .card-tag { margin-top: 12px; }

/* ===== Footer ===== */
.footer { padding: 28px 32px; background: var(--primary-dark); color: rgba(255,255,255,0.6); text-align: center; font-size: 0.78rem; line-height: 1.8; }
.footer strong { color: rgba(255,255,255,0.9); }
.footer a { color: var(--accent-light); }

/* ===== Back to Top ===== */
.back-to-top { position: fixed; bottom: 20px; right: 20px; width: 40px; height: 40px; background: var(--primary); color: #fff; border: none; border-radius: 50%; font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow-lg); display: none; align-items: center; justify-content: center; z-index: 500; transition: var(--transition); }
.back-to-top:hover { background: var(--primary-light); }
.back-to-top.visible { display: flex; }

/* ===== Utilities ===== */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--text-light); } .text-small { font-size: 0.84rem; }
.text-center { text-align: center; } .fw-600 { font-weight: 600; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .content { padding: 24px 16px; }
    .top-bar { padding: 0 16px; height: 50px; }
    .page-header { padding: 36px 16px 28px; }
    .page-header h1 { font-size: 1.25rem; }
    .page-header .meta { flex-direction: column; gap: 8px; }
    .section-title { font-size: 1.15rem; }
    .card { padding: 16px; }
    .sop-body { padding: 16px; }
    .table-wrapper { margin-left: -16px; margin-right: -16px; border-radius: 0; }
    .tabs { gap: 2px; }
    .tabs .tab-btn { padding: 7px 8px; font-size: 0.78rem; }
    .portal-grid { grid-template-columns: 1fr; }
    .org-branch { flex-direction: column; gap: 14px; align-items: center; }
    .org-branch::before { display: none; }
    .flow-branch { flex-direction: column; gap: 10px; align-items: center; }
    .footer { padding: 20px 16px; }
}

@media print {
    .top-bar, .print-btn, .back-to-top, .btn-actions, .no-print { display: none !important; }
    .page-header { padding: 24px; }
    body { font-size: 11pt; }
    .content { max-width: 100%; padding: 20px; }
}

/* ===== Loading / Disabled State ===== */
.btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.btn-loading { display: inline-flex; align-items: center; gap: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

/* ===== reCAPTCHA ===== */
.recaptcha-wrap { margin: 16px 0 4px; }
@media (max-width: 400px) {
    .recaptcha-wrap .g-recaptcha { transform: scale(0.88); transform-origin: left top; }
}

/* ===== Input Group (prefix/suffix) ===== */
.input-group { display: flex; align-items: stretch; }
.input-group .form-input { border-radius: var(--radius) 0 0 var(--radius); border-right: none; flex: 1; min-width: 0; }
.input-group-suffix { padding: 9px 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.82rem; color: var(--text-light); white-space: nowrap; display: flex; align-items: center; flex-shrink: 0; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: #e53e3e; margin-left: 2px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.88rem; font-family: var(--font-sans); color: var(--text); background: #fff; transition: var(--transition); box-sizing: border-box; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(44,95,138,0.1); }
.form-input:disabled, .form-select:disabled { background: var(--bg); color: var(--text-light); cursor: not-allowed; }
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint { font-size: 0.78rem; color: var(--text-light); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-check-group { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.form-check-inline { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.form-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { margin-top: 2px; accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.form-check-label { font-size: 0.88rem; color: var(--text); line-height: 1.4; }
.form-section-title { font-size: 0.92rem; font-weight: 700; color: var(--primary); margin: 28px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.form-section-title:first-child { margin-top: 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; border-radius: var(--radius); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: var(--transition); font-family: var(--font-sans); border: none; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-required-note { font-size: 0.78rem; color: var(--text-light); margin-bottom: 20px; }
.form-ref { font-size: 0.78rem; color: var(--text-light); font-family: var(--font-mono); background: var(--bg); padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border); }
/* Success screen */
.form-body { transition: opacity 0.3s; }
.form-success { display: none; text-align: center; padding: 48px 24px; }
.form-success.show { display: block; }
.form-success-icon { font-size: 3.5rem; margin-bottom: 16px; }
.form-success h3 { font-size: 1.3rem; color: var(--primary); margin-bottom: 8px; font-weight: 700; }
.form-success p { color: var(--text-light); margin-bottom: 6px; font-size: 0.9rem; }
.success-ref { font-size: 1rem; font-weight: 700; color: var(--primary); font-family: var(--font-mono); background: var(--bg); padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border); display: inline-block; margin: 8px 0 24px; }
/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.87rem; margin-bottom: 20px; border-left: 4px solid; }
.alert-warning { background: #fffbeb; border-color: var(--accent); color: #744210; }
.alert-info { background: #ebf4ff; border-color: #3b82f6; color: #1e3a8a; }
.alert-danger { background: #fff5f5; border-color: #e53e3e; color: #c53030; }
/* Forms index */
.form-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); transition: var(--transition); text-decoration: none; color: var(--text); display: flex; align-items: flex-start; gap: 16px; }
.form-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.form-card-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.form-card h3 { font-size: 0.95rem; color: var(--primary); margin-bottom: 4px; font-weight: 700; }
.form-card p { font-size: 0.82rem; color: var(--text-light); margin: 0; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 8px; }
@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .btn-actions { justify-content: stretch; }
    .btn-actions .btn { flex: 1; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
    .input-group-suffix { font-size: 0.72rem; padding: 9px 7px; }
    .form-check { padding: 4px 0; }
    .form-check input[type="checkbox"], .form-check input[type="radio"] { width: 18px; height: 18px; margin-top: 1px; }
    .btn { padding: 11px 20px; font-size: 0.9rem; }
}
