/* Bookstore order page — professional layout */

:root {
    --bs-bg: #eef2f7;
    --bs-surface: #ffffff;
    --bs-border: #dbe2ea;
    --bs-text: #0f172a;
    --bs-muted: #64748b;
    --bs-navy: #0e5a74;
    --bs-navy-dark: #084d65;
    --bs-accent: #2563eb;
    --bs-accent-hover: #1d4ed8;
    --bs-radius: 16px;
    --bs-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

body.bookstore-order {
    background: var(--bs-bg) !important;
    background-attachment: scroll !important;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--bs-text);
}

body.bookstore-order .public-main.bookstore-main {
    max-width: 920px;
    padding: 20px 16px 32px;
}

/* Header */
body.bookstore-order .public-header {
    background: var(--bs-surface);
    border-bottom: 1px solid var(--bs-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

body.bookstore-order .public-header .public-brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

body.bookstore-order .public-header .public-brand h1 {
    font-size: 17px;
    font-weight: 700;
}

body.bookstore-order .public-header .public-brand p {
    font-size: 13px;
    color: var(--bs-muted);
}

body.bookstore-order .public-header .public-login-btn {
    background: var(--bs-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
}

body.bookstore-order .public-header .public-login-btn:hover {
    background: var(--bs-accent-hover);
}

/* Shell */
.bookstore-shell {
    display: grid;
    gap: 18px;
}

/* Intro header — title + tahun akademik dalam satu baris */
.bs-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 22px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0e5a74 100%);
    color: #fff;
    border-radius: var(--bs-radius);
    box-shadow: var(--bs-shadow);
}

.bs-intro-copy {
    flex: 1 1 240px;
    min-width: 0;
}

.bs-intro-title {
    margin: 0 0 6px;
    font-size: clamp(22px, 3.5vw, 28px);
    line-height: 1.2;
    font-weight: 700;
}

.bs-intro-desc {
    margin: 0;
    max-width: 480px;
    font-size: 14px;
    line-height: 1.55;
    color: #dbeafe;
}

.bs-intro-year {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 200px;
}

.bs-intro-year label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
}

.bs-year-select {
    appearance: none;
    min-width: 200px;
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bs-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.bs-year-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.45);
}

/* Legacy page head (unused on order page, kept for compatibility) */
.bs-page-head {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0e5a74 100%);
    color: #fff;
    border-radius: var(--bs-radius);
    padding: 28px 24px;
    box-shadow: var(--bs-shadow);
}

.bs-page-title {
    margin: 0 0 8px;
    font-size: clamp(24px, 4vw, 32px);
    line-height: 1.2;
    font-weight: 700;
}

.bs-page-desc {
    margin: 0;
    max-width: 560px;
    font-size: 15px;
    line-height: 1.6;
    color: #dbeafe;
}

/* Hero slider (when images exist) */
.bs-hero.ticket-hero-card {
    background: transparent;
    border: none;
    box-shadow: var(--bs-shadow);
    border-radius: var(--bs-radius);
    overflow: hidden;
    min-height: 200px;
}

.ticket-hero-track {
    position: relative;
    min-height: 200px;
}

.ticket-hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
}

.ticket-hero-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.ticket-hero-slide img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.ticket-hero-caption {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    backdrop-filter: blur(4px);
}

.ticket-hero-caption h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.ticket-hero-caption p {
    margin: 0;
    font-size: 13px;
    color: #e2e8f0;
}

.ticket-hero-dots {
    position: absolute;
    right: 14px;
    bottom: 10px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
}

.hero-dot.active {
    background: #fff;
    width: 22px;
}

/* Lookup — collapsible, tidak mengganggu alur order */
.bs-lookup {
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: 12px;
    overflow: hidden;
}

.bs-lookup-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--bs-text);
    user-select: none;
}

.bs-lookup-summary::-webkit-details-marker {
    display: none;
}

.bs-lookup-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    color: var(--bs-muted);
    transition: transform 0.2s ease;
}

.bs-lookup[open] .bs-lookup-summary::before {
    transform: rotate(90deg);
}

.bs-lookup-summary:hover {
    background: #f8fafc;
}

.bs-lookup-body {
    padding: 0 18px 16px;
    border-top: 1px solid var(--bs-border);
}

.bs-lookup-hint {
    margin: 12px 0 10px;
    font-size: 13px;
    color: var(--bs-muted);
}

.bs-lookup-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.bs-lookup-row input {
    flex: 1;
    margin: 0;
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
    border: 1px solid var(--bs-border);
    border-radius: 10px;
    background: #fff;
    color: var(--bs-text);
}

.bs-lookup-row input:focus {
    outline: none;
    border-color: var(--bs-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bs-lookup .bs-search-btn {
    margin: 0 !important;
    width: auto !important;
    min-width: 84px;
    min-height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 10px;
    background: var(--bs-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.bs-lookup .bs-search-btn:hover {
    background: var(--bs-accent-hover);
}

.bs-lookup .ticket-lookup-result {
    margin-top: 12px;
}

/* Legacy lookup card */
.bs-lookup.ticket-check-card {
    background: linear-gradient(135deg, var(--bs-navy) 0%, var(--bs-navy-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--bs-radius);
    padding: 20px 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 16px 20px;
    align-items: center;
    box-shadow: var(--bs-shadow);
}

.ticket-check-text h2 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.ticket-check-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.88);
}

.ticket-check-action {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.ticket-check-action input {
    flex: 1;
    margin: 0;
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    min-height: 48px;
    font-size: 14px;
    background: #fff;
    color: var(--bs-text);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.ticket-check-action input:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 0;
}

.bs-search-btn {
    margin: 0 !important;
    width: auto !important;
    min-width: 88px;
    min-height: 48px;
    padding: 0 20px !important;
    border: none;
    border-radius: 12px;
    background: #facc15;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.bs-search-btn:hover {
    background: #fde047;
}

.bs-search-btn::before {
    content: none !important;
}

.ticket-lookup-result {
    grid-column: 1 / -1;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.22);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.ticket-lookup-result.empty {
    color: #e2e8f0;
    font-size: 14px;
}

.ticket-lookup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 10px 12px;
}

.lookup-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 7px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Workspace cards */
.bs-workspace {
    display: grid;
    gap: 18px;
}

.bs-card {
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-radius);
    padding: 22px;
    box-shadow: var(--bs-shadow);
}

.bs-step-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bs-card .panel-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.bs-card .panel-subtitle {
    margin: 0 0 18px;
    color: var(--bs-muted);
    font-size: 14px;
    line-height: 1.55;
}

.bs-catalog-head .panel-subtitle {
    margin-bottom: 14px;
}

.ticket-order-head .panel-subtitle,
.bs-catalog-head .panel-subtitle {
    margin-bottom: 0;
}

.ticket-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 14px;
}

.bs-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.bs-field select,
body.bookstore-order .order-panel select {
    width: 100%;
    margin: 0 !important;
    padding: 12px 14px;
    border: 1px solid var(--bs-border);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    color: var(--bs-text);
    appearance: auto;
}

.bs-field select:focus,
body.bookstore-order .order-panel select:focus {
    outline: 2px solid #93c5fd;
    border-color: #93c5fd;
}

.bs-field select:disabled {
    background: #f8fafc;
    color: #94a3b8;
}

.ticket-order-note {
    margin: 14px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--bs-muted);
    font-size: 13px;
    line-height: 1.55;
}

body.bookstore-order .summary-box {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    line-height: 1.65;
    color: #334155;
}

.bs-primary-btn,
body.bookstore-order .order-panel .bs-primary-btn {
    width: 100%;
    margin: 0 !important;
    padding: 13px 18px !important;
    border: none;
    border-radius: 12px;
    background: var(--bs-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.bs-primary-btn:hover:not(:disabled) {
    background: var(--bs-accent-hover);
}

.bs-primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Catalog placeholder */
.catalog-placeholder {
    text-align: center;
    color: var(--bs-muted);
    padding: 36px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
}

.catalog-placeholder-icon {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.7;
}

.catalog-placeholder p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.catalog-panel.empty #booklistContainer {
    display: none !important;
}

/* Booklist table */
.booklist-form-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0f172a;
}

.booklist-form-header h2 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
}

.booklist-form-header p {
    margin: 0;
    color: var(--bs-muted);
    font-size: 13px;
}

.booklist-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.booklist-toolbar button {
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid var(--bs-border);
    background: #f8fafc;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: auto !important;
    margin: 0 !important;
}

.booklist-toolbar button.primary {
    background: var(--bs-accent);
    color: #fff;
    border-color: transparent;
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
}

.booklist-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 13px;
}

.booklist-table th,
.booklist-table td {
    border: 1px solid #e2e8f0;
    padding: 9px 10px;
    vertical-align: middle;
}

.booklist-table thead th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: center;
    font-size: 11px;
    line-height: 1.35;
    color: #475569;
}

.booklist-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.booklist-table tbody tr.row-selected {
    background: #eff6ff;
}

.booklist-table .col-no { width: 42px; text-align: center; }
.booklist-table .col-isbn { width: 110px; text-align: center; font-size: 11px; }
.booklist-table .col-price { width: 90px; text-align: right; white-space: nowrap; }
.booklist-table .col-order { width: 96px; text-align: center; }
.booklist-table .col-check { width: 72px; text-align: center; }

.order-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.merge-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

.booklist-table .col-name .product-name {
    font-weight: 600;
}

.booklist-table .col-name .variant-name {
    color: var(--bs-muted);
}

.booklist-table .qty-input {
    width: 56px;
    padding: 5px 6px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin: 0 !important;
}

.booklist-table .order-check,
.booklist-table .staff-check,
.booklist-table .parent-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--bs-accent);
}

.booklist-table .order-check:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.booklist-table .staff-check,
.booklist-table .parent-check {
    cursor: default;
    opacity: 0.45;
}

.booklist-table tfoot td {
    font-weight: 700;
    background: #f8fafc;
}

.package-agreement {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.package-agreement input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Modal */
body.bookstore-order .modal-backdrop {
    background: rgba(15, 23, 42, 0.45);
}

body.bookstore-order .modal-card {
    border-radius: 18px;
    padding: 22px;
    max-width: 480px;
}

body.bookstore-order .modal-card input,
body.bookstore-order .modal-card textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 11px 14px;
    border: 1px solid var(--bs-border);
    border-radius: 10px;
    font-size: 14px;
}

body.bookstore-order .modal-actions {
    display: flex;
    gap: 10px;
}

body.bookstore-order .modal-actions button {
    flex: 1;
    margin: 0 !important;
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

body.bookstore-order .modal-actions .secondary {
    background: #f1f5f9;
    border: 1px solid var(--bs-border);
    color: var(--bs-text);
}

body.bookstore-order .alert {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.55;
}

/* Printable order proof page */
.booklist-print-page {
    margin: 0;
    padding: 24px;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
    background: #e5e7eb;
}

.booklist-sheet {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    padding: 28px 32px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.print-toolbar {
    max-width: 980px;
    margin: 0 auto 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.print-toolbar button,
.print-toolbar a {
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #111827;
    cursor: pointer;
}

.print-toolbar button {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.booklist-header {
    text-align: center;
    margin-bottom: 20px;
}

.booklist-school {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.booklist-header h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.booklist-meta {
    margin-bottom: 16px;
    font-size: 14px;
}

.meta-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.meta-label {
    min-width: 110px;
    font-weight: 600;
}

.meta-value.underline {
    border-bottom: 1px solid #111827;
    flex: 1;
    min-width: 200px;
}

.booklist-sheet .booklist-table {
    min-width: 0;
    font-size: 11px;
}

.booklist-sheet .booklist-table th,
.booklist-sheet .booklist-table td {
    padding: 6px 8px;
}

.row-ordered { font-weight: 600; }
.row-not-ordered { color: #6b7280; }
.check-mark { color: #059669; font-weight: 700; }

.empty-check {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #374151;
    vertical-align: middle;
}

.booklist-signatures {
    margin-top: 24px;
    font-size: 13px;
}

.sign-date { margin: 0 0 16px; }

.sign-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.sign-line {
    border-bottom: 1px solid #111827;
    height: 48px;
    margin-bottom: 6px;
}

.sign-box p { margin: 0; }

.booklist-notes {
    margin-top: 20px;
    font-size: 12px;
    line-height: 1.6;
}

.booklist-notes ol {
    margin: 8px 0 0;
    padding-left: 20px;
}

.booklist-footer-meta {
    margin-top: 16px;
    font-size: 12px;
    color: #64748b;
}

@media print {
    .no-print { display: none !important; }
    .booklist-print-page { padding: 0; background: #fff; }
    .booklist-sheet { box-shadow: none; padding: 0; max-width: none; }
}

@media (max-width: 820px) {
    .bs-intro {
        padding: 18px 16px;
    }

    .bs-intro-year {
        width: 100%;
    }

    .bs-lookup-row {
        flex-direction: column;
    }

    .bs-lookup .bs-search-btn {
        width: 100% !important;
    }

    .bs-lookup.ticket-check-card {
        grid-template-columns: 1fr;
    }

    .ticket-form-grid {
        grid-template-columns: 1fr;
    }

    .sign-grid {
        grid-template-columns: 1fr;
    }
}
