/* CentraMEDKIT Product Details — Modern */

:root {
    --pd-ink: #0f172a;
    --pd-ink-700: #334155;
    --pd-ink-500: #64748b;
    --pd-ink-400: #94a3b8;
    --pd-line: #e2e8f0;
    --pd-line-strong: #cbd5e1;
    --pd-brand: #2563eb;
    --pd-brand-700: #1d4ed8;
    --pd-brand-50: #eff6ff;
}

.pd-wrap {
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Header */

.pd-header {
    position: sticky;
    top: 56px;
    z-index: 99;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 1.25rem;
}

.pd-header-main {
    min-width: 0;
}

.pd-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    transition: all 0.2s ease;
}

.pd-back:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateX(-2px);
}

.pd-back svg {
    width: 14px;
    height: 14px;
}

.pd-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--pd-ink);
}

.pd-breadcrumb {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--pd-ink-400);
}

.pd-breadcrumb a {
    color: var(--pd-brand);
    text-decoration: none;
}

.pd-header-badge {
    flex: none;
    align-self: center;
}

.pd-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.pd-status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.pd-status-in {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.pd-status-low {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.pd-status-out {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* Message */

.pd-message {
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.pd-message-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.pd-message-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

/* Layout */

.pd-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
    align-items: start;
}

.pd-main-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.pd-side-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Cards */

.pd-card {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 16px;
    box-shadow: 0 8px 24px -14px rgba(2, 24, 72, 0.2);
    padding: 1.5rem;
}

.pd-card-header {
    margin-bottom: 1.25rem;
}

.pd-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pd-ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pd-card-title svg {
    width: 17px;
    height: 17px;
    color: var(--pd-brand);
}

.pd-card-sub {
    margin: 0.25rem 0 0;
    font-size: 0.82rem;
    color: var(--pd-ink-500);
}

/* Overview stats */

.pd-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

.pd-stat {
    padding: 0.9rem 1.1rem;
    background: #f8fafc;
    border: 1px solid var(--pd-line);
    border-radius: 12px;
}

.pd-stat-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--pd-ink-500);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.pd-stat-label svg {
    width: 14px;
    height: 14px;
}

.pd-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pd-ink);
    word-break: break-word;
}

.pd-description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pd-line);
}

.pd-description p {
    margin: 0;
    color: var(--pd-ink-500);
    line-height: 1.6;
    font-size: 0.92rem;
}

/* Stock stats */

.pd-stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.pd-stock-stat {
    text-align: center;
    padding: 1.4rem 1rem;
    border-radius: 12px;
}

.pd-stock-stat .num {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.pd-stock-stat .lbl {
    color: var(--pd-ink-500);
    font-size: 0.85rem;
}

.pd-stock-green { background: rgba(16, 185, 129, 0.1); }
.pd-stock-green .num { color: #10b981; }
.pd-stock-amber { background: rgba(245, 158, 11, 0.1); }
.pd-stock-amber .num { color: #f59e0b; }
.pd-stock-blue { background: rgba(59, 130, 246, 0.1); }
.pd-stock-blue .num { color: #3b82f6; }

/* Transactions table */

.pd-table-wrap {
    overflow-x: auto;
}

.pd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.pd-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--pd-ink-700);
    background: #f8fafc;
    border-bottom: 1px solid var(--pd-line);
}

.pd-table th.num,
.pd-table td.num {
    text-align: right;
}

.pd-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--pd-line);
    color: var(--pd-ink-500);
}

.pd-table tbody tr:last-child td {
    border-bottom: none;
}

.pd-table tbody tr:hover td {
    background: rgba(15, 23, 42, 0.02);
}

.pd-type-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
}

.pd-type-in { background: rgba(16, 185, 129, 0.1); color: #059669; }
.pd-type-out { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.pd-type-other { background: rgba(79, 70, 229, 0.1); color: #4f46e5; }

.pd-empty {
    padding: 2rem;
    text-align: center;
    color: var(--pd-ink-400);
}

/* Pricing */

.pd-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px dashed var(--pd-line);
}

.pd-price-row:last-child {
    border-bottom: none;
}

.pd-price-row .lbl {
    color: var(--pd-ink-500);
    font-size: 0.88rem;
}

.pd-price-row .val {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--pd-ink);
}

.pd-total-row .val {
    color: var(--pd-brand-700);
}

/* Additional details */

.pd-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1.25rem;
}

.pd-detail {
    padding: 0.55rem 0;
}

.pd-detail .label {
    display: block;
    color: var(--pd-ink-400);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.pd-detail .value {
    color: var(--pd-ink-700);
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-word;
}

.pd-detail .value .active-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.45rem;
    vertical-align: middle;
}

.pd-detail .value-expired {
    color: #ef4444;
}

/* Quick actions */

.pd-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.pd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.pd-btn svg {
    width: 15px;
    height: 15px;
}

.pd-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px -8px rgba(2, 24, 72, 0.3);
}

.pd-btn-edit { background: #4f46e5; color: #fff; }
.pd-btn-view { background: #eef2ff; color: #4f46e5; border-color: rgba(79, 70, 229, 0.12); }
.pd-btn-add { background: #ecfdf5; color: #059669; border-color: rgba(5, 150, 105, 0.12); }
.pd-btn-remove { background: #fff1f2; color: #dc2626; border-color: rgba(220, 38, 38, 0.12); }

/* Modals */

.pd-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(8, 20, 45, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: pdFade 0.25s ease;
}

.pd-modal-box {
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px -20px rgba(2, 24, 72, 0.45);
    padding: 1.75rem;
    box-sizing: border-box;
    animation: pdModalIn 0.25s ease;
}

.pd-modal-wide { max-width: 880px; }
.pd-modal-sm { max-width: 440px; }

.pd-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pd-modal-head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--pd-ink);
}

.pd-modal-actions {
    display: flex;
    gap: 0.5rem;
    flex: none;
}

.pd-modal-close {
    background: #fff;
    color: var(--pd-ink-500);
    border: 1.5px solid var(--pd-line-strong);
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.pd-modal-close:hover {
    color: var(--pd-ink);
    border-color: var(--pd-ink-400);
}

.pd-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.pd-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pd-field.full {
    grid-column: 1 / -1;
}

.pd-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pd-ink-700);
}

.pd-field input,
.pd-field textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--pd-line-strong);
    border-radius: 10px;
    background: #fbfcfe;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--pd-ink);
    box-sizing: border-box;
}

.pd-field input:disabled,
.pd-field textarea:disabled {
    background: #f1f5f9;
    color: var(--pd-ink-500);
}

.pd-stock-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pd-submit {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    color: #fff;
    transition: all 0.2s ease;
}

.pd-submit:hover {
    transform: translateY(-1px);
}

.pd-submit-green { background: #10b981; }
.pd-submit-red { background: #ef4444; }

/* Coming soon (error state) */

.pd-error {
    max-width: 560px;
    margin: 3rem auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 32px -14px rgba(2, 24, 72, 0.25);
    padding: 3rem 2rem;
    text-align: center;
}

.pd-error-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.pd-error h2 {
    margin: 0 0 0.75rem;
    color: var(--pd-ink);
    font-size: 1.5rem;
}

.pd-error p {
    margin: 0;
    color: var(--pd-ink-500);
    line-height: 1.6;
}

.pd-error p a {
    color: var(--pd-brand);
    text-decoration: none;
}

/* Animations */

@keyframes pdFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pdModalIn {
    from {
        transform: translateY(16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

/* Responsive */

@media (max-width: 900px) {
    .pd-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pd-wrap {
        padding: 1rem;
    }

    .pd-header {
        position: static;
    }

    .pd-form-grid {
        grid-template-columns: 1fr;
    }

    .pd-actions {
        grid-template-columns: 1fr;
    }

    .pd-details {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
