/* ============================================================
   PRE-BOOKING REDESIGN - Premium SaaS UI
   ============================================================ */

:root {
    --pb-modal-width: 1100px;
    --pb-modal-max-height: 92vh;
    --pb-card-bg: #ffffff;
    --pb-card-radius: 16px;
    --pb-card-padding: 24px;
    --pb-border-color: #f1f5f9;
    --pb-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --pb-primary: #4361ee;
    --pb-primary-hover: #3a0ca3;
}

/* Modal Overlay */
.pb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pb-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Modal Container */
.pb-modal-container {
    width: var(--pb-modal-width);
    max-width: 95vw;
    max-height: var(--pb-modal-max-height);
    background: #f8fafc;
    border-radius: 24px;
    box-shadow: var(--pb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pb-modal-overlay.active .pb-modal-container {
    transform: translateY(0) scale(1);
}

/* Sticky Header */
.pb-modal-header {
    background: #ffffff;
    padding: 24px 32px;
    border-bottom: 1px solid var(--pb-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pb-header-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.pb-header-title p {
    font-size: 14px;
    color: #64748b;
    margin: 4px 0 0 0;
}

.pb-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.2s;
}

.pb-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

/* Scrollable Body */
.pb-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

/* Sticky Footer */
.pb-modal-footer {
    background: #ffffff;
    padding: 24px 32px;
    border-top: 1px solid var(--pb-border-color);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Section Cards */
.pb-section-card {
    background: var(--pb-card-bg);
    border-radius: var(--pb-card-radius);
    padding: var(--pb-card-padding);
    margin-bottom: 24px;
    border: 1px solid var(--pb-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.pb-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.pb-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(67, 97, 238, 0.1);
    color: var(--pb-primary);
}

.pb-section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Grid Layout */
.pb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.pb-full-width {
    grid-column: span 2;
}

/* Form Controls */
.pb-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pb-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-left: 2px;
}

.pb-input {
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 15px;
    color: #1e293b;
    transition: all 0.2s;
    width: 100%;
}

.pb-input:focus {
    outline: none;
    border-color: var(--pb-primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

/* Custom Searchable Dropdown */
.pb-search-container {
    position: relative;
    width: 100%;
}

.pb-search-input-wrapper {
    position: relative;
}

.pb-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.pb-search-input {
    padding-left: 48px !important;
}

.pb-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.pb-dropdown-menu.show {
    display: block;
    animation: pb-dropdown-fade 0.2s ease-out;
}

@keyframes pb-dropdown-fade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pb-product-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f8fafc;
}

.pb-product-item:last-child {
    border-bottom: none;
}

.pb-product-item:hover {
    background: #f1f5f9;
}

.pb-product-img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
}

.pb-product-info {
    flex: 1;
}

.pb-product-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.pb-product-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    gap: 8px;
    align-items: center;
}

.pb-product-price {
    font-weight: 700;
    color: var(--pb-primary);
    font-size: 16px;
}

.pb-stock-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
}

.pb-stock-low { background: #fee2e2; color: #ef4444; }
.pb-stock-ok { background: #dcfce7; color: #22c55e; }

/* Selected Product Card */
.pb-selected-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
}

.pb-selected-info {
    flex: 1;
}

.pb-selected-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.pb-selected-variant {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

/* Quantity Controls */
.pb-qty-controls {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.pb-qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #64748b;
    transition: all 0.2s;
}

.pb-qty-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.pb-qty-value {
    width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    color: #1e293b;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.pb-subtotal-box {
    text-align: right;
    min-width: 120px;
}

.pb-subtotal-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 600;
}

.pb-subtotal-value {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.pb-remove-product {
    color: #ef4444;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pb-remove-product:hover {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 8px;
}

/* Payment Summary Cards */
.pb-payment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pb-payment-card {
    padding: 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.pb-payment-card.total { background: #f1f5f9; border-color: #cbd5e1; }
.pb-payment-card.paid { background: #f0fdf4; border-color: #bbf7d0; }
.pb-payment-card.due { background: #fff7ed; border-color: #fed7aa; }

.pb-pay-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 4px;
}

.pb-pay-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.pb-payment-card.paid .pb-pay-value { color: #16a34a; }
.pb-payment-card.due .pb-pay-value { color: #ea580c; }

/* Buttons */
.pb-btn {
    height: 48px;
    padding: 0 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.pb-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.pb-btn-primary {
    background: var(--pb-primary);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(67, 97, 238, 0.2);
}

.pb-btn-primary:hover {
    background: var(--pb-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(67, 97, 238, 0.3);
}

/* Dark Mode Overrides */
.dark .pb-modal-container { background: #0f172a; }
.dark .pb-modal-header, 
.dark .pb-modal-footer,
.dark .pb-section-card { background: #1e293b; border-color: #334155; }
.dark .pb-header-title h2 { color: #f8fafc; }
.dark .pb-section-header h3 { color: #f1f5f9; }
.dark .pb-input { background: #0f172a; border-color: #334155; color: #f1f5f9; }
.dark .pb-dropdown-menu { background: #1e293b; border-color: #334155; }
.dark .pb-product-item:hover { background: #334155; }
.dark .pb-product-name { color: #f1f5f9; }
.dark .pb-selected-card { background: #0f172a; border-color: #334155; }
.dark .pb-selected-name { color: #f1f5f9; }
.dark .pb-qty-controls { background: #1e293b; border-color: #334155; }
.dark .pb-qty-btn { background: #1e293b; }
.dark .pb-qty-value { color: #f1f5f9; border-color: #334155; }
.dark .pb-subtotal-value { color: #f1f5f9; }
.dark .pb-payment-card { background: #0f172a; border-color: #334155; }
.dark .pb-pay-value { color: #f8fafc; }

/* Responsive */
@media (max-width: 1024px) {
    .pb-modal-container { width: 95vw; }
}

@media (max-width: 768px) {
    .pb-grid { grid-template-columns: 1fr; }
    .pb-full-width { grid-column: auto; }
    .pb-payment-grid { grid-template-columns: 1fr; }
    .pb-modal-container { 
        height: 100vh; 
        max-height: 100vh; 
        width: 100vw; 
        max-width: 100vw; 
        border-radius: 0; 
    }
    .pb-modal-body { padding: 20px; }
    .pb-section-card { padding: 16px; margin-bottom: 16px; }
    .pb-selected-card { flex-direction: column; align-items: stretch; text-align: center; }
    .pb-subtotal-box { text-align: center; }
    .pb-modal-footer { padding: 16px 20px; }
    .pb-btn { flex: 1; justify-content: center; }
}
