/* Suppliers Page — extends the shared home.css design system (no new
   color/token set here, so this page matches every other page exactly). */

/* ==========================================================================
   Toolbar (search row above the grid)
   ========================================================================== */
.sup-toolbar {
    margin-bottom: 20px;
}

.sup-search-wrap {
    position: relative;
    max-width: 340px;
}

.sup-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
}

.sup-search-wrap input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--secondary-color);
    background: var(--white);
    transition: border-color 0.15s ease;
}

.sup-search-wrap input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==========================================================================
   Supplier Grid
   ========================================================================== */
#supplierDisplay {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: #64748b;
}

.empty-state i {
    font-size: 2.4rem;
    color: #cbd5e1;
    margin-bottom: 12px;
    display: block;
}

/* ==========================================================================
   Supplier Card
   ========================================================================== */
.med-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow 0.15s ease;
}

.med-card:hover {
    box-shadow: var(--shadow-md);
}

.med-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.med-title {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.status-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.sup-details {
    font-size: 0.85rem;
    color: #64748b;
}

.sup-details i {
    width: 18px;
    color: var(--primary-color);
    margin-right: 4px;
}

/* Balance Badge */
.balance-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--hover-bg);
    border-radius: var(--radius);
}

.balance-info .balance-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
}

.balance-amount {
    font-size: 1.05rem;
    font-weight: 700;
}

.balance-red { color: var(--danger); }
.balance-green { color: var(--success); }

/* Action Buttons */
.med-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.edit-btn {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.15s ease;
}

.edit-btn:hover { filter: brightness(1.08); }

.delete-btn {
    background: #fff1f2;
    color: var(--danger);
    border: 1px solid #fecdd3;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
}

/* ==========================================================================
   Add Supplier Modal
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.show { opacity: 1; }

.modal-content {
    background: var(--white);
    padding: 26px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    transform: translateY(-16px);
    transition: transform 0.2s ease;
}

.modal.show .modal-content { transform: translateY(0); }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-head h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.modal-head i {
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
}

.modal-head i:hover { color: var(--secondary-color); }

#supForm label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    margin: 12px 0 6px;
}

#supForm label:first-of-type { margin-top: 0; }

#supForm input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--secondary-color);
}

#supForm input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    flex: 1;
    background: var(--hover-bg);
    color: var(--secondary-color);
    border: none;
    padding: 11px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
}

.btn-cancel:hover { background: var(--border-color); }

@media (max-width: 600px) {
    #supplierDisplay {
        grid-template-columns: 1fr;
    }
}