@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

#StockInForm {
    font-family: 'Ubuntu', sans-serif;
    padding: 15px;
}

/* Header */
.stockin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 10px;
    background: #f0fbf7; /* light mint */
    border: 1px solid #c7e8dd;
}

.stockin-header-left h2 {
    font-size: 26px;
    color: #0f766e; /* deep teal */
    margin-bottom: 10px;
}

.stockin-header-left h2 span {
    font-size: 20px;
    color: #22c55e; /* green accent */
}

.stockin-header-row {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.stockin-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stockin-field label {
    font-size: 12px;
    color: #64748b;
}

.stockin-field input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    min-width: 180px;
}

.stockin-field input:focus {
    outline: 2px solid #22c55e;
    border-color: transparent;
}

.stockin-label-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12px;
}

/* Header right summary */
.stockin-header-right {
    min-width: 230px;
    padding: 10px;
    border-radius: 10px;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
}

.stockin-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    color: #0f172a;
}

.stockin-summary-line span:first-child {
    color: #64748b;
}

.stockin-summary-line input {
    width: 90px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
}

.stockin-summary-net {
    font-weight: 600;
    border-top: 1px dashed #a7f3d0;
    padding-top: 6px;
}

.stockin-summary-net span:last-child {
    color: #16a34a;
    font-size: 15px;
}

.stockin-confirm-btn {
    margin-top: 8px;
    width: 100%;
    padding: 8px 0;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, #0f766e, #22c55e);
    color: #ffffff;
    cursor: pointer;
}

.stockin-confirm-btn:hover {
    filter: brightness(1.05);
}

/* Body layout */
.stockin-body {
    display: flex;
    gap: 18px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stockin-left {
    flex: 0 0 28%;
    max-width: 28%;
}

.stockin-right {
    flex: 1;
}

.stockin-section-title {
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 8px;
}

/* Search box */
.stockin-search-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.stockin-search-input {
    width: 100%;
    padding: 8px 28px 8px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
}

.stockin-search-input:focus {
    outline: 2px solid #22c55e;
    border-color: transparent;
}

.stockin-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
    display: none;
}

/* Results container */
.stockin-results-container {
    max-height: 360px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    padding: 4px 0;
}

.stockin-results-container.hidden {
    display: none;
}

/* Medicine item UI (reused style similar to Sales) */
.medicine-item-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.medicine-item-compact:hover {
    background: #f1f5f9;
    transform: translateX(1px);
}

.medicine-thumb {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.medicine-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.medicine-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
}

.medicine-item-type {
    font-size: 11px;
    color: #64748b;
}

/* Table */
.stockin-table-wrapper {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    overflow-x: auto;
}

.stockin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stockin-table th,
.stockin-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.stockin-table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.stockin-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.stockin-table input[type="number"],
.stockin-table input[type="text"],
.stockin-table input[type="date"] {
    width: 100%;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 12px;
    box-sizing: border-box;
}

.stockin-table input:focus {
    outline: 2px solid #22c55e;
    border-color: transparent;
}

.stockin-remove-btn {
    border: none;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 16px;
    padding: 0;
}

.stockin-remove-btn:hover {
    background: #fecaca;
}

.stockin-footer-note {
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}

/* Hide Stock In page by default */
#StockInForm {
    display: none;
}

/* Responsive */
@media (max-width: 900px) {
    .stockin-header {
        flex-direction: column;
    }
    .stockin-header-right {
        width: 100%;
    }
    .stockin-body {
        flex-direction: column;
    }
    .stockin-left {
        max-width: 100%;
    }
}

/* ---------- StockIn table: base layout ---------- */
.stockin-table-wrapper {
    width: 100%;
    overflow-x: auto;          /* allow horizontal scroll on small screens */
    -webkit-overflow-scrolling: touch; /* smooth scrolling on mobile */
}

.stockin-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;        /* avoid fixed layout that breaks responsiveness */
}

/* Make sure the table doesn't force huge columns */
.stockin-table th,
.stockin-table td {
    padding: 8px 10px;
    font-size: 0.9rem;
    white-space: nowrap;       /* keep header text tidy; scroll instead of wrapping */
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 768px) {
    .stockin-right {
        width: 100%;
    }

    .stockin-table-wrapper {
        margin-top: 10px;
        border-radius: 6px;
        border: 1px solid #eee;
    }

    .stockin-table th,
    .stockin-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .stockin-table th:nth-child(1),
    .stockin-table td:nth-child(1) {
        min-width: 140px;  /* Medicine */
    }

    .stockin-table th:nth-child(2),
    .stockin-table td:nth-child(2),
    .stockin-table th:nth-child(3),
    .stockin-table td:nth-child(3) {
        min-width: 90px;   /* Batch, Expiry */
    }

    .stockin-table th:nth-child(4),
    .stockin-table td:nth-child(4),
    .stockin-table th:nth-child(5),
    .stockin-table td:nth-child(5),
    .stockin-table th:nth-child(6),
    .stockin-table td:nth-child(6),
    .stockin-table th:nth-child(7),
    .stockin-table td:nth-child(7) {
        min-width: 80px;   /* Qty, prices, line total */
    }

    .stockin-table th:last-child,
    .stockin-table td:last-child {
        min-width: 50px;   /* remove button column */
        text-align: center;
    }
}

@media (max-width: 768px) {
  #StockInForm {
    padding: 0 !important; /* main already has padding */
  }

  .stockin-header {
    padding: 12px;
  }
}

/* =====================================
   Stock In – Theme aligned with Sales
   ===================================== */

/* Header container */
.stockin-header {
    background: var(--brown1);
    border: 1px solid var(--brown3);
}

/* Header title */
.stockin-header-left h2 {
    color: var(--Darkbrown);
}

.stockin-header-left h2 span {
    color: var(--Lightbrown);
}

/* Header right summary */
.stockin-header-right {
    background: var(--brown1);
    border: 1px solid var(--brown3);
}

/* Summary labels */
.stockin-summary-line {
    color: var(--Darkbrown);
}

.stockin-summary-line span:first-child {
    color: #6c757d;
}

/* Net total highlight */
.stockin-summary-net span:last-child {
    color: var(--Lightbrown);
}

/* Confirm button – same as Sales confirm */
.stockin-confirm-btn {
    background: var(--Lightbrown);
    color: #fff;
}

.stockin-confirm-btn:hover {
    background: var(--brown);
}

/* Search input */
.stockin-search-input {
    border: 1px solid var(--Lightbrown);
}

.stockin-search-input:focus {
    outline: 2px solid rgba(0, 184, 148, 0.25);
    border-color: transparent;
}

/* Search results container */
.stockin-results-container {
    border: 1px solid var(--brown3);
}

/* Medicine item hover */
.medicine-item-compact:hover {
    background: var(--brown1);
}

/* Section titles */
.stockin-section-title {
    color: var(--Darkbrown);
}

/* Table */
.stockin-table-wrapper {
    border: 1px solid var(--brown3);
}

.stockin-table thead th {
    background: var(--brown1);
    color: var(--Darkbrown);
}

/* Remove button */
.stockin-remove-btn {
    background: #ffe5e5;
    color: #c92a2a;
}

.stockin-remove-btn:hover {
    background: #ffc9c9;
}

/* Footer note */
.stockin-footer-note {
    color: #6c757d;
}
